A graph pebbling algorithm on weighted graphs

A pebbling move on a weighted graph removes some pebbles at a vertex and adds one pebble at an adjacent vertex. The number of pebbles removed is the weight of the edge connecting the vertices. A vertex is reachable from a pebble distribution if it is possible to move a pebble to that vertex using pebbling moves. The pebbling number of a weighted graph is the smallest number $m$ needed to guarantee that any vertex is reachable from any pebble distribution of $m$ pebbles. Regular pebbling problems on unweighted graphs are special cases when the weight on every edge is 2. A regular pebbling problem often simplifies to a pebbling problem on a simpler weighted graph. We present an algorithm to find the pebbling number of weighted graphs. We use this algorithm together with graph simplifications to find the regular pebbling number of all connected graphs with at most nine vertices.


Introduction
Graph pebbling has its origin in number theory.It is a model for the transportation of resources.Starting with a pebble distribution on the vertices of a simple connected graph, a pebbling move removes two pebbles from a vertex and adds one pebble at an adjacent vertex.We can think of the pebbles as fuel containers.Then the loss of the pebble during a move is the cost of transportation.A vertex is called reachable if a pebble can be moved to that vertex using pebbling moves.The pebbling number of a graph is the minimum number of pebbles that guarantees that every vertex is reachable.There are many different variations of pebbling.For a comprehensive list of references for the extensive literature see the survey papers [9,10].
One of our goals is to develop an algorithm that finds the pebbling number in a reasonable amount of computing time.Our approach is similar to the algorithmic approach of [1].Of course this goal is only realistic for relatively small graphs since finding the pebbling number is a Π P 2 -complete problem [13].In spite of this difficulty, the implementation of our algorithm is sufficiently fast to run on a large number of graphs.So it can be used for checking conjectures and finding interesting examples.We also believe that our theory views pebbling numbers from a new perspective and so it might become a useful tool in future research.
The main idea of the algorithm is that if we know all the sufficient distributions from which a given goal vertex is reachable then we can find the insufficient distributions from which the goal vertex is not reachable.An insufficient distribution must be smaller than every sufficient distribution.The pebbling number can be found by finding an insufficient distribution with the most pebbles.The problem is that there are too many sufficient distributions.Luckily it suffices to find the barely sufficient distributions from which the goal vertex is no longer reachable after the removal of any pebble.
Our algorithm works even if the cost of moving a pebble from one vertex to another varies between different vertices.To take advantage of this, we develop the basic theory of graph pebbling on weighted graphs used in [7].
The generalization is worth the effort since pebbling on many graphs can be simplified if we replace the graph by a weighted graph with fewer edges.For example a tree can be replaced by a weighted graph containing a single edge.Cut vertices, leaves and ears offer the most fruitful simplifications.
We use these simplifications and our algorithm to calculate the pebbling number of all connected graphs with at most nine vertices.We present the spectrum of pebbling numbers in terms of the number of vertices in the graph.

Preliminaries
Let G be a simple connected graph.We use the notation V (G) for the vertex set and E(G) for the edge set.We use the standard notation vu = uv for the edge {v, u} ∈ E(G).A path of G is a subgraph isomorphic to the path graph P n JGAA, 14 (2) 221-244 (2010) 223 with n ≥ 1 vertices.A weighted graph G ω is a graph G with a weight function ω : E(G) → N.
A pebble function on G is a function p : V (G) → Z where p(v) is the number of pebbles placed at v. A pebble distribution is a nonnegative pebble function.The size of a pebble distribution p is the total number of pebbles p = v∈V (G) p(v).The support of the pebble distribution p is the set supp(p) = {v ∈ V (G) | p(v) > 0}.We are going to use the notation p(v 1 , . . ., v n , * ) = (a 1 , . . ., a n , q( * )) to indicate that p(v i ) = a i for i ∈ {1, . . ., n} and p(w) = q(w) for all w ∈ V (G) \ {v 1 , . . ., v n }.
If vu ∈ E(G) then the pebbling move (v u) on the weighted graph G ω removes ω(vu) pebbles at vertex v and adds one pebble at vertex u, more precisely, it replaces the pebble function p with the pebble function Note that the resulting pebble function p (v u) might not be a pebble distribution even if p is.
The inverse of the pebbling move (v u) is denoted by (v u) −1 .The inverse removes a pebble from u and adds two pebbles at v, that is, it creates the new distribution p A pebbling sequence is a finite sequence s = (s 1 , . . ., s k ) of pebbling moves.The pebble function gotten from the pebble function p after applying the moves in s is denoted by p s .The concatenation of the pebbling sequences r = (r 1 , . . ., r k ) and s = (s 1 , . . ., s l ) is denoted by rs = (r 1 , . . ., r k , s 1 , . . ., s l ).
A pebbling sequence (s 1 , . . ., s n ) is executable from the pebble distribution p if p (s1,...,si) is nonnegative for all i ∈ {1, . . ., n}.A vertex x of G is t-reachable from the pebble distribution p if there is an executable pebbling sequence s such that p s (x) ≥ t.We say x is reachable if it is 1-reachable.
We write π t (G ω , x) for the minimum number m such that x is t-reachable from every pebble distribution of size m.We use the notation π(G ω , x) for If ω(e) = 2 for all e ∈ E(G) then π(G ω ) = π(G) is the usual unweighted pebbling number.So we allow the weight function ω to be defined only on a subset of V (G) and use the default weight of 2 for edges where ω is undefined.
Changing the order of moves in an executable pebbling sequence s may result in a sequence r that is no longer executable.On the other hand the ordering of the moves has no effect on the resulting pebble function, that is, p s = p r .This motivates the following definition.
Given a multiset S of pebbling moves on the weighted graph (G ω ), the transition digraph T (G, S) is a directed multigraph whose vertex set is V (G), and each move (v u) in S is represented by a distinct directed edge (v, u).The transition digraph of a pebbling sequence s = (s 1 , . . ., s n ) is T (G, s) = T (G, S), where S = {s 1 , . . ., s n } is the multiset of moves in s.Let d − T (G,S) denote the in-degree and d + T (G,S) the out-degree in T (G, S).We simply write d − and d + if the transition digraph is clear from context.It is easy to see that the pebble function gotten from p after applying the moves in a multiset S of pebbling moves in any order satisfies for all v ∈ G.For unweighted graphs the formula simplifies to 3 Cycles in the transition digraph In this section we present a version of the No-Cycle Lemma [6,13,14].If the pebbling sequence s is executable from a pebble distribution p then we clearly must have p s ≥ 0. We say that a multiset S of pebbling moves is balanced with a pebble distribution p at vertex v if p S (v) ≥ 0. The multiset S is balanced with p if S is balanced with p at all v ∈ V (G), that is, p S ≥ 0. We say that a pebbling sequence s is balanced with p if the multiset of moves in s is balanced with p.The balance condition is necessary but not sufficient for a pebbling sequence to be executable.A multiset of pebbling moves or a pebbling sequence is called acyclic if the corresponding transition digraph has no directed cycles.
We can repeat this process until we eliminate all the cycles.We finish in finitely many steps since every step decreases the number of pebbling moves.Definition 3.2 Let S be a multiset of pebbling moves on G.An element (v u) ∈ S is called an initial move of S if v has indegree 0 in T (G, S).A pebbling sequence s is called regular if s i is an initial move of S \ {s 1 , . . ., s i−1 } for all i.
It is clear that if the multiset S is balanced with a pebble distribution p and s is an initial move of S then s is executable from p. Proposition 3.3 If S is an acyclic multiset then there is a regular sequence s of the elements of S. If S is also balanced with the pebble function p then s is executable from p.
Proof: If S is acyclic then we must have an initial move t of S. Then S \ {t} is still acyclic.So we can recursively find the elements of s = (s 1 , . . ., s k ) by picking an initial move t of S and then replacing S with S \ {t} at each step.Now assume that S is balanced with p. Then S i = S \ {s 1 , . . ., s i−1 } is balanced with p (s1,...,si−1) for all i since (p (s1,...,si−1) ) Si = p S ≥ 0. Hence the initial move s i of S i is executable from p (s1,...,si−1) , that is, p (s1,...,si) ≥ 0 for all i.
The following result is our main tool.Theorem 3.4 Let p be a pebble distribution on G ω and x ∈ V (G).The following are equivalent.
1. Vertex x is reachable from p.
2. There is a multiset S of pebbling moves with p S ≥ 0 and p S (x) ≥ 1.

