Top Banner
Chapter 14 Section 4 - Slide 1 Copyright © 2009 Pearson Education, Inc. AND
13

Chapter 14 Section 4 - Slide 1 Copyright © 2009 Pearson Education, Inc. AND.

Jan 17, 2016

Download

Documents

Allyson Sims
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: Chapter 14 Section 4 - Slide 1 Copyright © 2009 Pearson Education, Inc. AND.

Chapter 14 Section 4 - Slide 1Copyright © 2009 Pearson Education, Inc.

AND

Page 2: Chapter 14 Section 4 - Slide 1 Copyright © 2009 Pearson Education, Inc. AND.

Copyright © 2009 Pearson Education, Inc. Chapter 14 Section 4 - Slide 2

Chapter 14

Graph Theory

Page 3: Chapter 14 Section 4 - Slide 1 Copyright © 2009 Pearson Education, Inc. AND.

Chapter 14 Section 4 - Slide 3Copyright © 2009 Pearson Education, Inc.

WHAT YOU WILL LEARN

• Graphs, paths and circuits• The Königsberg bridge problem• Euler paths and Euler circuits• Hamilton paths and Hamilton

circuits• Traveling salesman problem• Brute force method

Page 4: Chapter 14 Section 4 - Slide 1 Copyright © 2009 Pearson Education, Inc. AND.

Chapter 14 Section 4 - Slide 4Copyright © 2009 Pearson Education, Inc.

WHAT YOU WILL LEARN

• Nearest neighbor method• Trees, spanning trees, and

minimum-cost spanning trees

Page 5: Chapter 14 Section 4 - Slide 1 Copyright © 2009 Pearson Education, Inc. AND.

Copyright © 2009 Pearson Education, Inc. Chapter 14 Section 4 - Slide 5

Section 4

Trees

Page 6: Chapter 14 Section 4 - Slide 1 Copyright © 2009 Pearson Education, Inc. AND.

Chapter 14 Section 4 - Slide 6Copyright © 2009 Pearson Education, Inc.

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.

Page 7: Chapter 14 Section 4 - Slide 1 Copyright © 2009 Pearson Education, Inc. AND.

Chapter 14 Section 4 - Slide 7Copyright © 2009 Pearson Education, Inc.

Examples

Graphs that are trees. Graph that are not trees.

Page 8: Chapter 14 Section 4 - Slide 1 Copyright © 2009 Pearson Education, Inc. AND.

Chapter 14 Section 4 - Slide 8Copyright © 2009 Pearson Education, Inc.

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

Page 9: Chapter 14 Section 4 - Slide 1 Copyright © 2009 Pearson Education, Inc. AND.

Chapter 14 Section 4 - Slide 9Copyright © 2009 Pearson Education, Inc.

Minimum-cost spanning tree

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

Page 10: Chapter 14 Section 4 - Slide 1 Copyright © 2009 Pearson Education, Inc. AND.

Chapter 14 Section 4 - Slide 10Copyright © 2009 Pearson Education, Inc.

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.

Page 11: Chapter 14 Section 4 - Slide 1 Copyright © 2009 Pearson Education, Inc. AND.

Chapter 14 Section 4 - Slide 11Copyright © 2009 Pearson Education, Inc.

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

Page 12: Chapter 14 Section 4 - Slide 1 Copyright © 2009 Pearson Education, Inc. AND.

Chapter 14 Section 4 - Slide 12Copyright © 2009 Pearson Education, Inc.

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

Page 13: Chapter 14 Section 4 - Slide 1 Copyright © 2009 Pearson Education, Inc. AND.

Chapter 14 Section 4 - Slide 13Copyright © 2009 Pearson Education, Inc.

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