CSC165 ยท 2076 ยท 5 marks
Define Euler path and Hamilton path. Give examples of both Euler and Hamilton path.
Define Euler path and Hamilton path. Give examples of both Euler and Hamilton path. [5]
Quick answer
Consider a graph with vertices: A, B, C, D and edges: A-B, A-C, B-C, B-D, C-D
Euler Path and Hamilton Path
Euler Path
Definition: An Euler path (also called an Eulerian trail) is a path in a graph that traverses every edge exactly once. The initial and terminal vertices of the path need not be the same. If the initial and terminal vertices are the same, it is called an Euler circuit.
Condition for Euler Path: A connected graph has an Eulerian trail if and only if it has exactly two vertices of odd degree. The path must start at one odd-degree vertex and end at the other.
Example of Euler Path:
A --- B
| / |
| / |
C --- D
Here deg(A) = 2, deg(B) = 3, deg(C) = 3 and deg(D) = 2, so exactly two vertices, B and C, have odd degree. An Euler path therefore exists, and it has to start at one odd vertex and finish at the other:
B โ A โ C โ D โ B โ C
This walk uses the edges A-B, A-C, C-D, B-D and B-C, that is all five edges of the graph, each exactly once. Because two vertices have odd degree the walk cannot come back to where it started, so this graph has an Euler path but no Euler circuit.
Hamilton Path
Definition: A Hamiltonian path is a simple path that contains all vertices of a graph G exactly once. Unlike the Euler path, it focuses on visiting every vertex exactly once rather than every edge. If the path returns to the starting vertex, it is called a Hamiltonian cycle.
Note: There is no simple necessary and sufficient condition (like for Euler path) to determine the existence of a Hamiltonian path.
Example of Hamilton Path:
Consider a graph with vertices: 1, 2, 3, 4, 5 and edges connecting them as a cycle with some additional edges.
1 - 2 - 3 - 4 - 5
The path 1 โ 2 โ 3 โ 4 โ 5 visits every vertex exactly once. This is a Hamiltonian path.
Comparison Table
| Term | Initial and Terminal Vertex Same | Must Include Every Edge | Must Include Every Vertex | Repeated Vertices Allowed |
|---|---|---|---|---|
| Euler Circuit | Yes | Yes | Not required | Yes |
| Euler Path | No | Yes | Not required | Yes |
| Hamilton Cycle | Yes | No | Yes | No |
| Hamilton Path | No | No | Yes | No |
Key Difference
- Euler Path is concerned with covering every edge exactly once.
- Hamilton Path is concerned with visiting every vertex exactly once.
Short on time? The 1, 5 and 10 mark versions of this answer, flashcards and practice sets come with a program pass.