3.
There is an acyclic multiset R of pebbling moves with p R ≥ 0 and p R (x) ≥ 1.
4. Vertex x is reachable from p through a regular pebbling sequence.
Proof: If x is reachable from p then there is a sequence s of pebbling moves such that s is executable from p and p s (x) ≥ 1.If S is the multiset of the moves of s then p S ≥ 0 and p S (x) ≥ 1 and so (1) implies (2).By Proposition 3.1, (2) implies (3) and by Proposition 3.3, (3) implies (4).It is clear that (4) implies (1).
It is convenient to write the condition p S ≥ 0 and p S (x) ≥ 1 compactly as p S ≥ 1 {x} using the indicator function of the singleton set {x}.

Cut vertices
The pebbling number of a graph with a cut vertex often can be calculated using a simpler graph.This simplification introduces new weights.The following theorem is the main reason we study weighted graphs.
To simplify notation, we used K ω instead of the more precise K ω|E(K) even though ω is defined on values outside of E(K).
Proof: The graphs are visualized in Figure 1.First we show that π(G ω , x) ≥ π( Gω , x) + b.Let p be a pebble distribution on G with p = π(G ω , x) − b.We create a new distribution q on G consisting of red and green pebbles.The red pebbles are placed on H exactly the same way as the pebbles in p are placed on H.The number of green pebbles is p(u) + b.The green pebbles are placed on K so that the number of pebbles that can be moved to v using only green pebbles is as small as possible.This minimum number is clearly ⌊ p(u)/a⌋.Note that q can place both red and green pebbles on v. Then q = π(G ω , x), so there is an acyclic multiset S of pebbling moves on G ω such that q S ≥ 1 {x} .Let S H and S K contain the moves of S inside H and K respectively so that S = S H ∪S K .
We are going to see that moving red pebbles from H to K \ {v} is not beneficial and so these moves can be eliminated.Since S is acyclic, any maximal walk in T (K, S K ) starting at v is actually a path.Let us remove the pebbling moves corresponding to such maximal walks from S K until we eliminate all walks from T (K, S K ) starting at v. The choice of these maximal walks is not unique and they can overlap, so we need to eliminate them one by one in an arbitrary order.The resulting multiset S ′ K ⊆ S K is balanced with q and q SK (v) ≤ q S ′ K (v).Executing S ′ K from q cannot move more than ⌊ p(u)/a⌋ pebbles to v since S ′

K
does not have any effect on the red pebbles.Let R be the multiset containing the elements of S H together with ⌊ p(u) /a⌋ copies of the move (u v).Then it is clear that p R (u) ≥ 0 and p R is not smaller than q S on H, hence p R ≥ 1 {x} .Thus x is reachable form p by Theorem 3.4.Now we show that π(G ω , x) ≤ π( Gω , x)+b.Let p be a pebble distribution on G with p = π( Gω , x)+b.Let c = p| V (K)\{v} be the number of pebbles in this distribution on V (K)\{v}.We create a new distribution q on G such that q and p are the same on V (H) and q(u) = max{0, c−b}.Then q ≥ π( Gω , x) so there is an acyclic multiset S of pebbling moves on Gω such that q S ≥ 1 {x} .There is a multiset R 1 of pebbling moves on K using only the pebbles on V (K) \ {v} such that p R1 (v) = p(v) + ⌊max{0, c − b}/a⌋.Let R be the multiset containing the elements of R 1 together with the elements of S different from (u v).Then p R is not smaller than q S on H and p R is nonnegative on V (K) \ {v}, hence p R ≥ 1 {x} .Thus x is reachable form p.

Note 4.2
The previous proposition is applicable in many situations since the function t → π t (G, x) is often linear; for example for trees, complete graphs and hypercubes.In particular it is linear for cycles [11] where Example 4.3 The simplest nonlinear example is the wheel graph W 5 with 5 vertices and 4 spikes.It is easy to see that if x is a degree 3 vertex then The behavior can be more complicated.If G is the complete graph with 7 vertices with one missing edge xy then one can verify that 5 Simplifications using leaves The maximum number of pebbles we can place on v i so that at most t i pebbles can be moved from since the maximum is taken when The reader can easily verify the following result.Proposition 5.2 Let x, v 1 and v 2 be the consecutive vertices of the graph G = P 3 with weight function ω.
The pebbling number of a tree can be found quickly using a maximum path decomposition [4].This method could be extended to weighted trees as well.Another approach that illustrates our simplification process is to use Propositions 4.1, 5.1 and 5.2 to simplify a weighted tree to a single edge.The process is shown in the next example.

Simplification using ears
In this section we use the existence of special paths in our graph to simplify the calculation of the pebbling number.A thread of a graph is a path whose vertices all have degree 2. Note that an ear has at least two edges.Also note that the goal vertex can be an end vertex of an ear.

Closed ears
If a closed ear has default weights then it can be replaced by a weighted edge using Proposition 4.1 and Note 4.2.The simplification is shown in Figure 3.If the closed ear has 2n vertices then π(G ω , x) = π( Gω , x).If the closed ear has

3
. The edge weight is a = 2 n in both cases.

Cut ears
Cut ears can be replaced by weighted edges as well.First we need the following result.Lemma 6.2 Let p be a maximum size pebble distribution from which the goal vertex x is not reachable.Then p has no pebbles on the inner vertices of a cut ear.
Figure 3: Substitution for a closed ear.The edge weight a is 2 where k is the number of vertices of the closed ear.where n is the number vertices of the path connecting v to u in G.
Proof: Suppose u is an inner vertex of the cut ear E and p(u) > 0. Let H and K be the connected components of G \ {u} such that x ∈ H.There is a unique vertex v ∈ K that is adjacent to u.The size of q = p (v u) −1 is larger than the size of p.We show that x is not reachable from q which is a contradiction.Suppose x is reachable from q, that is, there is an acyclic multiset S of pebbling moves with q S ≥ 1 {x} .If (v u) ∈ S then with R = S \ {(v u)} we have p R = q S ≥ 1 {x} which is not possible.So we can assume that (v u) ∈ S. Let R contain those moves of S that do not involve any edge in K. Then p R (u) ≥ q S (u) + 1, p R (w) = q S (w) for w ∈ V (H) and p R (w) = p(w) for w ∈ V (K).So p R ≥ 1 {x} which is again impossible.Proof: Without loss of generality we can assume that x is closer to v than to u as shown in Figure 4. Let u = v 0 , v 1 , . . ., v n+1 = v be the consecutive vertices of E.
First we show that π(G ω , x) ≤ π( Gω , x).For a contradiction, assume that π(G ω , x) > π( Gω , x).Let p be a maximum size pebble distribution on G from  which x is not reachable.By Lemma 6.2, p has no pebbles on the inner vertices of E so the restriction q = p| V ( G) is a pebble distribution on G with Hence there is a multiset S of pebbling moves on Gω such that q S ≥ 1 {x} .Let R be the multiset of pebbling moves containing the moves in S with each move of the form (u v) replaced by the moves (v 0 v 1 ), . . ., (v n v n+1 ).Then q R ≥ 1 {x} which is a contradiction.Now we show that π(G ω , x) ≥ π( Gω , x).Let p be a pebble distribution on G with size π(G ω , x).Let q be the extension of p to V (G) such that q is zero on the inner vertices of E. Then q = p = π(G ω , x) and so there is an acyclic multiset S of pebbling moves such that q S ≥ 1 {x} .We create a multiset R of pebbling moves on G as follows.We start with S. We then search for a directed path in T (G, S) connecting u to v and we remove all the moves corresponding to the arrows of this directed path.We do this until there are no more such directed paths.Then we add as many copies of (u v) as the number of directed paths removed.Finally we remove all moves involving inner vertices of E. It is easy to see that p R ≥ 1 {x} .An open ear cannot be replaced by a single edge but we can still take advantage of it using squishing as explained in Section 9.The path connecting v 3 to v 5 can be simplified in two steps using leaves but we simplified it in one step using a cut ear.

