Graph Theory Trees. WHAT YOU WILL LEARN Trees, spanning trees, and minimum-cost spanning trees.

Post on 08-Jan-2018

221 views 2 download

description

Definitions A tree is a connected graph in which each edge is a bridge. A spanning tree is a tree that is created from another graph by removing edges while still maintaining a path to each vertex.

Transcript of Graph Theory Trees. WHAT YOU WILL LEARN Trees, spanning trees, and minimum-cost spanning trees.

Graph Theory

Trees

WHAT YOU WILL LEARN• Trees, spanning trees, and

minimum-cost spanning trees

Definitions

A tree is a connected graph in which each edge is a bridge.

A spanning tree is a tree that is created from another graph by removing edges while still maintaining a path to each vertex.

Examples

Graphs that are trees. Graph that are not trees.

Example: Determining Spanning Trees

Determine two different spanning trees for the graph shown.

A

B

C

E F H

D G

A

B

C

E F H

D G A

B

C

E F H

D G

Minimum-cost spanning tree

A minimum cost spanning tree is the least expensive spanning tree of all spanning trees under consideration.

Kruskal’s Algorithm

To construct the minimum-cost spanning tree from a weighted graph:1. Select the lowest-cost edge on the graph.2. Select the next lowest-cost edge that does not

form a circuit with the first edge.3. Select the next lowest-cost edge that does not

form a circuit with the previously selected edges.4. Continue selecting the lowest-cost edges that do

not form circuits with the previously selected edges.

5. When a spanning tree is complete, you have the minimum-cost spanning tree.

Example: Kruskal’s Algorithm

Use Kruskal’s algorithm to determine the minimum spanning tree for the weighted graph shown. The numbers along the edges represent dollars.

A

B

C

G

D

E

F

12

11

10 5

22

14

4

17

22

18

Solution

Pick the lowest-cost edge of the graph, edge CD which is $4.

Next we select the next lowest-cost edge that does not form a circuit; we select edge CG which is $5.

A

B

C

G

D

E

F

12

11

10 5

22

14

4

17

22

18

Solution (continued)

Continue selecting edges, being careful not to form a circuit.

The total cost would be$12 + $10 + $5 + $14 +$18 + $4 = $63.

A

B

C

G

D

E

F

12

11

10 5

22

14

4

17

22

18

Determine a spanning tree for the graph shown below.

a.

c.

b.

d.

Determine a spanning tree for the graph shown below.

a.

c.

b.

d.

Determine the minimum-cost spanning tree for the following weighted graph.

a.

c.

b.

d.

a.

c.

b.

d.

Kathleen is planning on installing a new computer network at her small business. Her current system has computers already in place as shown in the figure below. The numbers are shown in feet.

Determine the minimum-cost spanning tree that reaches each computer.

a.

c.

b.

d.

Determine the minimum-cost spanning tree that reaches each computer.

a.

c.

b.

d.

If the new networking system materials cost $2.20 per foot, what is the cost of installing the system

a. $79.20

b. $83.60

c. $85.80

d. $112.20

If the new networking system materials cost $2.20 per foot, what is the cost of installing the system

a. $79.20

b. $83.60

c. $85.80

d. $112.20