32
AMDM UNIT 7: Networks and Graphs Euler Paths and Circuits

AMDM UNIT 7: N etworks and Graphs

  • Upload
    galen

  • View
    151

  • Download
    1

Embed Size (px)

DESCRIPTION

AMDM UNIT 7: N etworks and Graphs. Euler Paths and Circuits. Can You draw this figure without lifting you pencil from the paper?. The original problem. - PowerPoint PPT Presentation

Citation preview

Page 1: AMDM UNIT 7: N etworks and Graphs

AMDM UNIT 7:Networks and Graphs

Euler Paths and Circuits

Page 2: AMDM UNIT 7: N etworks and Graphs

Can You draw this

figure without

lifting you pencil

from the paper?

Page 3: AMDM UNIT 7: N etworks and Graphs

The original problem

A resident of Konigsberg wrote to Leonard Euler saying that a popular pastime for couples was to try to cross each of the seven beautiful bridges in the city exactly once -- without crossing any bridge more than once.

Page 4: AMDM UNIT 7: N etworks and Graphs

It was believed that it was impossible to do – but why? Could Euler explain the reason?

Page 5: AMDM UNIT 7: N etworks and Graphs

The Seven Bridges of Konigsberg

In Konigsberg, Germany, a river ran through the city such that in its center was an island, and after passing the island, the river broke into two parts. Seven bridges were built so that the people of the city could get from one part to another.

Page 6: AMDM UNIT 7: N etworks and Graphs

Konigsberg- in days past.

Page 7: AMDM UNIT 7: N etworks and Graphs

Euler Invents Graph Theory

Euler realized that all problems of this form could be represented by replacing areas of land by points (what we call vertices), and the bridges to and from them by paths.

Page 8: AMDM UNIT 7: N etworks and Graphs

Usually the graph is drawn like this (an isomorphic graph.)

Page 9: AMDM UNIT 7: N etworks and Graphs

The problem now becomes one of drawing this picture without retracing any line and without picking your pencil up off the paper.

Page 10: AMDM UNIT 7: N etworks and Graphs

Euler saw that there were 5 vertices that each had an odd number of lines connected to it. He stated they would either be the beginning or end of his pencil-path.

Page 11: AMDM UNIT 7: N etworks and Graphs

Paths and Circuits

Euler path- a continuous path that passes through every edge once and only once.

Euler circuit- when a Euler path begins and ends at the same vertex

Page 12: AMDM UNIT 7: N etworks and Graphs

Answer Questions 1 and 2 of Unit 7 SAS #1 Use numbered arrows to show the order of

your paths. For example

2 3

4

5

1

6

7

8

Page 13: AMDM UNIT 7: N etworks and Graphs

3. For each graph, decide which have Euler circuits and which do not.

Page 14: AMDM UNIT 7: N etworks and Graphs

Graphs I and III have Euler circuits. Graphs II and IV have Euler paths-a path but the starting and ending points are different.

Page 15: AMDM UNIT 7: N etworks and Graphs

The degree of a vertex is the number edges that meet at the vertex. Determine the degree of Graphs I-IV

Page 16: AMDM UNIT 7: N etworks and Graphs

Graph I:: All vertices have degree of 2Graph II: Staring in the upper left and moving clockwise the degrees are 2,3,2, and 3. The middle vertex has degree of 2.Graph III: Staring in the upper left and moving clockwise the degrees are 2,4,2, and 4. The middle vertex has degree of 2.Graph IV: Staring in the upper left and moving clockwise the degrees are 3,4,2, and 4. The middle vertex has degree of 3.

Page 17: AMDM UNIT 7: N etworks and Graphs

Answer Questions 4 to 6

Page 18: AMDM UNIT 7: N etworks and Graphs

If a graph has any vertices of odd degree, then it can't have any Euler circuit. If a graph is connected and every vertex has an even degree, then it has at least one Euler circuit (usually more).

Euler’s 1st Theorem

Page 19: AMDM UNIT 7: N etworks and Graphs

Euler Circuit?

Page 20: AMDM UNIT 7: N etworks and Graphs

Finding Euler Circuits Algorithm:

If a graph has all even degree vertices, then an Euler Circuit exists. Step One: Randomly move from vertex to

vertex, until stuck. Since all vertices had even degree, the circuit must have stopped at its starting point. (It is a circuit.)

Step Two: If any of the paths have not been included in our circuit, find a path that touches our partial circuit, and add in a new circuit.

Page 21: AMDM UNIT 7: N etworks and Graphs

Each time we add a new circuit, we have included more vertices.

Since there are only a finite number of vertices, eventually the whole graph is included.

Page 22: AMDM UNIT 7: N etworks and Graphs

Use the algorithm to find an Euler circuit.

Start here

Page 23: AMDM UNIT 7: N etworks and Graphs

Use algorithm – all even?

0 1 0 0 1 21 0 1 0 1 10 1 0 1 1 10 0 1 0 0 11 1 1 0 0 02 1 1 1 0 1

A

Page 24: AMDM UNIT 7: N etworks and Graphs

Euler’s 2nd Theorem

If a graph has more than two vertices of odd degree, then it cannot have an Euler path.   If a graph is connected and has exactly two vertices of odd degree, then is has at least one Euler path. Any such path must start at one of the odd degree vertices and must end at the other odd degree vertex.

Page 25: AMDM UNIT 7: N etworks and Graphs

Find the Euler Path

Page 26: AMDM UNIT 7: N etworks and Graphs

A detail

We said that if the number of odd degree vertices

=0, then Euler circuit =2, then path What if =1????

Page 27: AMDM UNIT 7: N etworks and Graphs

A directed graph – Is there an Euler Circuit?

Page 28: AMDM UNIT 7: N etworks and Graphs

Euler for a connected directed graph If at each vertex the number in = number

out, then there is an Euler circuit

If at one vertex number in = number out +1 and at one other vertex number in = number out -1, and all other vertices have number in = number out, then there is an Euler path.

Page 29: AMDM UNIT 7: N etworks and Graphs

Path, circuit, or neither…?

                                         

   

Page 30: AMDM UNIT 7: N etworks and Graphs

Hamilton Circuit

Given a graph, when is there a circuit passing through each vertex exactly one time?

Hard to solve – only general algorithm known is to try each possible path, starting at each vertex in turn.

For there are n! possible trials.nK

Page 31: AMDM UNIT 7: N etworks and Graphs

The Traveling Salesman Problem

A salesman needs to visit n cities and return home. What is the cheapest way to do this?

170340

279459

197

346

Cinn

Atl

Den

Bos

Page 32: AMDM UNIT 7: N etworks and Graphs

TSP

The traveling salesman problem is NP – complete.

Practically, this means that there is no known polynomial-time algorithm to solve the problem – and there is unlikely to be one.