Top Banner
233-234 233-234 Sedgewick & Wayne (2004); Sedgewick & Wayne (2004); Chazelle (2005) Chazelle (2005)
67

233-234

Jan 23, 2016

Download

Documents

marilu alfaro

233-234. Sedgewick & Wayne (2004); Chazelle (2005). Adjacency lists. Hansel & Gretel. random walk. 1. Birds eat the bread crumbs. DFS/BFS. 2. They don’t. Diffusion equation. Random walk. Diffusion equation. Normal distribution. 3 views of the same thing. Hansel & Gretel. - PowerPoint PPT Presentation
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: 233-234

233-234233-234233-234233-234

Sedgewick & Wayne (2004); Chazelle (2005)Sedgewick & Wayne (2004); Chazelle (2005) Sedgewick & Wayne (2004); Chazelle (2005)Sedgewick & Wayne (2004); Chazelle (2005)

Page 2: 233-234

Adjacency lists

Page 3: 233-234

1. Birds eat the bread crumbs

2. They don’t

random walk

DFS/BFS

Hansel & Gretel

Page 4: 233-234
Page 5: 233-234

Diffusion equation

Page 6: 233-234

Diffusion equation

Normal distribution

Random walk

Page 7: 233-234
Page 8: 233-234

With bread crumbs one canfind exit in time proportional

to V+E DFS/BFS

Hansel & Gretel

Page 9: 233-234

Breadth First Search

Page 10: 233-234
Page 11: 233-234
Page 12: 233-234
Page 13: 233-234
Page 14: 233-234
Page 15: 233-234

Breadth First Search

F

A

B C G

D E

H

Page 16: 233-234

Breadth First Search

F

A

B C G

D E

H

Queue: A

get

0distance from A

visit(A)

Page 17: 233-234

Breadth First Search

F

A

B C G

D E

H

Queue:

0

F1

F discovered

Page 18: 233-234

Breadth First Search

F

A

B C G

D E

H

Queue: F

0

1

B 1B discovered

Page 19: 233-234

Breadth First Search

F

A

B C G

D E

H

Queue: F B

0

1

1 C 1C discovered

Page 20: 233-234

Breadth First Search

F

A

B C G

D E

H

Queue: F B C

0

1

1 1 G

1

G discovered

Page 21: 233-234

Breadth First Search

F

A

B C G

D E

H

Queue: F B C G

get

0

1

1 1

1

A finished

Page 22: 233-234

Breadth First Search

F

A

B C G

D E

H

Queue: B C G

0

1

1 1

1A already

visited

Page 23: 233-234

Breadth First Search

F

A

B C G

D E

H

Queue: B C G

0

1

1 1

1

D2

D discovered

Page 24: 233-234

Breadth First Search

F

A

B C G

D E

H

Queue: B C G D

0

1

1 1

1

2 E

2

E discovered

Page 25: 233-234

Breadth First Search

F

A

B C G

D E

H

Queue: B C G D E

get

0

1

1 1

1

2

2

F finished

Page 26: 233-234

Breadth First Search

F

A

B C G

D E

H

Queue: C G D E

0

1

1 1

1

2

2

Page 27: 233-234

Breadth First Search

F

A

B C G

D E

H

Queue: C G D E

0

1

1 1

1

2

2

A alreadyvisited

Page 28: 233-234

Breadth First Search

F

A

B C G

D E

H

Queue: C G D E

get

0

1

1 1

1

2

2

B finished

Page 29: 233-234

Breadth First Search

F

A

B C G

D E

H

Queue: G D E

0

1

1 1

1

2

2

A alreadyvisited

Page 30: 233-234

Breadth First Search

F

A

B C G

D E

H

Queue: G D E

get

0

1

1 1

1

2

2

C finished

Page 31: 233-234

Breadth First Search

F

A

B C G

D E

H

Queue: D E

0

1

1 1

1

2

2

A alreadyvisited

Page 32: 233-234

Breadth First Search

F

A

B C G

D E

H

Queue: D E

