circuits
play

Circuits (Eulerian and Hamiltonian) Ioan Despi - PowerPoint PPT Presentation

Circuits (Eulerian and Hamiltonian) Ioan Despi despi@turing.une.edu.au University of New England July 25, 2013 Outline 1 Recall 2 Bridges of K onigsberg 3 The Traveling Salesperson Problem 4 Eulerian 5 Eulers Theorem 6 Hamiltonian 7


  1. Circuits (Eulerian and Hamiltonian) Ioan Despi despi@turing.une.edu.au University of New England July 25, 2013

  2. Outline 1 Recall 2 Bridges of K¨ onigsberg 3 The Traveling Salesperson Problem 4 Eulerian 5 Euler’s Theorem 6 Hamiltonian 7 Fleury’s Algorithm Ioan Despi – Discrete Mathematics 2 of 31

  3. Recall A graph is a relational structure made up of vertices and edges. Ioan Despi – Discrete Mathematics 3 of 31

  4. Recall A graph is a relational structure made up of vertices and edges. ◮ The edges of a graph express the relationships among the vertices. Ioan Despi – Discrete Mathematics 3 of 31

  5. Recall A graph is a relational structure made up of vertices and edges. ◮ The edges of a graph express the relationships among the vertices. An edge that connects a vertex to itself is a loop . Ioan Despi – Discrete Mathematics 3 of 31

  6. Recall A graph is a relational structure made up of vertices and edges. ◮ The edges of a graph express the relationships among the vertices. An edge that connects a vertex to itself is a loop . Two vertices are adjacent if there is an edge joining them. Ioan Despi – Discrete Mathematics 3 of 31

  7. Recall A graph is a relational structure made up of vertices and edges. ◮ The edges of a graph express the relationships among the vertices. An edge that connects a vertex to itself is a loop . Two vertices are adjacent if there is an edge joining them. ◮ If a vertex has a loop, the vertex is adjacent to itself! Ioan Despi – Discrete Mathematics 3 of 31

  8. Recall A graph is a relational structure made up of vertices and edges. ◮ The edges of a graph express the relationships among the vertices. An edge that connects a vertex to itself is a loop . Two vertices are adjacent if there is an edge joining them. ◮ If a vertex has a loop, the vertex is adjacent to itself! The degree of a vertex is the total number of edges at that vertex. Ioan Despi – Discrete Mathematics 3 of 31

  9. Recall A graph is a relational structure made up of vertices and edges. ◮ The edges of a graph express the relationships among the vertices. An edge that connects a vertex to itself is a loop . Two vertices are adjacent if there is an edge joining them. ◮ If a vertex has a loop, the vertex is adjacent to itself! The degree of a vertex is the total number of edges at that vertex. ◮ A loop adds 2 to the degree of a vertex! Ioan Despi – Discrete Mathematics 3 of 31

  10. Recall A graph is a relational structure made up of vertices and edges. ◮ The edges of a graph express the relationships among the vertices. An edge that connects a vertex to itself is a loop . Two vertices are adjacent if there is an edge joining them. ◮ If a vertex has a loop, the vertex is adjacent to itself! The degree of a vertex is the total number of edges at that vertex. ◮ A loop adds 2 to the degree of a vertex! A vertex with degree 0 is an isolated vertex. Ioan Despi – Discrete Mathematics 3 of 31

  11. Recall A graph is a relational structure made up of vertices and edges. ◮ The edges of a graph express the relationships among the vertices. An edge that connects a vertex to itself is a loop . Two vertices are adjacent if there is an edge joining them. ◮ If a vertex has a loop, the vertex is adjacent to itself! The degree of a vertex is the total number of edges at that vertex. ◮ A loop adds 2 to the degree of a vertex! A vertex with degree 0 is an isolated vertex. A path (walk) in a graph is a route among vertices along the graph’s edges such that no edge is used more than once. Ioan Despi – Discrete Mathematics 3 of 31

  12. Recall A graph is a relational structure made up of vertices and edges. ◮ The edges of a graph express the relationships among the vertices. An edge that connects a vertex to itself is a loop . Two vertices are adjacent if there is an edge joining them. ◮ If a vertex has a loop, the vertex is adjacent to itself! The degree of a vertex is the total number of edges at that vertex. ◮ A loop adds 2 to the degree of a vertex! A vertex with degree 0 is an isolated vertex. A path (walk) in a graph is a route among vertices along the graph’s edges such that no edge is used more than once. ◮ Paths are specified by listing adjacent vertices from the beginning of the path to the end of the path. Ioan Despi – Discrete Mathematics 3 of 31

  13. Recall A graph is a relational structure made up of vertices and edges. ◮ The edges of a graph express the relationships among the vertices. An edge that connects a vertex to itself is a loop . Two vertices are adjacent if there is an edge joining them. ◮ If a vertex has a loop, the vertex is adjacent to itself! The degree of a vertex is the total number of edges at that vertex. ◮ A loop adds 2 to the degree of a vertex! A vertex with degree 0 is an isolated vertex. A path (walk) in a graph is a route among vertices along the graph’s edges such that no edge is used more than once. ◮ Paths are specified by listing adjacent vertices from the beginning of the path to the end of the path. A path that starts and ends at the same vertex is called a circuit . Ioan Despi – Discrete Mathematics 3 of 31

  14. Recall (cont.) A graph is connected if any two of its vertices can be joined by a path. Ioan Despi – Discrete Mathematics 4 of 31

  15. Recall (cont.) A graph is connected if any two of its vertices can be joined by a path. A graph that is not connected is disconnected . Ioan Despi – Discrete Mathematics 4 of 31

  16. Recall (cont.) A graph is connected if any two of its vertices can be joined by a path. A graph that is not connected is disconnected . ◮ The resulting pieces of a disconnected graph are called components of the graph. Ioan Despi – Discrete Mathematics 4 of 31

  17. Recall (cont.) A graph is connected if any two of its vertices can be joined by a path. A graph that is not connected is disconnected . ◮ The resulting pieces of a disconnected graph are called components of the graph. If erasing an edge of a connected graph would cause the graph to be disconnected, that edge is called a bridge . Ioan Despi – Discrete Mathematics 4 of 31

  18. Bridges of K¨ onigsberg The city of K¨ oningsberg occupied both banks and two islands of a river. The islands and the riverbanks were connected by seven bridges, as indicated in Figure 1 . The question is if there is a walk around the city that crosses each bridge exactly once . Figure 1 : The city of K¨ oningsberg Ioan Despi – Discrete Mathematics 5 of 31

  19. Bridges of K¨ onigsberg (cont.) Your tasks are: 1 Represent the problem as a graph. 2 Represent the problem using predicate calculus: devise a predicate and use it to represent facts and rules in a Prolog-style manner. (Prolog is a programming language used in Artificial Intelligence) 3 Are the two representations equivalent? 4 Try to solve the problem (optional). Ioan Despi – Discrete Mathematics 6 of 31

  20. Trying to solve the problem. . . (from http://mathforum.org/isaac/problems/bridges1.html) Figure 2 : First attempt Ioan Despi – Discrete Mathematics 7 of 31

  21. Trying to solve the problem. . . (from http://mathforum.org/isaac/problems/bridges1.html) Figure 2 : First attempt Figure 3 : Second attempt Ioan Despi – Discrete Mathematics 7 of 31

  22. Trying to solve the problem. . . What if we delete a bridge? Figure 4 : Third attempt Ioan Despi – Discrete Mathematics 8 of 31

  23. Bridges of K¨ onigsberg (solution) Euler invented graph theory to solve this problem. Ioan Despi – Discrete Mathematics 9 of 31

  24. Bridges of K¨ onigsberg (solution) Euler invented graph theory to solve this problem. We will use riverbanks ( rb1 and rb2 ) and islands ( i1 and i2 ) as nodes in the graph. Ioan Despi – Discrete Mathematics 9 of 31

  25. Bridges of K¨ onigsberg (solution) Euler invented graph theory to solve this problem. We will use riverbanks ( rb1 and rb2 ) and islands ( i1 and i2 ) as nodes in the graph. The bridges are represented by labeled arcs between nodes ( b1 , b2 , . . . , b7 ). Ioan Despi – Discrete Mathematics 9 of 31

  26. Bridges of K¨ onigsberg (solution) Euler invented graph theory to solve this problem. We will use riverbanks ( rb1 and rb2 ) and islands ( i1 and i2 ) as nodes in the graph. The bridges are represented by labeled arcs between nodes ( b1 , b2 , . . . , b7 ). We ignore bridge lengths, distances, aso. Ioan Despi – Discrete Mathematics 9 of 31 Figure 5 : The graph of the city of K¨ oningsberg bridge system

  27. Bridges of K¨ onigsberg (solution) The connect/3 predicate corresponds to an arc of the graph, asserting that two land pieces are connected by a particular bridge. As each bridge requires two facts, one for each direction in which the bridge may be crossed, we can use a rule connect(X, Y, Z) = connect(Y, X, Z). to specify that bridge Z can be crossed in both ways, from land piece X to land piece Y and vice-versa. Then we have the following facts: connect(i1, i2, b1). connect(rb1, i1, b2). connect(rb1, i1, b3). connect(rb1, i2, b4). connect(rb2, i1, b5). connect(rb2, i1, b6). connect(rb2, i2, b7). The predicate calculus representation is equivalent to the graph representation in that the connectedness is preserved. An algorithm can translate between the two representations with no loss of information. Ioan Despi – Discrete Mathematics 10 of 31

  28. Bridges of K¨ onigsberg (the truth) The walk is impossible. Ioan Despi – Discrete Mathematics 11 of 31

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend