Euler Path & Circuit
Euler Path & Circuit
An Euler path is a path that uses every edge of a graph exactly once. An Euler circuit is a circuit that uses every edge of a graph exactly once.
An Euler path starts and ends at dierent vertices. An Euler circuit starts and ends at the same vertex.
B A C A
B A C A
B A C A
B A C A
Is it possible to determine whether a graph has an Euler path or an Euler circuit, without necessarily having to nd one explicitly?
Then P leaves x one more time than it enters, and leaves y one fewer time than it enters.
Then P leaves x one more time than it enters, and leaves y one fewer time than it enters.
Odd vertices
6 2
8
Number of odd vertices
6 8
* Provided the graph is connected. Next question: If an Euler path or circuit exists, how do you nd it?
Bridges
Removing a single edge from a connected graph can make it disconnected. Such an edge is called a bridge.
Bridges
Removing a single edge from a connected graph can make it disconnected. Such an edge is called a bridge.
Bridges
Removing a single edge from a connected graph can make it disconnected. Such an edge is called a bridge.
Bridges
Loops cannot be bridges, because removing a loop from a graph cannot make it disconnected.
e delete loop e
Bridges
If two or more edges share both endpoints, then removing any one of them cannot make the graph disconnected. Therefore, none of those edges is a bridge.
A B
Bridges
If two or more edges share both endpoints, then removing any one of them cannot make the graph disconnected. Therefore, none of those edges is a bridge.
A B
B A C E
D F
B A C E
D F
B A C E
D F
B A C E
D F
B A C E
D F
B A C E
D F
B A C E
D F
But now, crossing the edge BA would be a mistake, because we would be stuck there.
But now, crossing the edge BA would be a mistake, because we would be stuck there.
The reason is that BA is a bridge. We dont want to cross (burn?) a bridge unless it is the only edge available.
B A C E
D F
B A C E
D F
B A C E
D F
B A C E
D F
B A C E
D F
B A C E
D F
B A C E
D F
B A C E
D F
B A C E
D F
B A C E
D F
Fleurys Algorithm
To nd an Euler path or an Euler circuit:
Fleurys Algorithm
To nd an Euler path or an Euler circuit: 1. Make sure the graph has either 0 or 2 odd vertices.
Fleurys Algorithm
To nd an Euler path or an Euler circuit: 1. Make sure the graph has either 0 or 2 odd vertices. 2. If there are 0 odd vertices, start anywhere. If there are 2 odd vertices, start at one of them.
Fleurys Algorithm
To nd an Euler path or an Euler circuit: 1. Make sure the graph has either 0 or 2 odd vertices. 2. If there are 0 odd vertices, start anywhere. If there are 2 odd vertices, start at one of them. 3. Follow edges one at a time. If you have a choice between a bridge and a non-bridge, always choose the non-bridge.
Fleurys Algorithm
To nd an Euler path or an Euler circuit: 1. Make sure the graph has either 0 or 2 odd vertices. 2. If there are 0 odd vertices, start anywhere. If there are 2 odd vertices, start at one of them. 3. Follow edges one at a time. If you have a choice between a bridge and a non-bridge, always choose the non-bridge. 4. Stop when you run out of edges.
Fleurys Algorithm
To nd an Euler path or an Euler circuit: 1. Make sure the graph has either 0 or 2 odd vertices. 2. If there are 0 odd vertices, start anywhere. If there are 2 odd vertices, start at one of them. 3. Follow edges one at a time. If you have a choice between a bridge and a non-bridge, always choose the non-bridge. 4. Stop when you run out of edges. This is called Fleurys algorithm, and it always works!
B F
C G L