Generating Random Spanning Trees Sourav Chatterji Sumit Gulwani EECS Department University of...

24
Generating Random Spanning Trees Sourav Chatterji Sumit Gulwani EECS Department University of California, Berkeley

Transcript of Generating Random Spanning Trees Sourav Chatterji Sumit Gulwani EECS Department University of...

Page 1: Generating Random Spanning Trees Sourav Chatterji Sumit Gulwani EECS Department University of California, Berkeley.

Generating Random Spanning Trees

Sourav Chatterji Sumit Gulwani

EECS DepartmentUniversity of California, Berkeley

Page 2: Generating Random Spanning Trees Sourav Chatterji Sumit Gulwani EECS Department University of California, Berkeley.

2

Outline

• Applications• Determinant based algorithms (unweighted)• Random walk based algorithms (weighted)

– Broder’s algorithm (undirected)– CFTP based algorithm (strongly connected)– Wilson’s algorithm (directed)

• Comparison• Relation to generating perfect random state • Future work

Page 3: Generating Random Spanning Trees Sourav Chatterji Sumit Gulwani EECS Department University of California, Berkeley.

3

Applications

• Perfect random sampling• Statistical physics

– generating random domino tilings

• Computer networks– accessing network reliability

• Computational biology– generating random permutations of genomes

• Electrical networks• Recreation

Page 4: Generating Random Spanning Trees Sourav Chatterji Sumit Gulwani EECS Department University of California, Berkeley.

4

Random maze

Enter Berkeley

Get Ph.D.

Page 5: Generating Random Spanning Trees Sourav Chatterji Sumit Gulwani EECS Department University of California, Berkeley.

5

Random maze: demystified

Get Ph.D.

Enter Berkeley

Page 6: Generating Random Spanning Trees Sourav Chatterji Sumit Gulwani EECS Department University of California, Berkeley.

6

Determinant Based Algorithm

• Matrix tree theorem: The number of spanning trees of G is N(G) = Det(A), – where Aij = degree(vi), if (i = j)

= -1 if (i,j) 2 G = 0 otherwise

• RST(G): – Let G’ = contract e in G– With probability N(G’)/N(G), put e in RST(G)– If yes, then compute RST(G’) else compute RST(G –

{ e })

• Extensions:– Can it be adapted to work for weighted graphs?– Can we approximate the ratio faster?

Page 7: Generating Random Spanning Trees Sourav Chatterji Sumit Gulwani EECS Department University of California, Berkeley.

7

Terminology (for r.w. based algorithms)

• Arborescence: directed spanning tree• Random walk on G

– w.l.o.g. G is stochastic– A random walk on G defines a MC on G

• Forward Tree• Backward Tree

Page 8: Generating Random Spanning Trees Sourav Chatterji Sumit Gulwani EECS Department University of California, Berkeley.

8

Random Walk

Page 9: Generating Random Spanning Trees Sourav Chatterji Sumit Gulwani EECS Department University of California, Berkeley.

9

Forward Tree

•A random walk for t steps defines a forward tree Ft

•First entrances in reversed orientation

Page 10: Generating Random Spanning Trees Sourav Chatterji Sumit Gulwani EECS Department University of California, Berkeley.

10

Backward Tree

•A random walk for t steps defines a backward tree Bt

•Last exits

Page 11: Generating Random Spanning Trees Sourav Chatterji Sumit Gulwani EECS Department University of California, Berkeley.

11

Markov Chain on Trees

•A random walk defines a MC {Bt} on the set of trees

Page 12: Generating Random Spanning Trees Sourav Chatterji Sumit Gulwani EECS Department University of California, Berkeley.

12

Aldous/Broder’s Algorithm

• Undirected weighted graphs• Works in cover time C• Algorithm:

– Perform a random walk until the cover time

– Output the forward tree FC

• Proof:– Pr(FC = T) = (T), where is the stationary distribution

for the backward tree chain (T) / w(T)

• Markov Tree chain theorem:

Page 13: Generating Random Spanning Trees Sourav Chatterji Sumit Gulwani EECS Department University of California, Berkeley.

13

CFTP

• Strongly connected directed weighted graphs• Works in O(C) time• Reduces “generating random arborescence” to

“generating random arborescence with root r”:– Uses CFTP to generate random root r

