graph theory - new mexico state universitysierra.nmsu.edu/morandi/oldwebpages... · graph theory...

29
Graph Theory 7 April 2014 Graph Theory 7 April 2014 1/30

Upload: doandung

Post on 21-Apr-2018

222 views

Category:

Documents


7 download

TRANSCRIPT

Graph Theory

7 April 2014

Graph Theory 7 April 2014 1/30

Graph theory was invented by a mathematician named Euler in the18th century. We will see some of the problems which motivated itsstudy. However, it wasn’t studied too systematically until the latterhalf of the 20th century. Computer Science applications have drivenits development, since many CS problems are naturally modeled viagraphs.

The first problem we’ll look at is the historical motivation of thesubject, the Seven Bridges of Konigsburg problem.

Graph Theory 7 April 2014 2/30

Leonard Euler

Graph Theory 7 April 2014 3/30

Leonard Euler (pronounced Oiler) was a Swiss mathematician of the18th century. He was extremely prolific, and his work influenced manyareas of mathematics. He spent most of his career in St. Petersburgand Berlin. Besides graph theory, he contributed to number theory,including proving his generalization of Fermat’s little theorem used inRSA encryption, and came up with the formula

eπi + 1 = 0

relating the irrational number π and the imaginary number i .

Graph Theory 7 April 2014 4/30

Seven Bridges of Konigsburg

The origin of graph theory was the following problem. In the city ofKonigsburg, in present day Lithuania, there are seven bridges passingover the river connecting various parts of the city.

The following picture shows the city and its bridges.

Graph Theory 7 April 2014 5/30

Konigsburg

Graph Theory 7 April 2014 6/30

Another Picture of the Seven Bridges

Graph Theory 7 April 2014 7/30

The problem, possibly originating from people strolling around thecity, is this: Is it possible to cross each bridge exactly once and endup 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 samething on the second picture below. If you cannot, try to think aboutwhether it is because you aren’t trying hard enough or if it looks to beimpossible.

Graph Theory 7 April 2014 8/30

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 7 April 2014 9/30

Answer

If you didn’t find a path for the left picture, don’t feel bad. We’ll seethat it is impossible.

For the right picture there is a path that crosses each bridge exactlyonce. For example, here is a path starting on the north shore andending on the east island.

It is not possible to do this while starting and ending on the sameland mass. We’ll explore why.

Graph Theory 7 April 2014 10/30

Euler solved this problem by representing the situation as a structurewhich we now call a graph. This use of the term graph is differentthan that occurring in algebra.

We will illustrate how Euler used graph theory to solve the 7 bridgesproblem. We will also address other problems which can be solved bythe use of graph theory.

Graph Theory 7 April 2014 11/30

What is a Graph?

A graph consists of a bunch of points, usually called vertices. Some ofthe vertices are connected to each other. When a vertex is connectedto another, that connection is called an edge. We can draw edges asstraight line segments or curves.

Here are some examples of graphs.

Graph Theory 7 April 2014 12/30

Graph Theory 7 April 2014 13/30

Graph Theory 7 April 2014 14/30

The first two graphs look different, but they represent the sameinformation. Both have the top three vertices connected to each of thethree bottom vertices. That the edges in the left figure sometimes aredrawn with straight lines and sometimes with curves does not matter. Nordoes it matter where the vertices are positioned.

Graph Theory 7 April 2014 15/30

Euler represented the 7 bridges problem as a graph in the followingway. Each land mass was represented as a vertex. Two vertices areconnected by an edge if the corresponding land masses are connectedby a bridge.

The graph representing the situation is shown on the next slide. Aswe have indicated, the shape of the edges is irrelevant. Only whatmatters are which vertices are connected.

Since there are 4 land masses, there are 4 vertices. The 7 bridgescorrespond to 7 edges.

Graph Theory 7 April 2014 16/30

Graph of the 7 Bridges of Konigsburg

Graph Theory 7 April 2014 17/30

Graph of the 8 Bridges of Who-ville

Graph Theory 7 April 2014 18/30

A path on a graph is a journey through various vertices, where youcan go from one to another as long as there is an edge connectingthem. A circuit is a path which returns to the starting point.

This idea comes from the original motivation for graphs. A path inthe 7 bridges graph can be though of as a walk across various bridges.

Graph Theory 7 April 2014 19/30

In honor of Euler’s work, we call a path which crosses each edgeexactly once an Euler path.

If the Euler path starts and ends at the same vertex, then it is calledan Euler circuit.

Besides this problem, a reason for wanting to consider such paths isto minimize driving. A UPS truck wants to make deliveries asefficiently as possible, so doesn’t want to repeat driving down a streetif it is not necessary.

In terms of graph theory, the 7 bridges problem is then: Is there anEuler circuit (or Euler path) on the graph representing Konigsburg?

Graph Theory 7 April 2014 20/30

Some More Examples

Before we see how Euler solved the problem, here are some moreexamples to try.

Can you trace a path over each of these figures without lifting yourpencil or retracing any line segments?

Graph Theory 7 April 2014 21/30

Clicker Question

Try to trace each of the first three figures in the top row withoutlifting your pencil (or finger) or retracing a line segment. Enter howmany of the three you succeeded in doing this.

Graph Theory 7 April 2014 22/30

The pictures with the green checkmark can be traced as desired, the oneswith the red x cannot.

In the top row the second and fourth can be traced but not starting andending at the same point. The same is true for the fourth picture in thebottom row.

Graph Theory 7 April 2014 23/30

Euler’s Solution of the 7 Bridges Problem

Euler discovered that, in order to have an Euler circuit, the number ofedges 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 edgesconnected to it. If two have an odd number of edges, those couldonly be the start and the end of the path.

Graph Theory 7 April 2014 24/30

The graph to the left has an Euler circuit. The one to the right doesnot, but it does have an Euler path, when one starts at the top leftvertex and finishes at the top right.

Graph Theory 7 April 2014 25/30

Roughly, Euler reasoned that if there was an Euler path or circuit,then for any vertex other than the start or finish, each time youreached the vertex, you need two edges, one to get there and one toget away. The number of edges connected to the vertex is then twicethe number of times you cross the vertex, and so is an even number.

Graph Theory 7 April 2014 26/30

Since the 7 bridges graph has 3 vertices with an odd number of edgesconnected to them, there is no Euler path or Euler circuit.

Thus, it is impossible to walk across each of the 7 bridges exactlyonce.

Graph Theory 7 April 2014 27/30

For the 8 Bridges of Who-ville, two vertices have an even number of edgesconnected to them. The other two, the north land and east island, have anodd number. We can then start at the north and end at the east island, orvice-versa, and do an Euler path.

Graph Theory 7 April 2014 28/30

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 neededto color a map so that any two regions which share a border have differentcolors.

Graph Theory 7 April 2014 29/30