0

1

1 1

1

2

2

E alreadyvisited

Page 33: 233-234

Breadth First Search

F

A

B C G

D E

H

Queue: D E

get

0

1

1 1

1

2

2

G finished

Page 34: 233-234

Breadth First Search

F

A

B C G

D E

H

Queue: E

0

1

1 1

1

2

2

E alreadyvisited

Page 35: 233-234

Breadth First Search

F

A

B C G

D E

H

Queue: E

0

1

1 1

1

2

2

F alreadyvisited

Page 36: 233-234

Breadth First Search

F

A

B C G

D E

H

Queue: E

get

0

1

1 1

1

2

2

D finished

Page 37: 233-234

Breadth First Search

F

A

B C G

D E

H

Queue:

0

1

1 1

1

2

2

D alreadyvisited

Page 38: 233-234

Breadth First Search

F

A

B C G

D E

H

Queue:

0

1

1 1

1

2

2

F alreadyvisited

Page 39: 233-234

Breadth First Search

F

A

B C G

D E

H

Queue:

0

1

1 1

1

2

2

G alreadyvisited

Page 40: 233-234

Breadth First Search

F

A

B C G

D E

H

Queue:

0

1

1 1

1

2

2

H 3

H discovered

Page 41: 233-234

Breadth First Search

F

A

B C G

D E

Queue: H

get

0

1

1 1

1

2

2

H 3

E finished

Page 42: 233-234

Breadth First Search

F

A

B C G

D E

H

Queue:

0

1

1 1

1

2

2

3

E alreadyvisited

Page 43: 233-234

Breadth First Search

F

A

B C G

D E

H

Queue:

STOP

0

1

1 1

1

2

2

3

H finished

Page 44: 233-234

Breadth First Search

F

A

B C G

D E

H

0

1

1 1

1

2

2

3

distance from A

Page 45: 233-234

Breadth-First Search

Page 46: 233-234

b ca da

cdb

v

Page 47: 233-234
Page 48: 233-234
Page 49: 233-234
Page 50: 233-234

Rod Steiger

Martin Sheen

Donald Pleasence

#1

#2

#3

#876Kevin Bacon

Barabasi

Page 51: 233-234

Rank NameAveragedistance

# ofmovies

# oflinks

1 Rod Steiger 2.537527 112 25622 Donald Pleasence 2.542376 180 28743 Martin Sheen 2.551210 136 35014 Christopher Lee 2.552497 201 29935 Robert Mitchum 2.557181 136 29056 Charlton Heston 2.566284 104 25527 Eddie Albert 2.567036 112 33338 Robert Vaughn 2.570193 126 27619 Donald Sutherland 2.577880 107 2865

10 John Gielgud 2.578980 122 294211 Anthony Quinn 2.579750 146 297812 James Earl Jones 2.584440 112 3787…

876 Kevin Bacon 2.786981 46 1811…

Why Kevin Bacon?

Measure the average distance between Kevin Bacon and all other actors.

876 Kevin Bacon 2.786981 46 1811Barabasi

Page 52: 233-234
Page 53: 233-234

Langston et al., A combinatorial approach to the analysis of differential gene expression data….

Minimum Dominating Set

Page 54: 233-234

Minimum Dominating Set

Page 55: 233-234

Minimum Dominating Set

Page 56: 233-234

size of dominating set

Page 57: 233-234

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:

Page 58: 233-234

1. For each vertex v, color v red with probability p

Page 59: 233-234

1. For each vertex v, color v red with probability p

2. Color blue any non-dominated vertex

Page 60: 233-234

X= number of red nodes Y= number of blue nodes

Size of dominating set = X+Y

Page 61: 233-234
Page 62: 233-234
Page 63: 233-234
Page 64: 233-234
Page 65: 233-234

Expected size of dominating set S =

Page 66: 233-234

Markov’s inequality

proof

j= k E|S|

Page 67: 233-234

Probability that is < 1/2

Run algorithm 10 times and keep smallest S

with probability > 0.999