Deterministic approximation for the cover time of trees
aa r X i v : . [ c s . D S ] S e p Deterministic approximation for the cover time oftrees
Uriel Feige ∗ Ofer Zeitouni † November 20, 2018
Abstract
We present a deterministic algorithm that given a tree T with n ver-tices, a starting vertex v and a slackness parameter ǫ >
0, estimates withinan additive error of ǫ the cover and return time , namely, the expected timeit takes a simple random walk that starts at v to visit all vertices of T andreturn to v . The running time of our algorithm is polynomial in n/ǫ , andhence remains polynomial in n also for ǫ = 1 /n O (1) . We also show howthe algorithm can be extended to estimate the expected cover (withoutreturn) time on trees. Let G be a connected graph with vertices v , . . . v n . We consider simple randomwalks on G . Namely, the walk starts at some vertex of the graph, and at everytime step picks at random with uniform probability a neighbor of the currentvertex and moves to it. Let C +1 ( G ) (the expected cover and return time ) denotethe expected number of steps it takes a random walk that starts at v to visitall vertices of G and return to v . An empirical estimate for the value of C +1 ( G )can be obtained by starting a random walk at v and counting the numberof steps until it visits all vertices of G and returns to v . Averaging multiplesuch estimates one obtains with high probability an accurate approximation for C +1 ( G ). An approximation within a multiplicative error of 1 ± ǫ with probability1 − δ can be obtained in time polynomial in n , 1 /ǫ , and 1 /δ . This follows fromthe fact that for every graph C +1 ( G ) < n (see [3, 4, 7]). The question ofwhether there is a deterministic algorithm that approximates C +1 ( G ) within amultiplicative error of 1 ± ǫ in time polynomial in n and 1 /ǫ is open (see forexample Chapter 8 in [2]). Here we provide a positive answer to this questionin the special case that the underlying graph is a tree. ∗ Department of Computer Science and Applied Mathematics, Weizmann Institute, Rehovot76100, Israel. [email protected] . † Department of Mathematics, Weizmann Institute, Rehovot 76100, Israel, and School ofMathematics, University of Minnesota. [email protected] . .1 Related work A survey of random walks in graphs is provided by Lovasz [12]. A related bookin preparation by Aldous and Fill [2] is also available on the web. There arealso additional books that contain much information on random walks in graphs,such as the recent book by Levin, Peres and Wilmer [11]. More information andappropriate references for some of the well known claims that we make belowcan be found in these references.A random walk on a graph is a special case of a Markov chain, with thevertices of the graph serving as the states of the Markov chain, and the edgesproviding an implicit representation for the transition probabilities. Some pa-rameters of interest for random walks are the expected hitting time (expectednumber of steps it takes to get from one given vertex to another given vertex),the expected commute time (expected number of steps to make a round-trip be-tween two given vertices) and the expected cover time (the expected number ofsteps that it takes to visit all vertices). By convention, throughout this paper,we omit the qualifier expected when we deal with expectations of random times,and write hitting time for the expected hitting time, etc. When dealing with theactual random variables instead of their expectations, we use the term randomhitting time , etc.The main result described in this manuscript refers to the cover and returntime , which requires walks to return to the starting vertex after covering thegraph. The hitting time and the commute time can be computed in polynomialtime (by solving a system of linear equations). In particular, let us note herethat the commute time between any two adjacent vertices in a tree with n vertices is exactly 2( n − n . Hence thehitting time (which is computable in deterministic polynomial time) providesa ln n approximation to the cover time. An extension of this approach leadsto an algorithm with a better approximation ratio of O ((log log n ) ) [10]. Anapproach of upper bounding the cover time based on spanning trees is presented2n [4]. In particular, when it is applied to trees it implies that the cover andreturn time is at most 2( n − (which is attained for a path with n vertices),and for general graphs it gives an upper bound of n (which can be improvedto essentially 4 n /
27 with more careful analysis [7]). For some graphs, thisapproach based on spanning trees gives a very good approximation of the covertime.When one seeks to estimate the cover time from a given vertex (rather thanfrom the worst possible vertex), the known bounds deteriorate. The determin-istic algorithms known [9, 5] pay an extra O (log n ) factor in the approximationratio compared to the approximation ratios known from worst possible vertex.For the special case of trees, some upper bounds are presented in [8].There are some special families of graphs for which the cover time is knownexactly (e.g., for paths, cycles and complete graphs), or almost exactly (e.g., forbalanced trees [1] and for two and higher dimensional grids [6, 2]). Our main theorem is the following.
Theorem 1.1
There is a deterministic algorithm that given as input a tree T on n vertices, a starting vertex v and a slackness parameter ǫ > , outputs avalue A ( T, v, ǫ ) that approximates the cover and return time C + v ( T ) within afactor of ± ǫ . Namely, (1 − ǫ ) A ( T, v, ǫ ) ≤ C + v ( T ) ≤ (1 + ǫ ) A ( T, v, ǫ ) . The running time of the algorithm is polynomial in n/ǫ (hence of the form O ( n a /ǫ b ) for some fixed constants a > and b > ). Our proof is constructive in the sense that we actually describe the algorithm.We remark (see Section 3.1) that the algorithm extends almost without changeto estimating the cover and return time of arbitrary Markov chains on trees,though the running time in this case is polynomial in the cover and return timeitself rather than in the number of states. (This distinction was not necessaryfor simple random walks on trees because there the cover time is bounded by apolynomial in the number of vertices.) The algorithm also extends to the casewhen we are given a set S of vertices in the tree, and are required to estimatethe expected time by which a random walk on T covers the vertices of S andreturns to v . See Section 3.2.The additive error in the approximation provided by Theorem 1.1 is at most ǫC + v ( T ). As C + v ( T ) < n for every n -vertex tree, see Section 1.1, it followsthat the additive error is at most ǫ/ n . The running time of the algorithmremains polynomial in n even if ǫ < / n , and hence Theorem 1.1 also providesapproximations of the cover and return time with arbitrarily small additiveerror.The proof of Theorem 1.1 as appears in Section 2 applies to the cover andreturn time but not to the cover time. It is possible to use the cover and return3ime in conjunction with the hitting times from leaves of T to v in order to obtainaccurate estimates on the cover time. Further, the algorithm in Theorem 1.1and its proof can be adapted to handle also the cover time. Hence a statementsimilar to that of Theorem 1.1 (see Theorem 3.4) applies also to the cover time.We sketch the proof in Section 3.3. Many computational problems that are difficult to solve on graphs are easy(polynomial time solvable) on trees. The algorithmic paradigm that is often usedin these cases is dynamic programming. We shall also use dynamic programmingso as to approximate the cover time on trees. The difficulty is that the covertime per se is not a quantity that lends itself well to aggregation of information.For example, consider a tree T with root vertex r connected to two vertices r and r , which are root vertices of subtrees T and T . Even if one is giventhe complete distribution function for the cover and return time of the subtrees T and T , it is not immediately clear (to the authors) how to combine thisinformation so as to obtain C + r ( T ). To overcome this difficulty, we extend anapproach that was used by Aldous [1] for evaluating the cover time of balancedtrees.Let T be an arbitrary tree with vertices v , . . . v n on which we wish to esti-mate C +1 ( T ). For the sake of uniformity of the notation, we shall introduce anew root vertex r to the tree connected only to v , thus obtaining a new treethat we shall call T r . The tree T r has n + 1 vertices and n edges. For thesake of establishing notation, orient all edges away from the root, and for every1 ≤ i ≤ n , let e i be the unique edge whose endpoint is v i . As a convention,we say that e i is traversed whenever the walk enters v i through e i (but notwhen the walk exits v i through e i ). Let T i be the subtree rooted at v i (hence T = T ). Now we define the key quantity on which we shall employ dynamicprogramming. Definition 2.1
Using the notation introduced above, for ≤ i ≤ n and for t ≥ , let P i ( t ) denote the probability that a walk on T r that starts at v i visitsall vertices of T i before edge e i is traversed t times. As a simple example, if v i is a leaf of T , then P i ( t ) = 1 for every t . Thiswill serve as the base case that will start off our dynamic programming. Ourgoal will be to compute P ( t ) for all t . Using these values, we may consider E (1) = P t (1 − P ( t )) which is equal to the expected number of times that e istraversed in a walk on T r that starts at v and covers T . (Technically, E (1) isan infinite sum. However, the sum converges since necessarily E (1) < C +1 ( T r ),and C +1 ( T r ) ≤ n .)The following lemma shows the connection between the value of E (1) andthe desired C +1 ( T ). Lemma 2.2
With notation as above, C +1 ( T ) = 2( n − E (1) . roof: Let C [ v , r ] denote the commute time between v and r in T r (theexpected number of steps it takes a walk that starts at v to visit r and returnto v ). As mentioned in Section 1.1, C [ v , r ] = 2 n . Observe that due to Wald’slemma, C +1 ( T ) = E (1) C [ v , r ]. (An intuitive way to see the latter equalityis by considering an extremely long random walk on T r that starts at v , andcovers T many times. Break the walk into segments that correspond to thewalk covering T and returning to v . During the first ℓ such segments, with ℓ large, the ergodic theorem implies that the number of commutes to r is closeto E (1) ℓ . Taking ℓ → ∞ then yields the identity.) Moreover, observe thatone can relate the cover time of T in T r to that in T by subtracting the stepsalong the edge e (in both directions). Linearity of expectation then impliesthat C +1 ( T ) = C +1 ( T ) − E (1). Putting everything together we deduce that C +1 ( T ) = 2( n − E (1). ✷ As noted above, to compute E (1) from P ( t ) involves an infinite sum. Toobtain a finite algorithm, we shall truncate the sum when t exceeds a sufficientlylarge value N . To keep the presentation simple, we shall not attempt to optimizethe value of N here (not for trees in general and not for any tree specifically),but just note that N can be chosen to be O ( n log 1 /ǫ ), because it is not hardto show that for some universal constant c > P ( t ) ≥ − e − ct/n . (1)Indeed, since C +1 ( T r ) ≤ n , the probability to cover T r within the first 4 n traverses of the edge ( r, v ) is at least 1 /
2, which implies the estimate on P ( t ).More generally, taking N as O ( n log( n + ǫ )) we will be able for every vertex v i to consider the values of P i ( t ) only for t up to N , while still eventually achievinga (1 ± ǫ ) multiplicative approximation for C +1 ( T ).We now proceed to describe an exact dynamic programming procedure in anidealized world in which computations can be done with arbitrary precision andsummations may include infinitely many summands (though all sums do con-verge). Later we shall discuss how the dynamic programming can be carried outin polynomial time with only a small loss in the accuracy of the computations.For every vertex v i we shall compute the infinite vector P i = { P i ( t ) } forall values of t . (Needless to say, in our actual algorithm we shall truncate thisvector an t = N .) As noted, for every v i that is a leaf of T r , this is the all 1vector. For every other vertex v i , let D i denote the set of direct descendants of v i (those vertices connected to v i by edges other than e i ). Given that T r is atree, it will always be the case that if we have not yet computed P , then thereis some vertex v i for which P i has not yet been computed but the vectors P j were already computed for all v j ∈ D i . Hence we will compute P i for such avertex v i and make progress. The computation will involve quantities that shallbe defined next.Fix a vertex v i of interest. To simplify notation, let d = | D i | be the numberof direct descendants of v i . Rename them as u , . . . , u d . Definition 2.3
For vertex v i , t ≥ , t ≥ , . . . , t d ≥ , define Q i ( t , . . . , t d ; t ) to be the probability that in a walk on T r that starts at v i , each edge ( v i , u j ) is raversed exactly t j times (in the direction into u j ) before the edge e i is traversed t times. Observe (though we shall not need to use this fact) that for two vertices v i and v j with the same number of descendants, the functions Q i and Q j areidentical.We now have a recursive formula for P i ( t ) in terms of the vectors P j for thedescendants v j ∈ D i . (So as to keep notation simple, we use in this formula theconvention that P i refers to v i , but P j refers to u j rather than v j .) P i ( t ) = X t ≥ ,...,t d ≥ Q i ( t , . . . , t d ; t ) d Y j =1 P j ( t j ) (2)Let us explain Equation (2). We wish to compute the probability that T i is covered before e i is traversed t times. In order to cover T i , each vertex of u j ∈ D i must be visited at least once, and the subtree T j rooted at u j needs tobe covered. Once we fix the stopping condition of the edge e i being traversed t times, the distribution of the number of visits (from their parents) to thedescendants u j ∈ D i is given by the function Q i . Subtree T j needs to becovered by the time the edge ( v i , u j ) is traversed t j times, one of which is thefirst entry to u j , and hence the term P j ( t j ) gives the probability of T j beingcovered. We can take the product of the terms P j ( t j ), because the walks withindifferent subtrees are independent.Using Equation 2 and the fact that the vectors P i are known for all leaves, weget an inductive definition for P , and then Lemma 2.2 can be used to compute C +1 ( T ). However, there are several obstacles to obtaining a polynomial timealgorithm. We list these obstacles, and then explain how to overcome them,paying only a multiplicative factor of (1 ± ǫ ) in the accuracy of the computation.1. Range of summation.
Each variable t j ranges over infinitely manyvalues. As explained earlier, this will be handled by limiting the rangebetween 1 and N for sufficiently large N .2. Combinatorial explosion.
Even if the range of the summation of eachvariable is limited to N , the number of terms in the summation is N d .Since d need not be bounded by a constant (the tree may have verticesof arbitrarily large degrees), this number will not be polynomial in n . Weshall refine the dynamic programming approach so as to overcome thisobstacle.3. Finite precision.
Computation cannot be performed with infinite preci-sion. We shall either need to show that the numbers involved can alwaysbe represented using polynomially many bits, or round some of the num-bers and account for the error introduced by the rounding.It would be more convenient for us to first deal with the second obstacle,and only later with the other obstacles.6 .1 Avoiding the combinatorial explosion
For every vertex v i , if | D i | >
2, construct an arbitrary binary tree B i (eachinternal node has two children) with d = | D i | leaves, placing v i at the rootand u , . . . , u d at the leaves. There are d − b i , . . . , b id − . For simplicity of notation, let us fixthe structure of the tree to be a path v i , b i , . . . b id , with u connected to v i , u d connected to b id − , and u j for 1 < j < d connected to b ij − .The random walk on T r can be simulated as follows. Whenever the walkon T r reaches v i , with probability 1 / ( d + 1) it takes the edge e i , and withprobability d/ ( d + 1) it goes to one of the children, chosen uniformly at random.This random choice of child is simulated by a walk on the tree B i . Conditionedon having decided not to take the edge e i , at every internal node of the tree B i (including the root), choose one of the two children with probability proportionalto the number of leaves of B i that are descendants of the child. For example,at internal node b ik with k < d −
2, go to leaf v k +1 with probability 1 / ( d − k )and to internal node b ik +1 with probability ( d − k − / ( d − k ). It can readily beseen that each leaf is reached with the same probability. Being at a leaf u j in T r and deciding to take the edge ( u j , v i ) is simulated in T B by taking the path u j to v i in the tree B i .For the simulated random walk, every vertex has only two children. Thisis the key to avoiding the combinatorial explosion. Observe that building suchtrees B i for all vertices v i , we change T r into a tree T B which is a subtree ofthe binary tree. Every leaf of T B is a leaf of T r , and so it follows that the totalnumber of vertices in T B is at most 2 n .The tree T B is still rooted at r like T r , and r has degree 1 also in T B . Exceptfor r , T B has two types of vertices: those which were original vertices of T (andwere denoted by v i ), and those that were added by the subtrees B i (and weredenoted by b ik ). For uniformity of notation, we use w i to denote vertices of T B ,regardless of the origin of the vertex. However, we associate with each vertex w i a weight W i . The weight of each of the original vertices of T r is 1. The weightof a vertex b ik of B i is always greater than 1, and equal to the number of leavesof B i in the subtree of B i rooted at b ik . (With the notation that we used above,it turns out that this weight is equal to d − k .) As in the case of T r , we now use T i to denote the subtree of T B rooted at w i .Recall that a walk on a graph is a sequence of vertices (that respects theadjacency structure of the graph). We now define a (random) walk { S n } on T B ,as follows.1. At r , move to its unique neighbor w .2. Let the walk be at a vertex w i with W i = 1 (hence, an original vertex of T ). Let w p be its parent node.(a) If w i is a leaf, move to its parent vertex w p .(b) If w i has only one child, move to this child with probability 1 / w p with probability 1 /
2. 7c) Otherwise, w i must have exactly two children, one of them (say w l )of weight 1 and the other (say w r ) of weight W r ≥
1. Move to w p with probability 1 / (2 + W r ), to w l with probability 1 / (2 + W r ), andto w r with probability W r / (2 + W r ).3. Let the walk be at a vertex w i with W i > B ). Let w p be its parent node, and w l and w r be its two children. At least one of these children is an originalvertex of T r , hence we assume without loss of generality that W l = 1.(a) If w i was last entered from one of its children, move to w p .(b) If w i was last entered from w p , move to w l with probability 1 / (1+ W r )and to w r with probability W r / (1 + W r ).Note that the random walk thus defined is not Markovian, while the process { ( S n − , S n ) } n ≥ is Markovian.So far, we have defined two random walk processes, one on T r and one on T B . For a walk on T B , we now define the projection of the walk to be thesubsequence of vertices that includes only the original vertices of T r (removingthe vertices introduced by the subtrees B from the sequence). Random walkson T B simulate random walks on T r in the sense that the projection of a randomwalk on T B is precisely a random walk on T r .Definition 2.1 applies with minor changes to walks on T B . We present therevised definition. Definition 2.4
For vertex w i in T B , with parent vertex denoted by w p , and for t ≥ , define P i ( t ) to be the probability of the following event:1. If W i = 1 , the event is that a walk on T B that starts at w i visits all verticesof T i before traversing the edge ( w p , w i ) t times.2. If W i > , the event is that a walk on T B that just entered w i from w p visitsall vertices of T i before traversing the edge ( w p , w i ) t additional times. Likewise, Definition 2.3 needs to be modified so as to account for the exis-tence of different types of vertices in T B . Definition 2.5
For vertex w i = r in T B , let w p denote its parent vertex and let w l and w r denote its two children (or only w l if w i has one child). For t ≥ , t l ≥ , t r ≥ , define Q i ( t l , t r ; t ) (or Q i ( t l ; t ) if w i has only one child) to be theprobability of the following event:1. If W i = 1 , then the event is that in a walk on T B that starts at w i , edge ( w i , w l ) is traversed exactly t l times and edge ( w i , w r ) is traversed exactly t r times before the edge ( w p , w i ) is traversed t times. (If w i has only onechild, then remove the condition on t r .) . If W i > , then the event is that in a walk on T B that just entered w i from w p , edge ( w i , w l ) is traversed exactly t l times and edge ( w i , w r ) istraversed exactly t r times before the edge ( w p , w i ) is traversed t additionaltimes. Armed with the new definitions for P i and Q i , Equation (2) when appliedto T B simplifies to: P i ( t ) = X t ≥ ,t ≥ Q i ( t , t d ; t ) P ( t ) · P ( t ) (3)Inductively applying Equation (3) in T B we obtain the vector P in T B ,which is equal to the vector P in T r . For some sufficiently large value of N (to be determined later), we shall truncateall vectors P i after N entries, implicitly assuming that P i ( t ) = 1 for all i ≥ N .Hence we shall set P i ( N ) = 1, regardless of its true value or computed value.For vertices w i that are not leaves, this certainly introduces an error. Moreover,this error propagates and amplifies through our use of Equation (3).We shall modify Definition 2.5 to reflect the fact that we no longer distinguishbetween different values of t j that are larger than N . Definition 2.6
For vertex w i = r in T B , let w p denote its parent vertex andlet w l and w r denote its two children (or only w l if w i has one child). For ≤ t ≤ N , ≤ t l ≤ N , ≤ t r ≤ N , define Q i ( t l , t r ; t ) (or Q i ( t l ; t ) if w i hasonly one child) to be the probability of the following event:1. If W i = 1 , then the event is that in a walk on T B that starts at w i , edge ( w i , w l ) is traversed exactly t l times (and at least t l times in the specialcase that t l = N ) and edge ( w i , w r ) is traversed exactly t r times (and atleast t r times in the special case that t r = N ) before the edge ( w p , w i ) istraversed t times. (If w i has only one child, then remove the condition on t r .)2. If W i > , then the event is that in a walk on T B that just entered w i from w p , edge ( w i , w l ) is traversed exactly t l times (and at least t l timesin the special case that t l = N ) and edge ( w i , w r ) is traversed exactly t r times (and at least t r times in the special case that t r = N ) before the edge ( w p , w i ) is traversed t additional times. We can now modify our recursive formula to have only finitely many terms.It no longer computes the true value of P i ( t ), so we shall call the quantity thatit computes P i ( t ). The function Q to be used in this formula is the one fromDefinition 2.6. P i ( N ) is not computed by this formula, but instead set to 1. P i ( t ) = X ≤ t l ≤ N, ≤ t r ≤ N Q i ( t l , t r ; t ) P l ( t l ) P r ( t r ) (4)9his completes the description of how we limit the range of summation tobe finite. We now analyze the effect of this approximation. For a given choiceof N , let δ > i , (1 + δ ) P i ( N ) ≥
1. For concreteness,take δ = 2(1 − P i ( N )) ≤ e − cN/n , (5)see (1). We shall express the relative error in the approximation as a functionof N and δ , and thereafter choose N such that together with the implied δ , therelative error is smaller than ǫ .At the leaves of T B there is no error in the respective vector P i . At a vertex w i whose two children (or single child, if w i has only one child) are leaves, amultiplicative error of at most (1 + δ ) is introduced because P i ( N ) is roundedto 1, even though its true value may have been 1 / (1 + δ ). Consider now someother arbitrary vertex w i , let w l and w r be its children, and let (1 + δ l ) and(1 + δ r ) be upper bounds on the multiplicative errors in any of the entries ofthe vectors P l and P r . Then by inspection of Equation (4), the multiplicativeerror in any entry of P i is at most (1 + δ l )(1 + δ r ). Since T B has at most 2 n vertices, it follows that the multiplicative error at entries of P (compared tothe true entries of P ) is at most (1 + δ ) n .Recall that we needed the vector P so as to compute the expectation E (1) = P t ≥ (1 − P ( t )). Instead we now compute at approximation E (1) = P ≤ t ≤ N (1 − P ( t )). Hence our total error in this computation is: E (1) − E (1) = X ≤ t ≤ N ( P ( t ) − P ( t )) + X t>N (1 − P ( t ))The first of these summations is at most N ((1 + δ ) n − δ ≪ n thenthis value is approximated well by 2 nN δ . In the second of these summations,each term is of value at most δ . Moreover, for every t , (1 − P ( t + N )) ≤ δ (1 − P ( t )). Hence if δ < / N δ . Hence the total additive error is at most2( n + 1) N δ , and we wish it to be smaller than ǫE (1). It is not hard to showthat in every tree E (1) ≥ E (1) is essentially the covertime divided by 2 n , and the cover time of a graph is Ω( n log n )), and hence weshall simplify the desired inequality to nN δ ≤ ǫ . This requires choosing N suchthat δ ≤ ǫnN . With the choice of δ in (5), a value of N = cn log( n + ǫ ) for asufficiently large constant c would suffice for all trees.We remark that in this paper we just give a sufficient value of N . Muchlower values of N will also work for special families of trees (essentially, a factorof n can be replaced by their cover time divided by n ), and moreover, we neednot use the same value of N for all vertices of T B (in particular, for the leaveswe may take N = 1). These kind of optimizations are omitted from this paper. Having established the value of N for which P is a sufficiently close approxima-tion for P , it remains to verify that P can indeed be computed in polynomial10ime. For this, we need to be able to compute the values Q i ( t l , t r ; t ). Let usfirst observe that the role of vertex w i in the value of this expression is onlyin determining the weight of w r (the weight of w l is always 1). Definition 2.6offers several cases for the definition of Q i , and we shall address only some ofthem here. The other cases are handled similarly.Let us compute Q i ( t l , t r ; t ) when W i = 1, t l = N and t r = N . Wheneverthe walk is at w i , it has probability p p = 1 / (2 + W r ) to go to w p , probability p l = 1 / (2 + W r ) to go to w l , and probability p r = W r / (2 + W r ) to go to w r .The probability of exactly t l visits to w l and exactly t r visits to w r prior to t visits to w p is exactly (cid:18) t + t l + t r − t l (cid:19)(cid:18) t + t r − t r (cid:19) ( p p ) t ( p l ) t l ( p r ) t r . The upper bound of N implies that both the numerator of this expression andthe denominator are numbers that can be expressed by O ( N (log N + log n ))bits.If t r = N then Q i ( t l , N ; t ) will be computed differently. First, ignoringmoves into w r (as if w i has only one child), compute Q i ( t l ; t ). Then subtract P ≤ t r ≤ N − Q i ( t l , t r ; t ) to get the desired result. Observe that for the finalanswer one can use a common denominator ( N !) (2 + W r ) N , and hence stillexpressible in a polynomial number of bits.A similar argument applies to the computation of Q i ( t l , t r ; t ) when W i > t l = N and t r = N . In this case, the probability of exactly t l visits to w l andexactly t r visits to w r prior to t additional visits to w p vanishes unless t = t l + t r ,in which case it equals (cid:18) tt l (cid:19) W t r r (1 + W r ) t , where W r is the weight of the right descendent of W i .Following the computation in Equation (4), and thereafter applying it to allvertices of T B , one sees that one can obtain a rational number with denomi-nator ( N ! n !) O ( n ) , and likewise with a numerator expressible by polynomiallymany bits. Hence in principle, all computations can be performed exactly inpolynomial time, though they would be very tedious.A more practical approach is to round the numbers to numbers of shorterrepresentations. Clearly, this can be done while maintaining the relative errorin the range (1 ± ǫ ), but we omit concrete suggestions of how to do this. We present in this section several extensions of Theorem 1.1.
Consider a Markov chain { S t } with state space the vertices of a (finite) tree T ,where transitions are allowed only between neighbors. Because of the tree struc-11ure, the Markov chain is reversible, and hence there exist conductances C { u,v } (with u, v neighboring vertices in the tree) such that the transition probabilityfrom u to v equals C { u,v } / P w : w ∼ u C { u,w } . Let R { u,v } = 1 / C { u,v } denote therespective resistance between neighboring vertices in the tree, and assume firstthat all resistances are integer valued. Consider the tree T ′ in which each edge { u, v } is replaced by a chain of length R { u,v } , and a simple random walk { RW t } on T ′ . Thus, each vertex of T corresponds to a vertex of T ′ . Further, the randomwalk { RW t } induces a Markov process on T , and the transition probabilities ofthe latter coincide with those of { S t } . In particular, the quantity E (1) corre-sponding to T is identical to that corresponding to T ′ , and can be computedaccurately by Theorem 1.1. For the tree T , we have C [ v , r ] = 2 P R { u,v } , and C +1 ( T ) = ( C [ v , r ] − E (1) by an adaptation of Lemma 2.2. We conclude fromthese facts that the cover and return time can be computed by the algorithmof Theorem 1.1, with the running time polynomial in the cover and return timeitself rather than in the number of states. It is straightforward to approximatethe above in case the resistances are not integer-valued. Let T ′ be a subtree of T , rooted at v . The algorithm of Theorem 1.1 appliesequally well to the evaluation of the cover and return time of T ′ by a randomwalk on T , denoted C +1 ( T ′ ; T ), as follows. The quantity E (1) for T ′ , denoted E T ′ (1), can be computed by the algorithm (applied to T ′ ). We then have (again,by an adaptation of Lemma 2.2) that C +1 ( T ′ ; T ) = 2( n − E T ′ (1). Fix a tree T and a starting vertex v . Given a vertex u , let P last [ u ] denote theprobability that for a random walk on T that starts at v , the last vertex to bevisited is u . Clearly, P last [ u ] = 0 iff u is a leaf of T (different than v ). Let H [ u, v ] denote the expected hitting time in T from u to v . Then the cover timesatisfies: C v ( T ) = C + v ( T ) − X u P last [ u ] H [ u, v ]Recall that for every vertex u , H [ u, v ] can be computed exactly in polynomialtime (moreover, the known algorithms compute H [ u, v ] for all u simultaneously,though this fact is not needed here), and that C + v ( T ) can be computed witharbitrary small additive error. It follows that it suffices to estimate the quantities P last [ u ] with sufficiently high precision in order to obtain an accurate estimateof the cover (without return) time.The latter task can be performed in a way similar to that described inTheorem 1.1. We sketch the steps, assuming a reduction to a binary tree T B has already been performed as in Section 2.We begin with a definition. 12 efinition 3.1 For a vertex v i with u ∈ T i and for t ≥ , let A i ( t ) denote theprobability that a walk on T B that starts at v i satisfies the following conditions. • It does not visit u before edge e i is traversed t − times. • It does visit u by the time edge e i is traversed t times. • u is the last vertex from T i to be visited. Clearly, P last [ u ] = P t A v ( t ), where v is the starting vertex of the walk and u ∈ T v .The following definition is similar to Definition 2.1. It will be used later insituations where u T i . Definition 3.2
For a vertex v i and for t ≥ , let P i ( t ) denote the probabilitythat a walk on T B that starts at v i visits all vertices of T i before edge e i istraversed t times. Note that we have already seen in Section 2 how all P i ( t ) can be computed.We now explain how this can be used in order to compute all A i ( t ). Definition 3.3
For a vertex v i with two children ( v l and v r ), with u ∈ T v l , t ≥ , t l ≥ , t r ≥ , let R i ( t l , t r ; t ) denote the probability that a walk on T B that starts at v i satisfies the following conditions. • By the time edge e i is traversed t − times, the edge e l is traversed atmost t l − times. • By the time edge e i is traversed t times, the edge e l is traversed at least t l times. • By the time edge e l is traversed t l times, the edge e r is traversed exactly t r times. The function R i ( t l , t r ; t ) can be computed efficiently in a way similar tothat described in Section 2.3. The details are tedious and are omitted. Now,with u as in Definition 3.3, A i ( t ) can be computed using the following recursiveformula: A i ( t ) = X t l ≥ ,t r ≥ R i ( t l , t r ; t ) A l ( t l ) P r ( t r )The truncation of the sum to a finite sum can performed as in Section 2.2,with a similar computational cost.The outline above (together with additional technical details which are omit-ted) implies the following theorem. Theorem 3.4
There is a deterministic algorithm that given a tree T on n ver-tices, a starting vertex v and a slackness parameter ǫ > , outputs a value A ( T, v, ǫ ) that approximates the cover time C v ( T ) within a factor of ± ǫ .Namely, (1 − ǫ ) A ( T, v, ǫ ) ≤ C v ( T ) ≤ (1 + ǫ ) A ( T, v, ǫ ) . The running time of the algorithm is polynomial in n/ǫ . cknowledgements The work of the authors is supported in part by The Israel Science Foundation(grants No. 873/08 and 938/07, respectively).
References [1] David Aldous.
Random walk covering of some special trees.
J. Math. Anal.Appl. , no. 1, 271–283 (1991).[2] David Aldous and Jim Fill.
Reversible Markov Chainsand Random Walks on Graphs.
Book in preparation. .[3] Romas Aleliunas, Richard M. Karp, Richard J. Lipton, Laszlo Lovasz,Charles Rackoff.
Random Walks, Universal Traversal Sequences, and theComplexity of Maze Problems.
FOCS 1979: 218–223.[4] Ashok Chandra, Prabhakar Raghavan, Walter Ruzzo, Roman Smolensky,Prasoon Tiwari.
The Electrical Resistance of a Graph Captures its Com-mute and Cover Times.
Computational Complexity 6(4): 312–340 (1997).[5] Eden Chlamtac, Uriel Feige.
Improved approximation of the minimum covertime.
Theor. Comput. Sci. 341(1-3): 22-38 (2005).[6] Amir Dembo, Yuval Peres, Jay Rosen, Ofer Zeitouni.
Cover times for Brow-nian motion and random walks in two dimensions.
Ann. Math., 160 (2004),pp. 433–464.[7] Uriel Feige.
A Tight Upper Bound on the Cover Time for Random Walkson Graphs.
Random Struct. Algorithms 6(1): 51–54 (1995).[8] Uriel Feige.
Collecting Coupons on Trees, and the Analysis of RandomWalks.
Computational Complexity 6 (1996/1997), 341–356.[9] Uriel Feige, Yuri Rabinovich.
Deterministic approximation of the covertime.
Random Struct. Algorithms 23(1): 1–22 (2003).[10] Jeff Kahn, Jeong Han Kim, Laszlo Lovasz, Van H. Vu.
The Cover Time,the Blanket Time, and the Matthews Bound.
FOCS 2000: 467–475.[11] David Levin, Yuval Peres, Elizabeth Wilmer.
Markov Chains and MiximgTimes.
American Mathematical Society, 2009.[12] Lazslo Lovasz.
Random Walks on Graphs: A Survey.
In: Combinatorics,Paul Erdos is Eighty, Vol. 2 (ed. D. Miklos, V. T. Sos, T. Szonyi), JanosBolyai Mathematical Society, Budapest, 1996, 353–398. Also available at .[13] Peter Matthews.
Covering problems for Markov chains.
Annals of Proba-bility16