aim: graph theory - trees course: math literacy do now: aim: what’s a tree?

16
Aim: Graph Theory - Trees Course: Math Literacy Do Now: Aim: What’s a tree?

Upload: leslie-richards

Post on 01-Jan-2016

220 views

Category:

Documents


0 download

TRANSCRIPT

Aim: Graph Theory - Trees Course: Math Literacy

Do Now:

Aim: What’s a tree?

Aim: Graph Theory - Trees Course: Math Literacy

A Tree

Tree – a graph with the smallest number of edges that allow all vertices to be reached from all other vertices.

A

D E

GB

C F

CD

E

A

B

FA

B C

G HFED

all connectedno circuits

no longer trees

Aim: Graph Theory - Trees Course: Math Literacy

What’s in a tree?

A tree is a graph that is connected and has no circuits. All trees have the following properties:

a. There is one and only one path joining any two vertices.

b. Every edge is a bridge.

c. A tree with n vertices must have n – 1 edges.

a tree with 5 vertices must have 4 edges.

Aim: Graph Theory - Trees Course: Math Literacy

Model Problem

Which graph is a tree?A

B

EC

D

A

B

C

D

E

A

B

C

D

E

Aim: Graph Theory - Trees Course: Math Literacy

Spanning Trees

Spanning tree – a subgraph of a connected graph that contains no circuits.

A

G

D

B C

E Fnot a tree7 vertices7 edges

A

G

D

B C

E F

a tree with removal of BC

7 vertices, 6 edges

A

G

D

B C

FE

a tree with removal of EG7 vertices, 6 edges

Aim: Graph Theory - Trees Course: Math Literacy

Model Problem

Find a spanning tree for the graph below.

A B

D C

E F

H G

8 vertices12 edges

5 gotta go

A B

D C

E F

H G

A B

D C

E F

H G

A B

D C

E F

H G

A B

D C

E F

H G

A B

D C

E F

H G

8 vertices, 7 edges - a tree

Aim: Graph Theory - Trees Course: Math Literacy

Model Problem

Find a spanning tree for the graph below.

6 vertices8 edges

3 gotta go

C

E F

B D

A

Aim: Graph Theory - Trees Course: Math Literacy

Efficiency!

Minimum spanning tree - a spanning tree with the smallest possible total weight on a weight graph.A

G

D

B C

E F

8

20

3517 15

12

24

original weightedgraph =

131

A

G

D

B C

E F

8

20

3517 15

24

35+24+20+8+17+15 =

119A

G

D

B C

FE

8

20

3517 15

12

35+17+12+15+20+8 = 107

Aim: Graph Theory - Trees Course: Math Literacy

Kruskal’s Algorithm

Kruskal’s Algorithm: finding the minimum spanning tree from a weighted graph:

1. Find the edge with the smallest weight in the graph. If there is more than one, pick one at random and mark it.

2. Find the next smallest edge in the graph. If there is more than one, pick at random. Mark it.

3. Find the next-smallest unmarked edge that does not create a red circuit.

4. Repeat step 3 until all vertices are included. The marked edges are the desired minimum spanning tree.

Aim: Graph Theory - Trees Course: Math Literacy

Model Problem

Seven building on a college campus are connected by the sidewalks show in the figure below. The weight graph represents building as vertices sidewalks as edges and sidewalk lengths as weights. A heavy snow has fallen and the sidewalks need to be cleared quickly. Determine the shortest series of sidewalks to clear. What is the total length of the sidewalks that need to be cleared?

264’256’ 262’

242’

259’255’

251’253’

251’241’

245’

274’

Aim: Graph Theory - Trees Course: Math Literacy

Model Problem

264’256’ 262’

242’

259’255’

251’253’

251’241’

245’

274’G

E

D

B

A

C

F

245253

264

256

249

251

242274

251

255 259

262

B C E

F

GA

D

Aim: Graph Theory - Trees Course: Math Literacy

245253

264

256

249

251

242274

251

255 259

262

B C E

F

GA

D

Model Problem

Kruskal’s Algorithm: finding the minimum spanning tree from a weighted graph:

1. Find the edge with the smallest weight in the graph. If there is more than one, pick one at random and mark it.

2. Find the next smallest edge in the graph. If there is more than one, pick at random. Mark it.

3. Find the next-smallest unmarked edge that does not create a red circuit.

4. Repeat step 3 until all vertices are included. The marked edges are the desired minimum spanning tree.

242'

GF

245'

BD

249'

AD

251'

DG

253'

CD

259'

CE+ + + + + = 1499’

Aim: Graph Theory - Trees Course: Math Literacy

Model Problem

Use Kruskal’s Algorithm to find the minimum spanning tree for the graph below. Give the total weight of the minimum spanning tree.

3531

23

28

21

12

14

26

2224

Aim: Graph Theory - Trees Course: Math Literacy

The Product Rule

Aim: Graph Theory - Trees Course: Math Literacy

The Product Rule

Aim: Graph Theory - Trees Course: Math Literacy

The Product Rule