fun and games with graphs
play

Fun and Games with Graphs CS200 - Graphs 1 8 7 7 5 9 S 5 15 - PowerPoint PPT Presentation

Fun and Games with Graphs CS200 - Graphs 1 8 7 7 5 9 S 5 15 6 8 9 11 Do Dijkstras Shortest Paths Algorithm, Source: S CS200 - Class Overview 2 8 7 7 5 9 S 5 15 6 8 9 11 Do Prims Minimum Spanning Tree Algorithm,


  1. Fun and Games with Graphs CS200 - Graphs 1

  2. 8 7 7 5 9 S 5 15 6 8 9 11 Do Dijkstra’s Shortest Paths Algorithm, Source: S CS200 - Class Overview 2

  3. 8 7 7 5 9 S 5 15 6 8 9 11 Do Prim’s Minimum Spanning Tree Algorithm, Source: S CS200 - Class Overview 3

  4. Bridges of Konigsberg Problem Euler Is it possible to travel across every bridge without crossing any bridge more than once? http://yeskarthi.wordpress.com/2006/07/31/euler-and-the-bridges-of-konigsberg/ CS200 - Graphs 4

  5. Eulerian paths/circuits n Eulerian path: a path that visits each edge in the graph once n Eulerian circuit: a cycle that visits each edge in the graph once n Is there a simple criterion that allows us to determine whether a graph has an Eulerian circuit or path? CS200 - Graphs 5

  6. Example: Does any graph have an Eulerian path? b a G 1 e d c b a b a e e G 2 G 3 d c d c CS200 - Graphs 6

  7. Example: Does any graph have an Eulerian circuit? b a G 1 e d c b a b a e e G 2 G 3 d c d c CS200 - Graphs 7

  8. Example: Does any graph have an Eulerian circuit or path? b a G 1 a b d c g b a c G 2 f G 3 e d d c CS200 - Graphs 8

  9. Theorems about Eulerian Paths & Circuits n Theorem: A connected multigraph has an Eulerian path iff it has exactly zero or two vertices of odd degree. n Theorem: A connected multigraph, with at least two vertices, has an Eulerian circuit iff each vertex has an even degree. q Demo: http://www.mathcove.net/petersen/lessons/get- lesson?les=23 CS200 - Graphs 9

  10. Hamiltonian Paths/Circuits n A Hamiltonian path/circuit: path/circuit that visits every vertex exactly once. n Defined for directed and undirected graphs CS200 - Graphs 10

  11. Circuits (cont.) n Hamiltonian Circuit: path that begins at vertex v, passes through every vertex in the graph exactly once, and ends at v. q http://www.mathcove.net/petersen/lessons/get- lesson?les=24 CS200 - Graphs 11

  12. Does any graph have a Hamiltonian circuit or a Hamiltonian path? b a b a d c b a e d c e c d CS200 - Graphs 12

  13. Hamiltonian Paths/Circuits n Is there an efficient way to determine whether a graph has a Hamiltonian circuit? q NO! q This problem belongs to a class of problems for which it is believed there is no efficient (polynomial running time) algorithm. CS200 - Graphs 13

  14. The Traveling Salesman Problem TSP: Given a list of cities and their pairwise distances, find a shortest possible tour that visits each city exactly once. http://www.tsp.gatech.edu/ 13,509 cities and towns in the US that have more than 500 residents CS200 - Graphs 14

  15. Using Hamiltonian Circuits n Examine all possible Hamiltonian circuits and select one of minimum total length n With n cities.. q (n-1)! Different Hamiltonian circuits q Ignore the reverse ordered circuits q (n-1)!/2 n With 50 cities n 12,413,915,592,536,072,670,862,289,047,373,3 75,038,521,486,354,677,760,000,000,000 routes CS200 - Graphs 15

  16. TSP n How would a approximating algorithm for TSP work? Local search: construct a solution and then modify it to improve it 71,009 Cities in China CS200 - Graphs 16

  17. Planar Graphs n You are designing a microchip – connections between any two units cannot cross http://www.dmoma.org/ CS200 - Graphs 17

  18. Planar Graphs planar n You are designing a microchip – connections between any two units cannot cross n The graph describing the non-planar chip must be planar http://en.wikipedia.org/wiki/Planar_graph CS200 - Graphs 18

  19. Are these graphs planar? CS200 - Graphs 19

  20. Chip Design n You want more than planarity: the lengths of the connections need to be as short as possible (faster, and less heat is generated) n We are now designing 3D chips, less constraint w.r.t. planarity, and shorter distances, but harder to build. http://www.dmoma.org/ CS200 - Graphs 20

  21. Graph Coloring n A coloring of a simple graph is the assignment of a color to each vertex of the graph so that no two adjacent vertices are assigned the same color CS200 - Graphs 21

  22. Map and graph B A C D D G B F C F A E E G CS200 - Graphs 22

  23. Chromatic number n The least number of colors needed for a coloring of this graph. n The chromatic number of a graph G is denoted by χ (G) CS200 - Graphs 23

  24. The four color theorem n The chromatic number of a planar graph is no greater than four n This theorem was proved by a (theorem prover) program! CS200 - Graphs 24

  25. Example CS200 - Graphs 25

  26. Example CS200 - Graphs 26

Recommend


More recommend