Section 14.1 Graphs, Paths, and Circuits
INB Table of Contents Date Topic Page # January 27, 2014 Test #1 14 January 27, 2014 Test # 1 Corrections 15 January 27, 2014 Section 14.1 Examples 16 January 27, 2014 Section 14.1 Notes 17 January 27, 2014 Section 14.2 Examples 18 January 27, 2014 Section 14.2 Notes 19 2.3-2
What You Will Learn Graphs Paths Circuits Bridges 14.1-3
Definitions A graph is a finite set of points called vertices (singular form is vertex) connected by line segments (not necessarily straight) called edges. A loop is an edge that connects a vertex to itself. A B Loop Not a vertex C D Edge Vertex 14.1-4
Example 1: Representing the Königsberg Bridge Problem Using the definitions of vertex and edge, represent the Königsberg bridge problem with a graph. Königsberg was situated on both banks and two islands of the Prigel River. From the figure, we see that the sections of town were connected with a series of seven bridges. 14.1-5
Example 1: Representing the Königsberg Bridge Problem 14.1-6
Example 1: Representing the Königsberg Bridge Problem The townspeople wondered if one could walk through town and cross all seven bridges without crossing any of the bridges twice. 14.1-7
Example 3: Representing a Floor Plan The figure shows the floor plan of the kindergarten building at the Pullen Academy. Use a graph to represent the floor plan. 14.1-9
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, and a vertex with an odd number of edges connected to it is an odd vertex. 14.1-11
Definitions In the figure, vertices A and D are even and vertices B and C are odd. 14.1-12
Paths A path is a sequence of adjacent vertices and edges connecting them. C, D, A, B is an example of a path. 14.1-13
Paths A path does not need to include every edge and every vertex of a graph. In addition, a path could include the same vertices and the same edges several times. For example, on the next slide, we see a graph with four vertices. The path A, B, C, D, A, B, C, D, A, B, C, D, A, B, C starts at vertex A, circles the graph three times, and then goes through vertex B to vertex C. 14.1-14
Paths 14.1-15
Circuit A circuit is a path that begins and ends at the same vertex. Path A, C, B, D, A forms a circuit. 14.1-16
Connected Graph A graph is connected if, for any two vertices in the graph, there is a path that connects them. 14.1-17
Disconnected Graph If a graph is not connected, it is disconnected. 14.1-18
Bridge A bridge is an edge that if removed from a connected graph would create a disconnected graph. 14.1-19
Section 14.2 Euler Paths, and Euler Circuits
What You Will Learn Euler Paths Euler Circuits Euler s Theorem Fleury s Algorithm 14.2-21
Euler Path An Euler path is a path that passes through each edge of a graph exactly one time. 14.2-22
Euler Circuit An Euler circuit is a circuit that passes through each edge of a graph exactly one time. 14.2-23
Euler Path versus Euler Circuit The difference between an Euler path and an Euler circuit is that an Euler circuit must start and end at the same vertex. 14.2-24
Euler Path versus Euler Circuit Euler Path D, E, B, C, A, B, D, C, E Euler Circuit D, E, B, C, A, B, D, C, E, F, D 14.2-25
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 no 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. 14.2-26
Example 3: Solving the Königsberg Bridge Problem Could a walk be taken through Königsberg during which each bridge is crossed exactly one time? 14.2-27
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. 3. Begin to trace 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 your choice of edges). 5. Continue until each edge of the entire graph has been traced once. 14.2-30
Example 6: Crime Stoppers Problem Below is a representation of the Country Oaks subdivision of homes. The Country Oaks Neighborhood Association is planning to organize a crime stopper group in which residents take turns walking through the neighborhood with cell phones to report any suspicious activity to the police. 14.2-31
Example 6: Crime Stoppers Problem a) Can the residents of Country Oaks start at one intersection (or vertex) and walk each street block (or edge) in the neighborhood exactly once and return to the intersection where they started? b) If yes, determine a circuit that could be followed to accomplish their walk. 14.2-32
Example 6: Crime Stoppers Problem a) Does a Euler circuit exist? 14.2-33