1 Section 15.1 Consider the house plan below. This graph represents the house. Consider the mail route below. This graph represents the mail route.
2 Definitions 1. Graph a structure that describes relationships. - Shows how objects are related. - Parts of a graph are: i. Vertices a finite set of points ii. Edge Line segment or curve that starts and ends at a vertex. iii. Loop An edge that starts and ends at the same vertex. 2. Degree of a Vertex the number of edges that meet at a particular vertex. - Count the number of line segments and cures attached to the vertex. 3. Even vertex a vertex with an even number of edges. 4. Odd vertex a vertex with an odd number of edges. 5. Adjacent vertices There is at least one edge connecting the two vertices. Example:
3 Example: Consider the state map below. Draw a graph where the vertices represent states and common borders represent edges. a) What is the degree of Washington? b) Is the degree of the vertex Idaho even or odd? c) Are Oregon and Wyoming adjacent vertices? d) Describe how to travel from Washington to Wyoming. 6. Path A sequence of adjacent vertices and edges connecting them. - Same vertex can be listed more than once. - Same edges can only be listed once. - Separate values with a comma. 7. Circuit A path that begins and ends at the same vertex. Example: You take a scenic vacation from WA through ID, MT, WY, OR, and then home. - All circuits are paths. - Not all paths are circuits.
4 8. Connected Graph There is at least one path connecting any two vertices on the graph. Example: 9. Disconnected path There is not at least one path connecting every vertex. Example: Example: 10. Components The separate pieces on a disconnected graph. 11. Bridge An edge that can be removed to leave a disconnected path. Example
5 12. Equivalent Graphs Two graphs with i. THE SAME NUMBER OF VERTICES, and ii. VERTICES THAT ARE CONNECTED IN THE SAME WAY. Example: Show that the two graphs are equivalent. Then draw a third equivalent graph.
6 Example: Draw a graph that models the city below. Create a path that allows the residents to walk across all bridges without crossing the same bridge twice.
7 Example: a) Draw a graph that models the connecting relationships in the floor plan. Use vertices to represent the rooms and the outside, and edges to represent the connecting doors. b) Use the graph to determine if it is possible to find a path that uses each door only once. If possible, trace out the route on the floor plan.
8 Example: The figure shows a map of a portion of New York City with the bridge and tunnel connections. Use a graph to determine if it is possible to visit Manhattan, Long Island, Staten Island, and New Jersey using each bridge tunnel only once.
9 Section 15.2 Euler Path A path that travels each edge only once. Euler Circuit An Euler path that begins and ends at the same vertex. Examples:
10 Euler s Theorem: 1. No odd vertices All vertices are even. There is at least one Euler Path. Start at any vertex. There is at least one Euler Circuit. 2. Two odd vertices There is at least one Euler Path. Start at the odd vertex, end at the other odd vertex. There is no Euler Circuit. 3. More than two odd vertices There is no Euler Path. There is no Euler Circuit.
11 Example: Label each vertex as even or odd. Then apply Euler s Theorem.
12 Fleury s Algorithm 1. Check that a Euler Path/Euler Circuit exists using Euler s Theorem. 2. Pick a starting point. All even vertices: Pick any vertex (Euler Circuit) Two odd vertices: Choose one of the two odd vertices (Euler Path) 3. Travel by an edge to another vertex. Choose edges that do not form bridges. Travel the bridges only if there is no other choice. Number the edges traveled. Erase traveled edges and replace them with dashed lines. Example: For each graph determine: a) Does the graph have a Euler Path, Euler Circuit, or neither? b) If so, trace the path using Fleury s Algorithm.
13 Example: The map shows the bridges and tunnels that connect in NYC. Use a graph to determine if you can visit Manhattan, Long Island, Staten Island, and New Jersey using each bridge/tunnel only once.
14 Example: Use Fleury s Algorithm to find an Euler circuit.
15 Section 15.3 Hamilton Path Path that passes through each vertex of a graph once. Hamilton Circuit A Hamilton path beginning and ending at the same vertex. Comment: A graph can have both an Euler and Hamilton path, neither, or just one of the two. Example a) Find a Hamilton path beginning at A and ending at D. b) Find a Hamilton circuit beginning at B.
16 Complete Graph There is an edge between every vertex. Example Not an Example Every complete path with more than three vertices has a Hamilton circuit. There are (n-1)! Hamilton circuits in a complete graph with n vertices. Example: a) Modify the graph by adding the least number of edges so that the resulting graph is complete. b) How many Hamilton circuits are possible? c) Give two Hamilton circuits for the modified graph in part (a). d) Modify the given graph by removing the least number of edges so that the resulting graph has a Euler circuit.
17 Weights A number attached to the edge of a graph that often represents values such as distance, time, or cost. Example: You have three errands to run, in no particular order. You will start and end at your apartment. The table gives the distance, in miles, between any two of these locations. Apartment Best Buy Publix Sports Authority Apartment * 2 4.5 2.5 Best Buy 2 * 3 4 Publix 4.5 3 * 3.5 Sports Authority 2.5 4 3.5 * a) Create a complete, weighted graph that models the information in the table. b) What is the distance to travel from your Apartment, to Best Buy, to Publix, to Sports Authority, and then back to your Apartment? c) How many Hamilton Circuits are possible?
18 Optimal Hamilton Circuit A complete, weighted graph whose sum is a minimum. There are Two Methods to find an optimal Hamilton Circuit: A. Brute Force Method 1. Model the problem with a complete, weighted graph. 2. List all possible Hamilton circuits. 3. Find the sum of weights of the edges for each Hamilton Circuit. 4. Choose the Hamilton circuit with minimal weight. B. Nearest Neighbor Method 1. Model the problem with a complete, weighted graph. 2. Pick the starting vertex. 3. From the current vertex, pick an edge with the smallest weight. Move to that vertex. 4. Repeat this process until all vertices are visited. 5. Return to the starting point.
19 Example: You have three errands to run, in no particular order. You will start and end at your apartment. The table gives the distance, in miles, between any two of these locations. d) Use the Brute Force method to find the shortest route. e) Use the Nearest Neighbor method to approximate the shortest distance.
20 Section 15.4 Tree A connected graph with no circuits. 1. There is only one path joining any two vertices. 2. Every edge is a bridge. 3. A tree with n vertices must have (n-1) edges. 4. NO CIRCUITS Example: Which graph is a tree? Explain why the other two graphs are not trees. a) b) c)
21 Subgraph A graph with the same vertices and some of the edges removed. Example: Which graph is a subgraph of the other? Spanning Tree A subgraph that: 1. Contains all of the connected graph s vertices. 2. Is connected. 3. Contains no circuits. Example: Find a spanning tree for the graph below.
22 Example: Find a spanning tree for the graph below. Minimum Spanning Tree for a weighted graph The spanning tree with the smallest possible total weight. To find, apply Kruskal s Algorithm: 1. Find the edge with the lowest weight. (If there is a tie, randomly pick one.) Mark this edge in red. 2. Find the next smallest. (If there is a tie, randomly choose an edge). Mark this edge in red. 3. Find the next smallest edge that does not create a circuit. (If there is a tie, randomly pick an edge). Mark this edge in red. 4. Repeat until all vertices are included.
23 Example: Apply Kruskal s Algorithm to each graph below. Give the total weight.
24 Example: Use Kruskal s Algorithm to find the minimum spanning tree. Give the total weight.