Examples
Note that in the second example the end vertices v 3 and v 6 of the open ear are adjacent.This possibility is important to keep in mind during the development of an algorithm to find open ears.

Barely sufficient pebble distributions
Let D(G) be the set of pebble distributions on the graph G.For p, q ∈ D(G) we write p ≤ q if p(v) ≤ q(v) for all v ∈ G.This gives a partial order on D(G).We write p < q if p ≤ q but p = q.It is clear that if a goal vertex is reachable from p and p ≤ q then the goal vertex is also reachable from q. Definition 7.1 Let x be a goal vertex of G ω .A pebble distribution p is sufficient for x if x is reachable from p.The set of sufficient distributions for x is denoted by S(G ω , x).A pebble distribution p ∈ S(G ω , x) is barely sufficient for x if x is not reachable from any pebble distribution q satisfying q < p.The set of barely sufficient distributions for x is denoted by B(G ω , x).The set of insufficient distributions for x is I(G ω , x) = D(G) \ S(G ω , x).We are going to use the notation S(x), B(x) and I(x) if G and ω are clear from the context.
We can partition B(x) into the disjoint union B 0 (x) ∪ • • • ∪B k (x) where B i (x) contains those distributions in B(x) from which x is reachable in i pebbling moves but x is not reachable in fewer than i moves.Note that the only element of B 0 (x) is the pebble distribution 1 {x} that contains a single pebble on x.The following result is the main reason for our interest in barely sufficient distributions.Proof: If x is reachable from a pebble distribution p then we can remove pebbles from p one by one if needed until we get a q ∈ B(G ω , x) that satisfies q ≤ p.
The other direction of the result is obviously true.
The following example shows how Proposition 7.3 can be used to find the insufficient distributions.
Our purpose now is to construct algorithms for finding B(G ω , x) and π(G ω , x).

Finding barely sufficient distributions
The following result shows how a superset of B(G ω , x) can be constructed using recursion starting at B 0 (G ω , x) = {1 {x} }.
Proposition 8.1 If p ∈ B i+1 (G ω , x) then p = q r −1 for some q ∈ B i (G ω , x) and pebbling move r.

1
. Vertex x is reachable from q in the i moves of the sequence (s 2 , . . ., s i+1 ).If x is reachable from q in j moves then it is reachable from p in j + 1 moves.So x cannot be reached from q in fewer than i moves, which means that q ∈ B i (G ω , x).
We do not have to use every pebbling move r during the construction of B i+1 (G ω , x) from B i (G ω , x), as shown in the next result that essentially is a simple case of the No-Cycle Lemma.
An important interpretation of this result is that every distribution in B(G ω , x) can be obtained as p T where p = 1 {x} and T is a multiset of inverse pebbling moves such that (v u) −1 and (u v) −1 are not in T together for any u and v. Keeping track of the directions of the inverse pebbling moves speeds up the calculation of finding B(G ω , x).It also helps to eliminate moves that cannot be initial moves.If we avoid moves that are not initial moves then we automatically avoid cycles in the transition digraph.
Given a graph G, let − → G be the directed graph whose vertex set is V (G) and whose arrow set contains two arrows (u, v) and (v, u) for every edge uv ∈ E(G).