• Generating random arborescence with root r – Uses CFTP again!

– Markov Chain Mr:

= arborescence with root r

• Transitions: Simulate M = {Bt} until reach a state in Mr

– Random Map

Page 14: Generating Random Spanning Trees Sourav Chatterji Sumit Gulwani EECS Department University of California, Berkeley.

14

Random Map

Definition: excursion (path from r to r)

Application: change the parent of v to be the vertex after the last occurrence of v in the excursion

Page 15: Generating Random Spanning Trees Sourav Chatterji Sumit Gulwani EECS Department University of California, Berkeley.

15

Random Map

Definition: excursion (path from r to r)

Application: change the parent of v to be the vertex after the last occurrence of v in the excursion

Collapsing test: cover time

Page 16: Generating Random Spanning Trees Sourav Chatterji Sumit Gulwani EECS Department University of California, Berkeley.

16

Loop Erasure of a Random Walk

• Erase cycles in order

Page 17: Generating Random Spanning Trees Sourav Chatterji Sumit Gulwani EECS Department University of California, Berkeley.

17

Wilson’s Algorithm

• Directed weighted graphs

• Fastest r.w. based algorithm: runs in O()– = mean hitting time =

• Reduces “generating random arborescence” to “generating arborescence with root”– Add a “sink” v* and edges of weight from each vertex

to v*– Generate a random arborescence T with root v*– If T – { v* } is a tree, output it– Else repeat for a smaller value of

Page 18: Generating Random Spanning Trees Sourav Chatterji Sumit Gulwani EECS Department University of California, Berkeley.

18

Wilson’s Algorithm

• Generating random arborescence with root r– Current_Tree = { r }– While some vertex v not in Current_Tree

• Perform random walk from v till it reaches Current_Tree

• Add its loop erasure to Current_Tree

• Proof:– Algorithm finishes with a tree T and a collection of

cycles { C1, C2, …, Cs }

– Pr[T, {C1, C2, …, Cs}] =

– Pr[T] /

Page 19: Generating Random Spanning Trees Sourav Chatterji Sumit Gulwani EECS Department University of California, Berkeley.

19

Extensions

•Wilson’s algorithm removes loops

•Alternative: remove an edge which breaks the loop

Page 20: Generating Random Spanning Trees Sourav Chatterji Sumit Gulwani EECS Department University of California, Berkeley.

20

A bird’s eye view

• Determinant vs. random walk approach• Broder’s algorithm vs. CFTP based algorithm• Broder’s algorithm vs. Wilson’s algorithm

– Wilson’s algorithm starts from a vertex not in the Current tree and that makes all the difference

Clique

Page 21: Generating Random Spanning Trees Sourav Chatterji Sumit Gulwani EECS Department University of California, Berkeley.

21

Relationship with generating a perfectly random state

• Random state to generate a random spanning tree– via generation of random root (e.g. CFTP)

• Random spanning tree to generate a random state– Seen few techniques for generation of random states

• Strong Stationary Time, CFTP – Random spanning trees is another technique!

• Use Wilson’s algorithm to generate a random spanning tree, and output its root

Page 22: Generating Random Spanning Trees Sourav Chatterji Sumit Gulwani EECS Department University of California, Berkeley.

22

Future Directions

• Can there be a better algorithm than Wilson’s ?– Hybrid Algorithms– Allowing for bias

• Lower bounds

• Generating a random spanning tree with some property like bounded degree, diameter

• Is there an interesting pre-metric that makes the analysis amenable to path coupling ?– Several “natural” pre-metrics do not work!

Page 23: Generating Random Spanning Trees Sourav Chatterji Sumit Gulwani EECS Department University of California, Berkeley.

23

Motivation: Hybrid Algorithm

Clique 0.0001

1

1

Page 24: Generating Random Spanning Trees Sourav Chatterji Sumit Gulwani EECS Department University of California, Berkeley.

24

Extra Slide: Running Time of Wilson’s Algorithm

• Running Time for specified root r:– add the number of visits to each vertex u– Standard result: number of times a random walk

starting at u visits u before reaching r is (u)[Eu Tr + Er Tu]

– Total expected time =

– When r is -random, then

• Total Running Time:– Remains O()– When large, hit v* twice soon; restart– When 1/ = O(), probability of failure is small