Slide 14-1 Copyright © 2005 Pearson Education, Inc. SEVENTH EDITION and EXPANDED SEVENTH EDITION.

Slides:



Advertisements
Similar presentations
Introduction to Graph Theory Instructor: Dr. Chaudhary Department of Computer Science Millersville University Reading Assignment Chapter 1.
Advertisements

Graph-02.
Chapter 15 Graph Theory © 2008 Pearson Addison-Wesley. All rights reserved.
1 Chapter 15.3 Hamilton Paths and Hamilton Circuits Objectives 1.Understand the definitions of Hamilton paths & Hamilton circuits. 2.Find the number of.
Section 2.1 Euler Cycles Vocabulary CYCLE – a sequence of consecutively linked edges (x 1,x2),(x2,x3),…,(x n-1,x n ) whose starting vertex is the ending.
A traveling salesman has customers in 5 cities which we will call A, B, C, D, and E. The salesman needs to travel to all 5 cities with his trip starting.
Homework collection Thursday 3/29 Read Pages 160 – 174 Page 185: 1, 3, 6, 7, 8, 9, 12 a-f, 15 – 20.
4/17/2017 Section 8.5 Euler & Hamilton Paths ch8.5.
Chapter 15 Graph Theory © 2008 Pearson Addison-Wesley.
Chapter 15 Graph Theory © 2008 Pearson Addison-Wesley. All rights reserved.
Chapter 15 Graph Theory © 2008 Pearson Addison-Wesley.
1 Excursions in Modern Mathematics Sixth Edition Peter Tannenbaum.
Graph Theory Topics to be covered:
Slide Copyright © 2009 Pearson Education, Inc. AND Active Learning Lecture Slides For use with Classroom Response Systems Chapter 14 Graph Theory.
Euler Paths & Euler Circuits
Graph Theory Hamilton Paths and Hamilton Circuits.
1 Excursions in Modern Mathematics Sixth Edition Peter Tannenbaum.
6.1 Hamilton Circuits and Paths: Hamilton Circuits and Paths: Hamilton Path: Travels to each vertex once and only once… Hamilton Path: Travels to each.
© 2010 Pearson Prentice Hall. All rights reserved. 1 §15.3, Hamilton Paths and Circuits.
Copyright 2013, 2010, 2007, Pearson, Education, Inc. Section 14.3 Hamilton Paths, and Hamilton Circuits.
Copyright 2013, 2010, 2007, Pearson, Education, Inc. Section 14.4 Trees.
Graphs, Paths & Circuits
Chapter 14 Section 4 - Slide 1 Copyright © 2009 Pearson Education, Inc. AND.
Aim: What is an Euler Path and Circuit?
© 2010 Pearson Prentice Hall. All rights reserved. CHAPTER 15 Graph Theory.
1.5 Graph Theory. Graph Theory The Branch of mathematics in which graphs and networks are used to solve problems.
EXCURSIONS IN MODERN MATHEMATICS SIXTH EDITION Peter Tannenbaum 1.
Mathematics in Management Science
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley. Ver Chapter 13: Graphs Data Abstraction & Problem Solving with C++
AND.
Euler Paths and Circuits. The original problem A resident of Konigsberg wrote to Leonard Euler saying that a popular pastime for couples was to try.
© 2010 Pearson Prentice Hall. All rights reserved. CHAPTER 15 Graph Theory.
Copyright 2013, 2010, 2007, Pearson, Education, Inc. Section 14.2 Euler Paths, and Euler Circuits.
Graph Theory Trees. WHAT YOU WILL LEARN Trees, spanning trees, and minimum-cost spanning trees.
Excursions in Modern Mathematics, 7e: Copyright © 2010 Pearson Education, Inc. 5 The Mathematics of Getting Around 5.1Euler Circuit Problems 5.2What.
1) Find and label the degree of each vertex in the graph.
Tree Diagrams A tree is a connected graph in which every edge is a bridge. There can NEVER be a circuit in a tree diagram!
Copyright 2013, 2010, 2007, Pearson, Education, Inc. Section 14.1 Graphs, Paths, and Circuits.
I can describe the differences between Hamilton and Euler circuits and find efficient Hamilton circuits in graphs. Hamilton Circuits I can compare and.
Chapter 14 Section 3 - Slide 1 Copyright © 2009 Pearson Education, Inc. AND.
Unit 2 Hamiltonian Circuits. Hamiltonian Circuit: A tour that starts at a vertex of a graph and visits each vertex once and only once, returning to where.
Grade 11 AP Mathematics Graph Theory Definition: A graph, G, is a set of vertices v(G) = {v 1, v 2, v 3, …, v n } and edges e(G) = {v i v j where 1 ≤ i,
Copyright © 2009 Pearson Education, Inc. Chapter 14 Section 1 – Slide Graph Theory Graphs, Paths & Circuits.
MAT 110 Workshop Created by Michael Brown, Haden McDonald & Myra Bentley for use by the Center for Academic Support.
Excursions in Modern Mathematics Sixth Edition
Excursions in Modern Mathematics Sixth Edition
Hamilton Paths and Hamilton Circuits
Excursions in Modern Mathematics Sixth Edition
Çizge Algoritmaları.
AND.
Chapter 2: Business Efficiency Lesson Plan
Chapter 2: Business Efficiency Lesson Plan
Section 14.3 Hamilton Paths, and Hamilton Circuits
Euler Paths & Euler Circuits
Graph Theory.
Section 14.4 Trees.
4-4 Graph Theory Trees.
Excursions in Modern Mathematics Sixth Edition
Graphs, Paths & Circuits
5 The Mathematics of Getting Around
Chapter 15 Graph Theory © 2008 Pearson Addison-Wesley.
Chapter 15 Graph Theory © 2008 Pearson Addison-Wesley.
Chapter 15 Graph Theory © 2008 Pearson Addison-Wesley.
Hamilton Paths and Hamilton Circuits
Section 14.1 Graphs, Paths, and Circuits
Section 13.4 Trees.
Graphs, Paths, and Circuits
Warm Up – 3/19 - Wednesday Give the vertex set. Give the edge set.
Traveling Salesman Problems Nearest Neighbor Method
A Survey of Mathematics with Applications
Presentation transcript:

Slide 14-1 Copyright © 2005 Pearson Education, Inc. SEVENTH EDITION and EXPANDED SEVENTH EDITION

Copyright © 2005 Pearson Education, Inc. Chapter 14 Graph Theory

Copyright © 2005 Pearson Education, Inc Graphs, Paths and Circuits

Slide 14-4 Copyright © 2005 Pearson Education, Inc. Definitions A graph is a finite set of points called vertices (singular form is vertex) connected by line segments (not necessarily straight) called edges. Loop is an edge that connects a vertex to itself. A B CD Loop Edge Vertex Not a vertex

Slide 14-5 Copyright © 2005 Pearson Education, Inc. Example: Map The map shows the states that make up part of the Midwest states from Weather Underground, Inc. Construct a graph to show the states that share a common border. Michigan Ohio Indiana Kentucky West Virginia

Slide 14-6 Copyright © 2005 Pearson Education, Inc. Solution Each vertex will represent one of the states. If two states share a common border, connect the respective vertices with an edge.

Slide 14-7 Copyright © 2005 Pearson Education, Inc. Solution continued Michigan Ohio Indiana Kentucky West Virginia MI OHIN KY WV

Slide 14-8 Copyright © 2005 Pearson Education, Inc. Definitions The degree of a vertex is the number of edges that connect to that vertex. A vertex with an even number of edges connected to it is an even vertex. A vertex with an odd number of edges connected to it is an odd vertex. MI, OH, and WV are even vertices IN, KY are odd vertices MI OHIN KY WV

Slide 14-9 Copyright © 2005 Pearson Education, Inc. Definitions A path is a sequence of adjacent vertices and edges connecting them. C, D, A, B is an example of a path. A circuit is a path that begins and ends at the same vertex. A, C, B, D, A forms a circuit. A B C D E

Slide Copyright © 2005 Pearson Education, Inc. Definitions A graph is connected if, for any two vertices in the graph, there is a path that connects them. Examples of disconnected graphs. A B C D G H JK

Slide Copyright © 2005 Pearson Education, Inc. Definitions continued A bridge is an edge that if removed from a connected graph would create a disconnected graph. A B C D bridge G H JK

Copyright © 2005 Pearson Education, Inc Euler Paths and Euler Circuits

Slide Copyright © 2005 Pearson Education, Inc. Definitions An Euler path is a path that passes through each edge of a graph exactly one time. An Euler circuit is a circuit that passes through each edge of a graph exactly one time. The difference between an Euler path and an Euler circuit is that an Euler circuit must start and end at the same vertex.

Slide Copyright © 2005 Pearson Education, Inc. Examples Euler path Euler circuit

Slide Copyright © 2005 Pearson Education, Inc. Example: Euler Path and Circuits For the graphs shown, determine if an Euler path, an Euler circuit, neither, or both exist. A B C D A BC D E The graph has many Euler circuits, each of which is also an Euler path. This graph has no odd vertices. One example is A, D, B, C, D, B, A. The graph has an Euler path but it does not have an Euler circuit. One Euler path is E, C, B, E, D, B, A, D. Each path must begin or end at vertex D or E.

Slide Copyright © 2005 Pearson Education, Inc. Euler’s Theorem For a connected graph, the following statements are true:  1. A graph with no odd vertices (all even vertices) has at least one Euler path, which is also an Euler circuit. An Euler circuit can be started at any vertex and it will end at the same vertex.  2. A graph with exactly two odd vertices has at least one Euler path but not Euler circuits. Each Euler path must begin at one of the two odd vertices, and it will end at the other odd vertex.  3. A graph with more than two odd vertices has neither an Euler path nor an Euler circuit.

Slide Copyright © 2005 Pearson Education, Inc. Example: Using Euler’s Theorem Use Euler’s theorem to determine whether an Euler path or an Euler circuit exists in the figures shown from the previous example.

Slide Copyright © 2005 Pearson Education, Inc. Example: Using Euler’s Theorem continued The graph has no odd vertices (all vertices are even). According to item 1, at least one Euler circuit exists. An Euler circuit can be determined by starting at any vertex. The Euler circuit will end at the vertex from which is started. Remember that each Euler circuit is also an Euler path. A B C D

Slide Copyright © 2005 Pearson Education, Inc. Example: Using Euler’s Theorem continued There are 3 even vertices (A, B, C) and two odd vertices (D, E). Based on item 2, we conclude that since there are exactly two odd vertices, at least one Euler path exists but no Euler circuits exists. Each Euler path must begin at one of the odd vertices and end at the other odd vertex. A BC D E

Slide Copyright © 2005 Pearson Education, Inc. Example In section 14.1, example 1, we discussed some of the states that make up the Midwest region of the weather map from Weather Underground. We drew a graph that showed the states that share a common border. One of the researchers wants to visit each state within the mapped region. To plan the most efficient trip, the researcher wishes to travel between these states and cross each common state border exactly one time.  a) Is it possible to travel among the states and cross each common state border exactly one time?  b) If it is possible, can he start and end in the same state?

Slide Copyright © 2005 Pearson Education, Inc. Solution We are looking for an Euler path, you must use each edge exactly one time. According to item 2, the graph has at least one Euler path but no Euler circuits. Therefore, yes, it is possible to travel among these states and cross each common border exactly one time. There is not an Euler circuit, so the researcher cannot start and end in the same state. MI OHIN KY WV

Slide Copyright © 2005 Pearson Education, Inc. Fleury’s Algorithm To determine an Euler path or an Euler circuit:  1. Use Euler’s theorem to determine whether an Euler path or an Euler circuit exists. If one exists, proceed with steps 2-5.  2.If the graph has no odd vertices (therefore has an Euler circuit, which is also an Euler path), choose any vertex as the starting point. If the graph has exactly two odd vertices (therefore has only an Euler path), choose one of the two odd vertices as the starting point.

Slide Copyright © 2005 Pearson Education, Inc. Fleury’s Algorithm continued  3. Begin to trace the edges as you move through the graph. Number the edges as you trace them. Since you can’t trace any edges twice in Euler paths and Euler circuits, once an edge is traced consider it “invisible.”  4.When faced with a choice of edges to trace, if possible, choose an edge that is not a bridge (i.e., don’t create a disconnected graph with yourchoice of edges).  5.Continue until each edge of the entire graph has been traced once.