Algorithm 8.3
The algorithm shown in Figure 9 finds the set of barely sufficient distributions.
The heart of the algorithm is Proposition 8.1.We apply inverse pebbling moves to transfer pebbles in barely sufficient distributions in hope of finding new barely sufficient distributions.We use triples of the form (p, E, W ) that satisfy the following conditions: The role of E is to keep track of the direction of the pebble flow so that we can avoid the back and forth transfer as explained in Proposition 8.2.The role of W is to avoid pebbling sequences that are not regular as explained in Theorem 3.4(4).Now we give the detailed explanation of the algorithm: • lines 1-2: We fill the queue Q of barely sufficient distribution candidates with B 0 (G ω , x).We set E = E( − → G ) since the pebbles can flow in any direction.We set W = ∅ since no vertex is ruled out as the starting vertex of an initial move.
• line 3: This loop takes an element (p, E, W ) of Q and applies a possible inverse pebbling move to create a new distribution q.If p ∈ B i (x) then q is a candidate for B i+1 (x).A successful candidate q is used to create an appropriate new triple (q, F, X).The new triple is then added at the end of Q.The loop goes through the elements of Q in order, starting from the beginning of the queue until it reaches the end of the growing queue.
The loop ends eventually since we know that there are only finitely many barely sufficient distributions.
• line 4: We find a vertex u that has at least one pebble.We plan to remove a pebble from this vertex and add two pebbles to an adjacent vertex v.
• line 5: We only want to apply (v u) −1 if (u v) −1 was not used before and if (v u) is an initial move.This restriction helps avoiding cycles in the transition digraph.
• line 6: We apply the inverse pebbling move (v u) −1 to create the new barely sufficient candidate q.
• line 7: According to Proposition 8.2, we do not want to apply (u v) −1 since we already used (v u) −1 .
• line 8: Any move of the form (u w) is not an initial move since we already have a move of the form (v u).
• line 9: The loop checks the newly created candidate against the other distributions in the queue.
• lines 10-11: We already put a smaller candidate in the queue so the new candidate cannot be barely sufficient.
• line 12: The new candidate q is already in the queue.It is likely that it was created using different inverse pebbling moves.We do not add this candidate to the queue twice.Still, we can update the information about this distribution in the queue by updating F and X.
• line 13: We can reduce the possible inverse pebbling moves using Proposition 8.2.A distribution is not barely sufficient if the goal vertex is reachable from this distribution using any pebbling sequence that is not acyclic.So we do not need to consider any inverse move that produces such a distribution.
• line 14: It is possible that a move is initial in one set of pebbling moves but not in another set.We only want to declare a move not initial if it is not initial in every possible set of pebbling moves that reaches the goal vertex.So we only keep a vertex v in X if (v u) is not a possible initial move in the new triple (q, F, X) either.
• lines 16-17: If the new candidate is smaller than a distribution q in the queue then q cannot be barely sufficient.Therefore we remove it from the queue.
• lines 18-19: The new candidate is added to the queue.
Example 8.4 Let x be the goal vertex and v 1 and v 2 be the other vertices of the complete graph G = K 3 and let ω(xv 2 ) = 5. Figure 10 shows how Algorithm 8.3 finds B(G ω , x) = {p (0) , p (11) , p (21) , p (31) }.Note that p (12) is added to the queue and only removed later when p (31) is found.This late recognition of the fact that p (12) is not barely sufficient is the reason why the algorithm needs to test p (22)  as a candidate.

