1 / 148

A Mathematical View of Our World

A Mathematical View of Our World. 1 st ed. Parks, Musser, Trimpe, Maurer, and Maurer. Chapter 6. Routes and Networks. Section 6.1 Routing Problems. Goals Study graphs, vertices, and edges Study paths and circuits Study connected graphs Use Euler’s Theorem Use Fleury’s Algorithm.

thom
Télécharger la présentation

A Mathematical View of Our World

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. A Mathematical View of Our World 1st ed. Parks, Musser, Trimpe, Maurer, and Maurer

  2. Chapter 6 Routes and Networks

  3. Section 6.1Routing Problems • Goals • Study graphs, vertices, and edges • Study paths and circuits • Study connected graphs • Use Euler’s Theorem • Use Fleury’s Algorithm

  4. 6.1 Initial Problem • Can the people of Konigsberg, pictured here, take a walk crossing each bridge exactly one time? • The solution will be given at the end of the section.

  5. Graphs • A graph is a collection of one or more points, called vertices, and the paths connecting them, called edges. • The singular of vertices is vertex.

  6. Graphs, cont’d • The vertices are drawn as dots. • The edges are drawn as straight or curved lines. • Each edge has two ends with a vertex at each end, or else it is a loop connecting a vertex to itself.

  7. Equivalent Graphs • Two graphs are considered the same if they have the same number of vertices connected in the same way, even if they look different.

  8. Example 1 • The three graphs shown are equivalent.

  9. Vertices and Edges • Two edges may appear to cross, but they do not actually intersect unless there is a vertex. • Example: Graph (a) shows two edges crossing where there is no vertex.

  10. Example 2 • Graphs can be drawn to represent real-life connections, such as roads between cities. • Example: Draw a graph to represent the roadmap.

  11. Example 2, cont’d • Solution: The vertices represent the cities, and the edges represent the roads.

  12. Adjacent Vertices • Two vertices are called adjacent vertices if there is an edge connecting them.

  13. Example 3 • List the pairs of adjacent vertices in the graph.

  14. Example 3, cont’d • Solution: The pairs of adjacent vertices are: • A and B, A and C, A and D, A and E • B and D • C and E • E and E, since there is a loop at E

  15. Question: List all the vertices that are adjacent to the vertex labeled Portland. a. Salem, Boise, Olympia b. Salem, Spokane c. Salem, Olympia, Seattle, Spokane d. Boise

  16. Example 4 • Draw two different graphs with the following properties: • Vertices: A, B, C, and D • Adjacent vertices are: A and C, B and C, B and D, C and D.

  17. Example 4, cont’d • Solution: Two possible graphs are shown below.

  18. Degree of a Vertex • The degree of a vertex is the total number of edges at the vertex. • Find the degree of a vertex by counting the number of edges leaving or arriving at the vertex. • A loop contributes 2 to the degree of a vertex.

  19. Example 5 • Find the degree of each vertex in the graph. • Solution: • A has degree 5, • B has degree 3, • C has degree 2, • D has degree 2, • E has degree 4.

  20. Theorem • If d is the sum of all the degrees of the vertices in a graph and e is the number of edges in the graph, then d = 2e. • Note: This theorem is true because each edge adds 2 to the degree total.

  21. Example 6 • Verify that the theorem is true for the following graph. • Solution: The sum of the degrees is 16. The number of edges is 8. Check that 16 = 2(8).

  22. Paths • A path is a route in a graph. • Each vertex used is adjacent to the next vertex used. • Each edge in the graph is used at most one time. • A path is written as a list of vertices.

  23. Example 7 • Find three different paths in the graph. • Solution: • One possible path is A,B,D,A,E. • A second path is B,A,B,D. • A third path is C,E,E,A • There are many other paths.

  24. Circuits • A circuit is a path that begins and ends at the same vertex. • Example: One circuit in the graph is A,B,D,A.

  25. Euler Paths • A path that uses every edge of a graph exactly once is called an Euler path. • Note: Euler is pronounced “oiler.” • Example: The edges are numbered in the order used.

  26. Euler Circuits • A circuit that uses every edge of a graph exactly once is called an Euler circuit. • Example: The edges are numbered in the order used.

  27. Connected Graphs • A graph is said to be connected if, for every pair of vertices, there is a path that contains them. • If a graph is not connected, it is said to be disconnected. • An edge is called a bridge if its removal from the graph would change the graph from connected to disconnected.

  28. Example 8 • Explain whether or not the graphs are connected. • Solution: The graph is connected because there is a path, using one edge or more, between every pair of vertices.

  29. Example 8, cont’d • Solution 2: The graph is disconnected because, for example, there is no path between vertex A and vertex G.

  30. Example 9 • Identify any bridges in the (connected) graph. • Solution: There are three bridges: the edge between D and E, the edge between D and F, and the edge between F and G.

  31. Components • A component of a graph is a maximal connected piece of the graph. • A component is connected. • If any more edges are added to the component (if there are any more in the graph) it would become disconnected. • Every graph has one or more components.

  32. Components, cont’d • Any connected graph has one component. • For the connected graph in the previous example, the entire graph is the only component. • A disconnected graph has two or more components. • For the disconnected graph in the previous example, there are two components.

  33. Components, cont’d • To find the components of a graph, use the following algorithm. • Pick any vertex of the graph and highlight it. • Highlight all edges connecting to the highlighted vertex and all vertices at the end of those edges. • Repeat step 2 as many times as possible. • When no more vertices can be highlighted, you have a component.

  34. Example 10 • Find all components of the graph. • Solution: We use the algorithm from the preceding slide. There are three components: the piece containing A, E, F, and G; the piece containing B and C; and the piece containing D.

  35. Degree Theorem • Any graph must have an even number of vertices with odd degree. • We saw earlier that the sum of all the degrees in a graph is always an even number, so: • Vertices with even degrees do not have to come in pairs. • Vertices with odd degrees come in pairs.

  36. Euler’s Theorem • For a connected graph: • If the graph has zero vertices of odd degree, then it has at least one Euler circuit. • If a graph has an Euler circuit, then it has no vertices of odd degree.

  37. Euler’s Theorem cont’d • For a connected graph: • If the graph has exactly two vertices of odd degree, then • It does not have an Euler circuit. • It has at least one Euler path. • Any Euler path starts at one of the two vertices of odd degree and ends at the other.

  38. Euler’s Theorem cont’d • For a connected graph: • If the graph has more than two vertices of odd degree, then • It does not have an Euler circuit. • It does not have an Euler path.

  39. Question: Does the graph have an Euler circuit, an Euler path, or neither? a. Euler circuit b. Euler path only c. neither

  40. Example 11 • Does the graph have an Euler circuit, Euler path, or neither? • Solution: Every vertex is of degree 2 or degree 4, so by Euler’s theorem the graph has an Euler circuit.

  41. Example 11, cont’d • Solution: There are two vertices of odd degree, E and G, so by Euler’s theorem the graph has only an Euler path.

  42. Fleury’s Algorithm • If Euler’s Theorem indicates that there is an Euler circuit, Fleury’s Algorithm can be used to find the circuit. • The step-by-step procedure is as follows: • Copy all the vertices, but not the edges, of the original graph. • Select any vertex on the original graph and mark it as the present position.

  43. Fleury’s Algorithm, cont’d • Choose one edge at the marked vertex and transfer it to the new graph. • Do not choose a bridge, unless it is the only edge available. • Number the edges in the order they are transferred.

  44. Fleury’s Algorithm, cont’d • Use the vertex on the other end of the edge as the new present position. Repeat step 3. • When you transfer the last edge you are done.

  45. Example 12 • Use Fleury’s Algorithm to find an Euler circuit for the graph. • Possible Final Solution:

  46. 6.1 Initial Problem Solution • The idea of Euler circuits can be used to solve the question of whether the people of Konigsberg can take a walk crossing each bridge exactly one time.

  47. Initial Problem Solution, cont’d • The vertices represent the land and the edges the bridges. The described walk would be an Euler path. • We use Euler’s Theorem to show that there is no such path for their walk because there are four vertices of odd degree.

  48. Section 6.2Network Problems • Goals • Study weighted graphs • Study spanning trees • Study minimal spanning trees • Use Kruskal’s algorithm

  49. 6.2 Initial Problem • Walkways need to be built between the buildings on the campus pictured at right.

  50. 6.2 Initial Problem, cont’d • How can the walkways be constructed so that: • Students can go from any building on campus to any other building without needing to walk outside. • The total length of the walkways is minimized. • The solution will be given at the end of the section.

More Related