Sedgewick & Wayne (2004); Chazelle (2005) Sedgewick & Wayne (2004); Chazelle (2005)
Adjacency lists
1. Birds eat the bread crumbs 2. They don’t random walk DFS/BFS Hansel & Gretel
Diffusion equation
Normal distribution Random walk
With bread crumbs one can find exit in time proportional to V+E DFS/BFS Hansel & Gretel
Breadth First Search
F A BCG DE H
F A BCG DE H Queue: A get 0 distance from A visit(A)
Breadth First Search F A BCG DE H Queue: 0 F 1 F discovered
Breadth First Search F A BCG DE H Queue: F 0 1 B 1 B discovered
Breadth First Search F A BCG DE H Queue: F B C 1 C discovered
Breadth First Search F A BCG DE H Queue: F B C G 1 G discovered
Breadth First Search F A BCG DE H Queue: F B C G get A finished
Breadth First Search F A BCG DE H Queue: B C G A already visited
Breadth First Search F A BCG DE H Queue: B C G D 2 D discovered
Breadth First Search F A BCG DE H Queue: B C G D E 2 E discovered
Breadth First Search F A BCG DE H Queue: B C G D E get F finished
Breadth First Search F A BCG DE H Queue: C G D E
Breadth First Search F A BCG DE H Queue: C G D E A already visited
Breadth First Search F A BCG DE H Queue: C G D E get B finished
Breadth First Search F A BCG DE H Queue: G D E A already visited
Breadth First Search F A BCG DE H Queue: G D E get C finished
Breadth First Search F A BCG DE H Queue: D E A already visited
Breadth First Search F A BCG DE H Queue: D E E already visited
Breadth First Search F A BCG DE H Queue: D E get G finished
Breadth First Search F A BCG DE H Queue: E E already visited
Breadth First Search F A BCG DE H Queue: E F already visited
Breadth First Search F A BCG DE H Queue: E get D finished
Breadth First Search F A BCG DE H Queue: D already visited
Breadth First Search F A BCG DE H Queue: F already visited
Breadth First Search F A BCG DE H Queue: G already visited
Breadth First Search F A BCG DE H Queue: H 3 H discovered
Breadth First Search F A BCG DE Queue: H get H 3 E finished
Breadth First Search F A BCG DE H Queue: E already visited
Breadth First Search F A BCG DE H Queue: STOP H finished
Breadth First Search F A BCG DE H distance from A
Breadth-First Search
b c a d a c d b v
Rod Steiger Martin Sheen Donald Pleasence #1 #2 #3 #876 Kevin Bacon Barabasi
Why Kevin Bacon? Measure the average distance between Kevin Bacon and all other actors. 876 Kevin Bacon Barabasi
Langston et al., A combinatorial approach to the analysis of differential gene expression data…. Minimum Dominating Set
size of dominating set
Expected size of dominating set Assume each node has at least d neighbors Naïve algorithm still n/2 in worst case Simple probabilistic algorithm:
1. For each vertex v, color v red with probability p
2. Color blue any non-dominated vertex
X= number of red nodes Y= number of blue nodes Size of dominating set = X+Y
Expected size of dominating set S =
Markov’s inequality proof j= k E|S|
Probability that is < 1/2 Run algorithm 10 times and keep smallest S with probability > 0.999