Graph Theory 26 March 2012 Graph Theory 26 March 2012 1/29
Graph theory was invented by a mathematician named Euler in the 18th century. We will see some of the problems which motivated its study. However, it wasn t studied too systematically until the latter half of the 20th century. Computer Science applications have driven its development, since many CS problems are naturally modeled via graphs. Graph Theory 26 March 2012 2/29
Graph theory was invented by a mathematician named Euler in the 18th century. We will see some of the problems which motivated its study. However, it wasn t studied too systematically until the latter half of the 20th century. Computer Science applications have driven its development, since many CS problems are naturally modeled via graphs. The first problem we ll look at is the historical motivation of the subject, the Seven Bridges of Königsburg problem. Graph Theory 26 March 2012 2/29
Leonard Euler Graph Theory 26 March 2012 3/29
Leonard Euler (pronounced Oiler) was a Swiss mathematician of the 18th century. He was extremely prolific, and his work influenced many areas of mathematics. He spent most of his career in St. Petersburg and Berlin. Besides graph theory, he contributed to number theory, including proving his generalization of Fermat s little theorem used in RSA encryption, and came up with the formula e πi + 1 = 0 relating the irrational number π and the imaginary number i. Graph Theory 26 March 2012 4/29
Leonard Euler (pronounced Oiler) was a Swiss mathematician of the 18th century. He was extremely prolific, and his work influenced many areas of mathematics. He spent most of his career in St. Petersburg and Berlin. Besides graph theory, he contributed to number theory, including proving his generalization of Fermat s little theorem used in RSA encryption, and came up with the formula e πi + 1 = 0 relating the irrational number π and the imaginary number i. Graph Theory 26 March 2012 4/29
Seven Bridges of Königsburg The origin of graph theory was the following problem. In the city of Königsburg, in present day Lithuania, there are seven bridges passing over the river connecting various parts of the city. Graph Theory 26 March 2012 5/29
Seven Bridges of Königsburg The origin of graph theory was the following problem. In the city of Königsburg, in present day Lithuania, there are seven bridges passing over the river connecting various parts of the city. The following picture shows the city and its bridges. Graph Theory 26 March 2012 5/29
Königsburg Graph Theory 26 March 2012 6/29
Another Picture of the Seven Bridges Graph Theory 26 March 2012 7/29
The problem, possibly originating from people strolling around the city, is this: Is it possible to cross each bridge exactly once and end up where you started? Graph Theory 26 March 2012 8/29
The problem, possibly originating from people strolling around the city, is this: Is it possible to cross each bridge exactly once and end up where you started? A variation is to ask: Is it possible to cross each bridge exactly once, regardless of where you start and end? Graph Theory 26 March 2012 8/29
The problem, possibly originating from people strolling around the city, is this: Is it possible to cross each bridge exactly once and end up where you started? A variation is to ask: Is it possible to cross each bridge exactly once, regardless of where you start and end? Try to find a way to cross each bridge exactly once. Also try the same thing on the second picture below. If you cannot, try to think about whether it is because you aren t trying hard enough or if it looks to be impossible. Graph Theory 26 March 2012 8/29
Can you Find a Path to Cross Each Bridge Exactly Once? A Found a path for both pictures B Found a path for just the left picture C Found a path for just the right picture D Didn t find a path for either Graph Theory 26 March 2012 9/29
Answer If you didn t find a path for the left picture, don t feel bad. We ll see that it is impossible. Graph Theory 26 March 2012 10/29
Answer If you didn t find a path for the left picture, don t feel bad. We ll see that it is impossible. For the right picture there is a path that crosses each bridge exactly once. For example, here is a path starting on the north shore and ending on the east island. Graph Theory 26 March 2012 10/29
Answer If you didn t find a path for the left picture, don t feel bad. We ll see that it is impossible. For the right picture there is a path that crosses each bridge exactly once. For example, here is a path starting on the north shore and ending on the east island. It is not possible to do this while starting and ending on the same land mass. We ll explore why. Graph Theory 26 March 2012 10/29
Euler solved this problem by representing the situation as a structure which we now call a graph. This use of the term graph is different than that occurring in algebra. Graph Theory 26 March 2012 11/29
Euler solved this problem by representing the situation as a structure which we now call a graph. This use of the term graph is different than that occurring in algebra. We will illustrate how Euler used graph theory to solve the 7 bridges problem. We will also address other problems which can be solved by the use of graph theory. Graph Theory 26 March 2012 11/29
What is a Graph? A graph consists of a bunch of points, usually called vertices. Some of the vertices are connected to each other. When a vertex is connected to another, that connection is called an edge. We can draw edges as straight line segments or curves. Graph Theory 26 March 2012 12/29
What is a Graph? A graph consists of a bunch of points, usually called vertices. Some of the vertices are connected to each other. When a vertex is connected to another, that connection is called an edge. We can draw edges as straight line segments or curves. Here are some examples of graphs. Graph Theory 26 March 2012 12/29
Graph Theory 26 March 2012 13/29
Graph Theory 26 March 2012 13/29
Graph Theory 26 March 2012 14/29
Graph Theory 26 March 2012 14/29
The first two graphs look different, but they represent the same information. Both have the top three vertices connected to each of the three bottom vertices. That the edges in the left figure sometimes are drawn with straight lines and sometimes with curves does not matter. Nor does it matter where the vertices are positioned. Graph Theory 26 March 2012 15/29
Euler represented the 7 bridges problem as a graph in the following way. Each land mass was represented as a vertex. Two vertices are connected by an edge if the corresponding land masses are connected by a bridge. Graph Theory 26 March 2012 16/29
Euler represented the 7 bridges problem as a graph in the following way. Each land mass was represented as a vertex. Two vertices are connected by an edge if the corresponding land masses are connected by a bridge. The graph representing the situation is shown on the next slide. As we have indicated, the shape of the edges is irrelevant. Only what matters are which vertices are connected. Graph Theory 26 March 2012 16/29
Euler represented the 7 bridges problem as a graph in the following way. Each land mass was represented as a vertex. Two vertices are connected by an edge if the corresponding land masses are connected by a bridge. The graph representing the situation is shown on the next slide. As we have indicated, the shape of the edges is irrelevant. Only what matters are which vertices are connected. Since there are 4 land masses, there are 4 vertices. The 7 bridges correspond to 7 edges. Graph Theory 26 March 2012 16/29
Graph of the 7 Bridges of Königsburg Graph Theory 26 March 2012 17/29
Graph of the 8 Bridges of Who-ville Graph Theory 26 March 2012 18/29
A path on a graph is a journey through various vertices, where you can go from one to another as long as there is an edge connecting them. A circuit is a path which returns to the starting point. Graph Theory 26 March 2012 19/29
A path on a graph is a journey through various vertices, where you can go from one to another as long as there is an edge connecting them. A circuit is a path which returns to the starting point. This idea comes from the original motivation for graphs. A path in the 7 bridges graph can be though of as a walk across various bridges. Graph Theory 26 March 2012 19/29
In honor of Euler s work, we call a path which crosses each edge exactly once an Euler path. Graph Theory 26 March 2012 20/29
In honor of Euler s work, we call a path which crosses each edge exactly once an Euler path. If the Euler path starts and ends at the same vertex, then it is called an Euler circuit. Graph Theory 26 March 2012 20/29
In honor of Euler s work, we call a path which crosses each edge exactly once an Euler path. If the Euler path starts and ends at the same vertex, then it is called an Euler circuit. Besides this problem, a reason for wanting to consider such paths is to minimize driving. A UPS truck wants to make deliveries as efficiently as possible, so doesn t want to repeat driving down a street if it is not necessary. Graph Theory 26 March 2012 20/29
In honor of Euler s work, we call a path which crosses each edge exactly once an Euler path. If the Euler path starts and ends at the same vertex, then it is called an Euler circuit. Besides this problem, a reason for wanting to consider such paths is to minimize driving. A UPS truck wants to make deliveries as efficiently as possible, so doesn t want to repeat driving down a street if it is not necessary. In terms of graph theory, the 7 bridges problem is then: Is there an Euler circuit (or Euler path) on the graph representing Königsburg? Graph Theory 26 March 2012 20/29
Some More Examples Before we see how Euler solved the problem, here are some more examples to try. Graph Theory 26 March 2012 21/29
Some More Examples Before we see how Euler solved the problem, here are some more examples to try. Can you trace a path over each of these figures without lifting your pencil or retracing any line segments? Graph Theory 26 March 2012 21/29
The pictures with the green checkmark can be traced as desired, the ones with the red x cannot. In the top row the second and fourth can be traced but not starting and ending at the same point. The same is true for the fourth picture in the bottom row. Graph Theory 26 March 2012 22/29
Euler s Solution of the 7 Bridges Problem Euler discovered that, in order to have an Euler circuit, the number of edges connected to each vertex must be even. Graph Theory 26 March 2012 23/29
Euler s Solution of the 7 Bridges Problem Euler discovered that, in order to have an Euler circuit, the number of edges connected to each vertex must be even. He also saw that in order to have an Euler path, every vertex, except for at most two, must have an even number of edges connected to it. If two have an odd number of edges, those could be the start and the end of the path. Graph Theory 26 March 2012 23/29
The graph to the left has an Euler circuit. The one to the right does not, but it does have an Euler path, when one starts at the top left vertex and finishes at the top right. Graph Theory 26 March 2012 24/29
Roughly, Euler reasoned that if there was an Euler path or circuit, then for any vertex other than the start or finish, each time you reached the vertex, you need two edges, one to get there and one to get away. The number of edges connected to the vertex is then twice the number of times you cross the vertex, and so is an even number. Graph Theory 26 March 2012 25/29
Since the 7 bridges graph has 3 vertices with an odd number of edges connected to them, there is no Euler path or Euler circuit. Graph Theory 26 March 2012 26/29
Since the 7 bridges graph has 3 vertices with an odd number of edges connected to them, there is no Euler path or Euler circuit. Thus, it is impossible to walk across each of the 7 bridges exactly once. Graph Theory 26 March 2012 26/29
For the 8 Bridges of Who-ville, two vertices have an even number of edges connected to them. The other two, the north land and east island, have an odd number. We can then start at the north and end at the east island, or vice-versa, and do an Euler path. Graph Theory 26 March 2012 27/29
Next Time We ll apply graph theory to the problem of coloring maps. In particular, we ll address the question of what is the smallest number of colors needed to color a map so that any two regions which share a border have different colors. Graph Theory 26 March 2012 28/29
Quiz Question With the graph above, is there a path that crosses each edge exactly once (whether or not you end at the same vertex as you started)? A Yes B No Graph Theory 26 March 2012 29/29