Slide Copyright © 2005 Pearson Education, Inc. Example Use Fluery’s algorithm to determine an Euler circuit. There is at least one Euler circuit since there are no odd vertices. Start at any vertex to determine an Euler circuit. A B C D E F G

Slide Copyright © 2005 Pearson Education, Inc. Example continued Start at C. Choose either CB or CD. Continue to trace from vertex to vertex around the outside of the graph. A B C D E F G start here

Copyright © 2005 Pearson Education, Inc Hamilton Paths and Hamilton Circuits

Slide Copyright © 2005 Pearson Education, Inc. Definitions A Hamilton path is a path that contains each vertex of a graph exactly once. A Hamilton circuit is a path that begins and ends at the same vertex and passes through all other vertices of the graph exactly one time.

Slide Copyright © 2005 Pearson Education, Inc. Example: Hamilton Path Graph (a) shown has Hamilton path A, B, C, E, D. The graph also has Hamilton path C, B, A, D, E. Can you find some others? Graph (b) shown has Hamilton path A, B, C, F, H, E, G, D. The graph also has Hamilton path G, D, E, H, F, C, B, A. Can you find some others?

Slide Copyright © 2005 Pearson Education, Inc. Example: Hamilton Circuit Graph (a) shown has Hamilton circuit A, B, D, G, E, H, F, C, A. A Hamilton circuit starts and ends at the same vertex. Graph (b) shown has Hamilton circuit A, B, C, E, D, A. Can you find another?

Slide Copyright © 2005 Pearson Education, Inc. Definition A complete graph is a graph that has an edge between each pair of its vertices.

Slide Copyright © 2005 Pearson Education, Inc. Example: Finding Hamilton Circuits Determine a Hamilton circuit for the complete graph shown. One solution is A, G, F, E, C, D, B, A A B C E F G D

Slide Copyright © 2005 Pearson Education, Inc. Number of Unique Hamilton Circuits in a Complete Graph The number of unique Hamilton circuits in a complete graph with n vertices is (n  1)! where (n  1)! = (n  1)(n  2)(n  3)…(3)(2)(1)

Slide Copyright © 2005 Pearson Education, Inc. Example: Number of Hamilton Circuits How many unique Hamilton circuits are there in a complete graph with the following number of vertices? a) 4b) 9 a) 4 = (4  1)! = 4321 = 24 b) 9 = (9  1)! = = 40,320

Slide Copyright © 2005 Pearson Education, Inc. The Brute Force Method of Solving Traveling Salesman Problems To determine the optimal solution:  1. Represent the problem with a complete, weighted graph.  2. List all possible Hamilton circuits for this graph.  3. Determine the cost (or distance) associated with each of these Hamilton circuits.  4. The Hamilton circuit with the lowest (or shortest distance) is the optimal solution.

Slide Copyright © 2005 Pearson Education, Inc. Example: Brute Force Method Find a minimum Hamilton circuit for the complete, weighted graph shown. List all the Hamilton circuits. Since there are 4 vertices there are (4  1)! = 3! = 6 possible circuits. A B CD

Slide Copyright © 2005 Pearson Education, Inc. Example: Brute Force Method continued A B CD A, D, C, B, A A, D, B, C, A A, C, D, B, A Fourth Leg A, C, B, D, A 22686A, B, D, C, A A, B, C, D, A TotalThird Leg Second Leg First Leg Circuit The minimum amount for the graph would be 22.

Slide Copyright © 2005 Pearson Education, Inc. Nearest Neighbor Method of Determining an Approximate Solution to a Traveling Salesman Problem To approximate a optimal solution:  1. Represent the problem with a complete, weighted graph.  2.Identify the starting vertex.  3.Of all the edges attached to the starting vertex, choose the edge that has the smallest weight. This edge is generally either the shortest distance or the lowest cost. Travel along this edge to the second vertex.

Slide Copyright © 2005 Pearson Education, Inc. Nearest Neighbor Method of Determining an Approximate Solution to a Traveling Salesman Problem continued  4.At the second vertex, choose the edge that has the smallest weight that does not lead to a vertex already visited. Travel along this edge to the third vertex.  5.Continue this process, each time moving along the edge with the smallest weight until all vertices are visited.  6.Travel back to the original vertex.

Slide Copyright © 2005 Pearson Education, Inc. Example: Nearest Neighbor An appliance repair man must repair four appliances at the locations shown in the graph. The estimated travel time (in minutes) is shown between the four locations. The repair man wants to visit the four locations in an order that takes the least amount of time. Use the nearest neighbor algorithm to find an approximate solution to the problem.

Slide Copyright © 2005 Pearson Education, Inc. Example: Nearest Neighbor continued Choose a starting vertex. Let’s choose vertex A. Choose the edge that has the smallest weight. Either AD or AB, lets choose AD (9). At D choose the edge that has the smallest weight DE (5). C B A E D start here 2 nd vertex

Slide Copyright © 2005 Pearson Education, Inc. Example: Nearest Neighbor continued Continue moving along the edge with the smallest weight. Circuit would be: A, D, E, B, C, A = 37 This route would take about 37 minutes. C B A E D start here 2 nd vertex

Slide Copyright © 2005 Pearson Education, Inc. Example: Nearest Neighbor continued Other circuits and weights = 49E, B, D, C, A, EE = 34D, E, B, A, C, DD = 34C, D, E, B, A, CC = 34B, E, D, C, A, BB Total WeightCircuitStarting Vertex

Copyright © 2005 Pearson Education, Inc Trees

Slide Copyright © 2005 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.

Slide Copyright © 2005 Pearson Education, Inc. Examples Graphs that are trees. Graph that are not trees.

Slide Copyright © 2005 Pearson Education, Inc. Example: Determining Spanning Trees Determine two different spanning trees for the graph shown. A B C E FH D G A B C E FH D G A B C E FH D G

Slide Copyright © 2005 Pearson Education, Inc. Minimum-cost spanning tree A minimum cost spanning tree is the least expensive spanning tree of all spanning trees under consideration.

Slide Copyright © 2005 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 doe not form circuits with the previously selected edges.  5. When a spanning tree is complete, you have the minimum-cost spanning tree.

Slide Copyright © 2005 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

Slide Copyright © 2005 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

Slide Copyright © 2005 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