1 Euler and Hamilton paths Jorge A. Cobb The University of Texas at Dallas.

Slides:



Advertisements
Similar presentations
Great Theoretical Ideas in Computer Science
Advertisements

Chapter 8 Topics in Graph Theory
22C:19 Discrete Math Graphs Fall 2010 Sukumar Ghosh.
Introduction to Graph Theory Instructor: Dr. Chaudhary Department of Computer Science Millersville University Reading Assignment Chapter 1.
22C:19 Discrete Math Graphs Fall 2014 Sukumar Ghosh.
Walks, Paths and Circuits Walks, Paths and Circuits Sanjay Jain, Lecturer, School of Computing.
Midwestern State University Department of Computer Science Dr. Ranette Halverson CMPS 2433 – CHAPTER 4 GRAPHS 1.
Graph-02.
The 7 Bridges of Konigsberg A puzzle in need of solving.
Lecture 24 Coping with NPC and Unsolvable problems. When a problem is unsolvable, that's generally very bad news: it means there is no general algorithm.
Lecture 21 Paths and Circuits CSCI – 1900 Mathematics for Computer Science Fall 2014 Bill Pine.
AMDM UNIT 7: Networks and Graphs
BY: MIKE BASHAM, Math in Scheduling. The Bridges of Konigsberg.
9.2 The Traveling Salesman Problem. Let us return to the question of finding a cheapest possible cycle through all the given towns: We have n towns (points)
Combinatorial Algorithms
C++ Programming: Program Design Including Data Structures, Third Edition Chapter 21: Graphs.
1 Discrete Structures & Algorithms Graphs and Trees: II EECE 320.
Math 308 Discrete Mathematics Discrete Mathematics deals with “Separated” or discrete sets of objects (rather than continuous sets) Processes with a sequence.
© 2006 Pearson Addison-Wesley. All rights reserved14 A-1 Chapter 14 Graphs.
An Euler Circuit is a cycle of an undirected graph, that traverses every edge of the graph exactly once, and ends at the same node from which it began.
A traveling salesman has customers in 5 cities which we will call A, B, C, D, and E. The salesman needs to travel to all 5 cities with his trip starting.
4/17/2017 Section 8.5 Euler & Hamilton Paths ch8.5.
How is this going to make us 100K Applications of Graph Theory.
Euler and Hamilton Paths
By Dr. C. B. Alphonce (Room305 Mathematics Building) MT 147: DISCRETE MATHEMATICS (3 Units) CORE for B. SC. In COMPUTER SCIENCE.
22C:19 Discrete Math Graphs Spring 2014 Sukumar Ghosh.
Eulerian Graphs CSE 331 Section 2 James Daly. Reminders Project 3 is out Covers graphs Due Friday.
Euler Paths and Circuits. The original problem A resident of Konigsberg wrote to Leonard Euler saying that a popular pastime for couples was to try.
GRAPH Learning Outcomes Students should be able to:
Theory of Computing Lecture 10 MAS 714 Hartmut Klauck.
Slide 14-1 Copyright © 2005 Pearson Education, Inc. SEVENTH EDITION and EXPANDED SEVENTH EDITION.
Graphs and DNA sequencing CS 466 Saurabh Sinha. Three problems in graph theory.
Graph Theory Topics to be covered:
Euler and Hamilton Paths
There is a Postman who delivers mail to a certain neighborhood of streets. The postman is unwilling to walk far so he wants to find the shortest route.
Discrete Math Unit 6 Set Theory Number Theory Graph Theory.
1 Excursions in Modern Mathematics Sixth Edition Peter Tannenbaum.
6.1 Hamilton Circuits and Paths: Hamilton Circuits and Paths: Hamilton Path: Travels to each vertex once and only once… Hamilton Path: Travels to each.
Week 11 - Monday.  What did we talk about last time?  Binomial theorem and Pascal's triangle  Conditional probability  Bayes’ theorem.
CSE 589 Part VI. Reading Skiena, Sections 5.5 and 6.8 CLR, chapter 37.
Fall 2015 COMP 2300 Discrete Structures for Computation Donghyun (David) Kim Department of Mathematics and Physics North Carolina Central University 1.
Chapter 10 Graph Theory Eulerian Cycle and the property of graph theory 10.3 The important property of graph theory and its representation 10.4.
EXCURSIONS IN MODERN MATHEMATICS SIXTH EDITION Peter Tannenbaum 1.
Lecture 10: Graph-Path-Circuit
CIRCUITS, PATHS, AND SCHEDULES Euler and Königsberg.
Associated Matrices of Vertex Edge Graphs Euler Paths and Circuits Block Days April 30, May 1 and May
Graph theory and networks. Basic definitions  A graph consists of points called vertices (or nodes) and lines called edges (or arcs). Each edge joins.
Euler Paths and Circuits. The original problem A resident of Konigsberg wrote to Leonard Euler saying that a popular pastime for couples was to try.
Lecture 52 Section 11.2 Wed, Apr 26, 2006
Chapter 6: Graphs 6.1 Euler Circuits
Introduction to Graph Theory
Chapter 20: Graphs. Objectives In this chapter, you will: – Learn about graphs – Become familiar with the basic terminology of graph theory – Discover.
Euler and Hamiltonian Graphs
Approximation Algorithms by bounding the OPT Instructor Neelima Gupta
Chapter 14 Section 3 - Slide 1 Copyright © 2009 Pearson Education, Inc. AND.
(CSC 102) Lecture 30 Discrete Structures. Graphs.
Grade 11 AP Mathematics Graph Theory Definition: A graph, G, is a set of vertices v(G) = {v 1, v 2, v 3, …, v n } and edges e(G) = {v i v j where 1 ≤ i,
Week 10 - Wednesday.  What did we talk about last time?  Counting practice  Pigeonhole principle.
An Introduction to Graph Theory
Excursions in Modern Mathematics Sixth Edition
EECS 203 Lecture 19 Graphs.
Euler and Hamiltonian Graphs
Euler Paths and Circuits
Eulerian tours Miles Jones MTThF 8:30-9:50am CSE 4140 August 15, 2016.
EECS 203 Lecture 20 More Graphs.
Introduction to Graph Theory Euler and Hamilton Paths and Circuits
Discrete Math II Howon Kim
Applied Combinatorics, 4th Ed. Alan Tucker
Euler and Hamiltonian Graphs
Graph Theory Relations, graphs
Presentation transcript:

1 Euler and Hamilton paths Jorge A. Cobb The University of Texas at Dallas

2 Paths and the adjacency matrix The powers of the adjacency matrix A r (with normal, not boolean multiplication) contain the number of paths from v i to v j with exactly r edges Proof: By induction. True for A 1 = A. When we consider A r+1, the (i, j)-th entry there will be b i1 a 1j + b i2 a 2j b in a nj where b ik are the entries in A r and a kj are the entries in A. So that entry will add the count of paths from all possible paths with r edges that can be extended to end at v j.

3 The bridges of Königsberg The town of Königsberg (East Prussia; now Kaliningrad, Russia) is divided in four sections with seven bridges Is it possible to start somewhere and return to that point crossing all bridges exactly once?

4 A graph for Königsberg We represent the four regions as vertices and the bridges as edges (rearranging because of isomorphism)

5 Euler circuits and paths An Euler circuit in a graph is a simple circuit containing every edge of the graph. An Euler path in a graph is a simple path containing every edge of the graph. Theorem 1: A finite graph has an Euler circuit if and only if it is connected and all vertices have even degree.

6 Proof: “Only if” direction Suppose that a graph has an Euler circuit. Then the graph must be connected. The Euler circuit starts at a vertex v. Every time any vertex other the last vertex in the circuit is entered (including v if it is visited multiple times), the circuit must leave this vertex. Thus, the edges entering and leaving each vertex are paired, adding 2 to that vertex’s degree each time it is visited. 2 is also added to v’s degree for the first and last edge, so all vertex degrees are even.

7 Proof: “If” direction Suppose that all vertices have even degrees. We construct an Euler circuit as follows: Start at an arbitrary vertex, and construct a path randomly, until we can’t do so anymore (this will happen at some point because the graph is finite). This process must terminate at v, because each time the path passes from a vertex u it subtracts 2 from the remaining edges incident to u, and those are an even number. Therefore, we can always leave any vertex other than v.

8 Proof: “If” direction We have therefore constructed a simple circuit. Does this use all edges? If not, consider the subgraphs obtained by deleting the circuit we just constructed. Because the original graph is connected, these subgraphs will have at least a vertex in common with our path. Follow the above process in each such subgraph, and splice the circuits together to obtain an Euler circuit for the original graph.

9 Assume you started at a You get stuck once you go back to a.

10 Euler paths Theorem 2: A finite graph has an Euler path (but not an Euler circuit) if and only if it is connected and exactly two vertices have odd degrees. Proof: Analogous to Theorem 1. The two vertices with the odd degrees must be the first and last vertices in the Euler path (see the book for details)

11 The bridges of Königsberg Is there an Euler circuit or path? NO because all four vertices have odd degree Modern Königsberg Two brigdes were destroyed by British bombers in WW II. Two bridges were replaced by a highway by the Russians. Three bridges plus the highway remain The graph has now two vertices with degree 2 and two with degree 3, so it has an Euler path

12 Extensions of the problem Identified regions The blue prince wants to be able to visit all bridges starting at his castle and ending at the inn. Which new bridge should he build?

13 Solution We need an Euler path from the blue castle to the inn. We have the following degrees: blue castle, red castle, and church: 3 inn: 5 We need to make the degrees of the red castle and church even – build a bridge between them

14 More extensions The red prince, furious with the previous development, wants to build a ninth bridge so that he can go from his castle to the inn and the blue prince can no longer do so. The bishop, upset with all this bridge building and the excessive drinking, wants to build a tenth bridge so that everybody can go home (i.e., there is an Euler circuit).

15 Hamilton circuits and paths A Hamilton circuit (path) is a simple circuit (path) that contains all vertices and passes through each vertex of the graph exactly once. How can we tell if a graph has a Hamilton circuit or path? Not easily, i.e., in general, in not less than exponential time in the number of vertices There are some tests that can exclude graphs (e.g., no vertex of degree one for circuits).

16 Ham. Circuits and Paths

17 Number of Hamilton paths Consider the complete graph K n with n > 2. How many Hamilton circuits are there? Select any vertex as the start vertex (because all vertices will belong to the circuit the choice doesn’t matter). From this vertex we can choose n-1 successor vertices, from each of them n-2 vertices, and so on, for a total of (n-1)! circuits. Because direction doesn’t matter, the distinct circuits are (n- 1)!/2.

18 Weighted graphs A weighted graph is a graph where numbers (weights or costs) have been attached to each edge. Example: In a graph for flight connections, weights could represent time needed for each flight, distance traveled, or cost of traveling on that flight. In a computer network, costs could represent the delay for a message to travel through a link.

19 Path length In a graph without weights, we define the length of a path as the number of edges in it. In a weighted graph, the path length is a function of the weights of the edges in the path, usually the sum of those weights.

20 The Traveling Salesman problem A traveling salesman needs to visit n cities, going to each city exactly once, and return to his starting city. Assume every city is connected to every other city, but the cost of traveling differs for each city pair. What is the sequence of cities that minimizes the overall cost? Equivalent formulation: Find the Hamilton circuit in K n with shortest length.

21 Solving the TSP No algorithm is known that will guarantee finding the best solution except by examining all possible circuits (or equivalent approaches). For n = 25, (n – 1)! / 2 = 24! / 2 ≈ 3 × If we take one nanosecond to calculate the cost of each circuit, we still need 3 × seconds, or about 10 million years. The problem is provably NP-complete.

22 TSP Problems Planning routes 980 cities in Luxembourg 24,978 cities in Sweden (solved May 2004) 1,904,711 cities in the world Drilling printed circuit boards cost of moving the drill and possibly changing drills because of different hole sizes Genome sequencing edges represent likelihood that a fragment of DNA follows another fragment

23 Example tour on circuit board 3,038 points to visit

24 Exact methods for TSP We can find exact solutions with techniques that remember previous partial results and re- use them rather than redoing the work. Techniques from linear programming are applicable here. For example, the optimal tour of 33,810 points on a circuit board was found in 2005 using multiple computers and a total of only 15.7 CPU-years.

25 Approximate solutions Reasonably fast algorithms that guarantee an error bound, i.e., a solution with cost at most c times of the original cost We can achieve c = 1.5 if the costs obey the triangle inequality, i.e., guarantee an error bound with certain probability, typically 97%-98% Based on random walks and Markov chains do not guarantee anything, but are likely to produce a reasonable solution Greedy algorithms d(A, C) ≤ d(A, B) + d(B, C)