Squished distributions
In this section we prove a version of the Squishing Lemma of [2] using open ears.A pebble distribution is squished on a thread P if all the pebbles on P are placed on a single vertex of P or on two adjacent vertices of P .A pebble distribution can be made squished on a thread as shown in the proof of the next result.
Lemma 9.1 (Squishing) If vertex x is not reachable from a pebble distribution p with size n, then there is a pebble distribution of size n that is squished on each unweighted open ear and from which x is still not reachable.
Proof: Let E be an unweighted open ear with consecutive vertices v 0 , . . ., v n .Suppose that the pebble distribution p is not squished on E. Let i be the smallest and j be the largest index for which p(v i ) > 0 and p(v j ) > 0. Note that we must have j − i ≥ 2. Define a new pebble distribution q by applying a squishing move that moves one pebble from v i to v k and another pebble from v j to v k for some k satisfying i < k < j.
Suppose x is reachable from q, that is, there is an acyclic multiset S of pebbling moves such that q S ≥ 1 {x} .Pick a maximal directed path of T (G, S) with consecutive vertices v k = w 0 , w 1 , . . ., w l all in the set {v i , v i+1 , . . ., v j }.Let D be the set of moves corresponding to the arrows of this directed path, that is, D = {(w 0 w 1 ), . . ., (w l−1 w l )} and let R = S \ D. We need to consider three cases depending on whether w l = v k , w l ∈ {v i , v j } or w l ∈ {v k , v i , v j }.It is easy to see that in all three cases we must have p R ≥ 1 {x} which is a contradiction.
Applying squishing moves repeatedly on E makes the pebble distribution squished on E. This procedure keeps the goal vertex x unreachable.A squishing move on E might remove a pebble from another open ear but it cannot add a pebble to it.So if the distribution is squished on an open ear then it remains squished after the application of a squishing move on E. So the desired pebble distribution can be reached by applying all the available squishing moves on all unweighted ears in any order.if q(v) ≥ 0 then //nonnegative number of pebbles on v? 27 Q.insert((q, i + 1)) //add improved candidate to the queue 28 π(G ω , x) := M + 1 Figure 11: Algorithm to find the distribution with the most pebbles that is insufficient for the goal vertex.
• lines 6-7: If p is squished then we insert (p, 1) in the ordered queue Q.This new queue contains candidates for insufficient distributions.The insert operation uses binary search to locate the right position.It only adds the new element to the queue at this position if it is not there already.
• line 9: We try to improve p by removing all pebbles at vertex v.
• line 10: Distribution q is going to be the hopefully improved version of p.
• line 11: We remove all the pebbles at vertex v.
• line 12: We insert the new candidate q into P .
• line 13: The variable M is initialized; it will equal the maximum size max{ p : p ∈ I s (G ω , x)} of an insufficient distribution.
• lines 14: We are finding M using Proposition 9.2 and Corollary 9.4.Queue Q contains pairs of the form (p, i).Such a p always satisfies q ≤ p if q is any one of the first i − 1 elements of B s (G ω , x).In each iteration we replace (p, i) ∈ Q by possibly several new elements in the queue of the form (q, i + 1).
• line 15: Take a candidate p from Q.We know that C • lines 16-17: Distribution p can be discarded if it has no more than M pebbles.We already have an insufficient distribution containing M pebbles so p only has a chance for improvement if it has more than M pebbles.
• line 18-19: The loop finds the first index i for which C[i] ≤ p or quits if no such i exists.
• line 20-21: If i > |C| then p is our best performing insufficient distribution so far.
• line 23: We need to remove some pebbles form p to enforce that C[i] ≤ p.We try to do this at each vertex.
• line 24-25: We build a new distribution q by decreasing the number of pebbles at vertex v just enough to have C[i] ≤ q.
• lines 26-27: If the new q is actually a distribution then we insert (q, i + 1) into Q.
• line 28: The pebbling number is calculated according to Corollary 9.4.
It is important to keep our queues sorted and to use binary search at the insert operations.Without this the algorithm becomes too slow to be practical.

Test results
We tested our algorithms by calculating the pebbling number of every connected graph with fewer than 10 vertices.We used Nauty [12] to generate these graphs and their automorphism groups.We simplified each graph as follows.For each goal vertex we replaced each closed ear and cut ear with a weighted edge as described in Subsections 6.1 and 6.2.Then we recursively used available leaves to simplify the graph as much as possible as described in Section 5. Then we ran Algorithms 8.3 and 10.1 to find the pebbling number of the simplified graph.
The automorphism group helped us reducing the number of goal vertices to representatives of orbits.It is well known that the hardest to reach goal vertex in a tree is a leaf, so in trees we only picked leaf vertices for the goal vertex.
The algorithms were coded in C++ using the Standard Template Library.The code was compiled with the gnu compiler.It took about a day on a 3 GHz Unix machine to finish the calculations.The calculation for graphs with fewer than 9 vertices took less than 10 minutes.Table 1 shows the frequency of the pebbling numbers.The result confirms the existence of gaps in the spectrum of pebbling numbers described in [3].We checked our results on many graphs with known pebbling numbers such as paths, complete graphs, cycles, some trees, the Lemke graph, and the Petersen graph.The pebbling numbers are available on the author's web page.

Proposition 3 . 1
If S is a multiset of pebbling moves on G ω then there is an acyclic multiset R ⊆ S such that p R ≥ p S for each pebble function p on G. Proof: Let p be a pebble function on G. Suppose that T (G, S) has a directed cycle C.Let Q be the multiset of pebbling moves corresponding to the arrows of C and R = S \ Q.Let u v be the first vertex from v along C. Then

Example 5 . 3
Figure 2  shows the stages of the simplification of a tree.First we let K be the subgraph of G generated by {v 3 , v 4 , v 5 }.Then π t (K, v 3 ) = 4t by Proposition 5.2 so we replace K by the weighted edge v 3 u 1 to get G (1) ω1 .Next we let K be the subgraph of G (1) ω1 generated by {v 1 , v 2 , u 1 }.Then π t (K, v 3 ) = 4t + 2 by Proposition 5.1 so we replace K by the weighted edge v 3 u 2 to get G (2) ω2 .Finally we use Proposition 5.2 again to get G (3) ω3 .

Definition 6 . 1
Let x be a goal vertex in G. Let v 1 , . . ., v n be the consecutive vertices of a maximal thread T not containing x.There are unique vertices v 0 and v n+1 outside of T that are adjacent to v 1 and v n respectively.The subgraph E induced by v 0 , . . ., v n+1 is called an ear.The vertices of T are called the inner vertices of E. If v 0 = v n+1 then E is called a closed ear.If the vertices of T are cut vertices then E is called a cut ear.If E is neither a closed ear nor a cut ear then it is called an open ear.

Figure 4 :
Figure 4: Substitution for a cut ear.The edge weight is ω(vu) = a = 2 n−1where n is the number vertices of the path connecting v to u in G.

Proposition 6 . 3
Let E be a cut ear of G ω with end vertices v and u.Let G be the graph created from G by removing the inner vertices of E and adding the edge vu.Define ω on E( G) byω(e) = a if e = vu ω(e) elsewhere a is the product of the weights of the edges of E. If the goal vertex x is not an inner vertex of E then π(G ω , x) = π( Gω , x).

Figure 5 :
Figure 5: A graph with an open ear.

Figure 6 :
Figure 6: Simplification of G with goal vertex v 0 such that π(G, v 0 ) = π( Gω , v 0 ) + 1 = 36.The two cut ears denoted by dashed edges are replaced by the weighted edges v 0 v 3 and v 5 v 3 in G.The closed ear denoted by double dotted edges is replaced by the weighted edge v 3 u.

Figure 5
Figure 5 depicts an open ear.An open ear cannot be replaced by a single edge but we can still take advantage of it using squishing as explained in Section 9.

Figures 6 and 7
Figures 6 and 7 show two examples of simplified graphs using ears.The graph G is the same in both examples but the ears are different because the goal vertices

Figure 7 :
Figure 7: Simplification of G with goal vertex v 6 such that π(G, v 6 ) = π( Gω , v 6 ) = 22.The two cut ears denoted by dashed edges are replaced by the weighted edges v 0 v 3 and v 5 v 3 in G.The open ear denoted by dotted edges remains in G.

Example 7 . 2
Figure 8  shows an example of B(G, x).

Figure 8 :
Figure 8: The barely sufficient pebble distributions for vertex x.The vertices denoted by bullets have no pebbles.
The set I s (G ω , x) of squished insufficient distributions is the set of those elements of I(G ω , x) that are squished on all open ears of G.The set B s (G ω , x) of squished barely sufficient distributions is the set of those elements of B(G ω , x) that are squished on all open ears of G. q := p //modify p 25 q(v) := C[i](v) − 1 //enforce C[i] ≤ q 26

Table 1 :
The frequency of pebbling numbers for graphs with less than 10 vertices.The data is grouped by the number |V (G)| of vertices in the graph.Each data row contains a possible pebbling number followed by the frequency of this pebbling number.