LearnViz CompSci
Home / Learn / Theory & Discrete Math / Euler and Hamilton Paths

Beginner Topic 13 of 51 Theory & Discrete Math

Euler and Hamilton Paths

Traversals covering every edge or every vertex once.

How it works

An Euler path traverses every edge of a graph exactly once, and an Euler circuit does so returning to the start. A connected undirected graph has an Euler circuit if and only if every vertex has even degree, and an Euler path if exactly zero or two vertices have odd degree. A Hamilton path visits every vertex exactly once, and a Hamilton cycle returns to the start; no simple characterization is known, and finding one is NP-complete.

Step-by-step walkthrough

  1. An Euler path uses every edge exactly once.
  2. It exists if zero or two vertices have odd degree.
  3. A Hamilton path visits every vertex exactly once.
  4. Checking Euler is easy, finding a Hamilton path is NP-complete.
  5. The Seven Bridges of Konigsberg led to graph theory.

Where it is used

Euler paths solve route planning problems such as street sweeping, mail delivery and DNA fragment assembly, and Hamiltonian problems underlie the traveling salesman problem and scheduling puzzles.

Common pitfall

Mixing up the two, edges versus vertices, is the classic mistake. Euler's criterion is easy to check in linear time, while Hamiltonicity has only sufficient conditions such as Dirac's and Ore's theorems. Directed graphs use in-degree equals out-degree conditions. Remember that the graph must be connected apart from isolated vertices.

Where it fits in the course

Euler and Hamilton Paths is topic 13 of 51 in Theory & Discrete Math, rated Beginner. It follows Trees in Graph Theory. The next topic is Graph Coloring.

Practice and explore

How to study this topic

  1. Read the explanation above and restate the definition in your own words.
  2. Open the interactive lesson and answer its mini quiz.
  3. Read the common pitfall, then write a short example that avoids it.
  4. Check your understanding in the Theory & Discrete Math quiz, and revisit the topic if you miss a question.

Frequently asked questions

What is Euler and Hamilton Paths?
Traversals covering every edge or every vertex once. It belongs to Theory & Discrete Math and is a beginner-level topic.
Where do people use Euler and Hamilton Paths?
Euler paths solve route planning problems such as street sweeping, mail delivery and DNA fragment assembly, and Hamiltonian problems underlie the traveling salesman problem and scheduling puzzles.
What is the most common mistake with Euler and Hamilton Paths?
Mixing up the two, edges versus vertices, is the classic mistake.
What should I learn before this topic?
Start with Trees in Graph Theory, the topic just before it in Theory & Discrete Math.
How can I practice it?
Answer the mini quiz in the interactive lesson, then take the Theory & Discrete Math quiz.
Is Euler and Hamilton Paths hard to learn?
It is a Beginner topic, so it works as an entry point. If the terms are new, read the explanation twice and try the visualizer before the quiz.
How long does it take to learn Euler and Hamilton Paths?
Most learners can read the explanation and finish the interactive lesson in under an hour. Fluency comes from applying the idea, so plan a few short practice sessions with the quiz.
Which topics are related to Euler and Hamilton Paths?
Trees in Graph Theory, Graph Coloring, Graph Theory Basics are closely connected. The full list is in the related topics section of this page.
What should I study after Euler and Hamilton Paths?
Continue with Graph Coloring, the next topic in Theory & Discrete Math.

Related topics