A topic in the Open Knowledge Graph — a free, open map of 15,290 topics and the order to learn them in.

Hamiltonian Circuits and Paths

College Depth 87 in the knowledge graph ☐ I know this ☆ Set as goal
5topics build on this
407prerequisites beneath it
See this on the map →
Graph Paths, Cycles, and ConnectivityEulerian Circuits and Paths+1 more→→Hamiltonian Cycles: Dirac and Ore Conditions
hamiltonian-circuit hamiltonian-path NP-complete traveling-salesman dirac-theorem

Core Idea

A Hamiltonian path visits every vertex exactly once; a Hamiltonian circuit does so and returns to the start. Unlike Eulerian circuits, there is no simple necessary and sufficient characterization of Hamiltonian graphs — determining existence is NP-complete. Sufficient conditions include Dirac's theorem (minimum degree ≥ n/2 implies a Hamiltonian circuit) and Ore's theorem. The traveling salesman problem — find the minimum-cost Hamiltonian circuit in a weighted graph — is one of the most studied problems in combinatorial optimization.

How It's Best Learned

Explore small examples and feel the absence of a clean characterization. Apply Dirac's and Ore's theorems to examples, noting they give only sufficient conditions. Contrast the theoretical intractability with Eulerian circuits to appreciate how similar-sounding problems can have radically different difficulty.

Common Misconceptions

Explainer

You already know Eulerian circuits, which traverse every edge exactly once. Hamiltonian circuits ask the analogous question about vertices: can you visit every vertex exactly once and return to the start? The questions sound nearly identical, but their mathematical difficulty is worlds apart. Eulerian circuits have a clean, checkable characterization: a connected graph has one if and only if every vertex has even degree. Hamiltonian circuits have no such theorem. Whether a given graph has a Hamiltonian circuit is, in general, computationally intractable — it is one of the canonical NP-complete problems.

To feel why the vertex version is harder, consider what makes Eulerian circuits easy: you can always "see" locally whether you're stuck. At any vertex, you just need to avoid cutting off unvisited edges — a condition you can check by looking at degrees. Hamiltonian circuits require global coordination. Choosing the wrong early vertex can trap you in a corner where the remaining vertices can't be reached in sequence, but there's no local signal warning you of this. You have to think about the whole graph simultaneously, which is why exhaustive search seems unavoidable in the worst case.

Dirac's theorem gives one escape hatch: if every vertex in a graph on n ≥ 3 vertices has degree at least n/2, then a Hamiltonian circuit is guaranteed to exist. The intuition is that high minimum degree means every vertex is so well-connected that you can't get trapped — there's always a way forward. Ore's theorem is slightly more general: if every pair of non-adjacent vertices has combined degree at least n, a Hamiltonian circuit exists. Crucially, these are *sufficient* conditions, not necessary ones. A graph can have a Hamiltonian circuit even when neither condition holds. If Dirac's condition fails, you've learned nothing — you must look harder.

The most famous application is the Traveling Salesman Problem (TSP): given a complete weighted graph (cities with road distances), find the minimum-cost Hamiltonian circuit. Every solution visits each city exactly once and returns home — a Hamiltonian circuit — but you want the cheapest one. TSP is studied obsessively because it sits at the intersection of theory (NP-complete, so probably no efficient exact algorithm exists) and practice (delivery routes, circuit board drilling, DNA sequencing all reduce to it). Approximation algorithms, heuristics like nearest-neighbor and 2-opt, and exact branch-and-bound methods give you tools to find good (if not always optimal) solutions for real instances. The Hamiltonian circuit problem is where pure graph theory shakes hands with the hardest problems in computer science.

Practice Questions 5 questions

Prerequisite Chain

Understanding Zero → The Number Zero → Counting to Five → Counting to 10 → Counting to 20 → Counting a Set of Objects Up to 20 → Cardinality: The Last Number Counted → Matching Numerals to Quantities → Subitizing Small Quantities → Addition Within 10 → Number Bonds to 10 → Addition Within 20 → Doubles and Near Doubles → Doubles Facts Within 10 → Near Doubles Facts Within 20 → Mental Math Strategies for Addition → Mental Math: Adding and Subtracting Tens → Addition Within 100 → Repeated Addition as Multiplication → Multiplication as Equal Groups → Multiplication: Arrays → Basic Multiplication Facts (0s, 1s, 2s, 5s, 10s) → Multiplication Facts Within 100 → Division as Equal Sharing → Division as Grouping (Measurement Division) → Division: Grouping (Repeated Subtraction) Model → Division: Fair Sharing Model → Division as Equal Sharing → Division as Grouping → Basic Division Facts → Division Facts Within 100 → Multiplication and Division Fact Families → Relationship Between Multiplication and Division → Division Facts as Inverse of Multiplication → Remainders and Quotients in Division → Division Word Problems → Multi-Step Word Problems → Solving Multi-Step Word Problems → Multiplication Word Problems → Division Word Problems → Introduction to Long Division → Factors and Multiples → Prime and Composite Numbers → Equivalent Fractions → Relating Fractions and Decimals → Decimal Place Value → Integers and the Number Line → Comparing and Ordering Integers → Absolute Value → Adding Integers → Subtracting Integers → Multiplying Integers → Introduction to Exponents → Order of Operations → Integer Order of Operations → Variable Expressions → The Distributive Property → Variables and Expressions Review → Introduction to Polynomials → Adding and Subtracting Polynomials → Multiplying Polynomials → Factorial → Permutations → Combinations → Counting Principles: Addition and Multiplication Rules → Introduction to Graph Theory → Propositional Logic Foundations → Logical Equivalences → Set Operations: Union, Intersection, and Complement → Proof by Cases → Proving by Cases and Exhaustion → Vacuous Truth and Trivial Cases → Proof by Cases (Proof by Exhaustion) → Mathematical Induction → Graph Paths, Cycles, and Connectivity → Trees and Spanning Trees → Planar Graphs and Euler's Formula → Graph Coloring and the Chromatic Number → Graph Coloring and Chromatic Numbers → Bipartite Graphs and Matching Problems → Bipartite Graphs and 2-Colorability → Graph Matching and Hall's Marriage Theorem → Network Flows: Maximum Flow and Minimum Cut → Walks, Trails, Paths, and Cycles in Graphs → Eulerian Paths, Circuits, and Characterization → Euler Paths, Euler Circuits, and Applications → Hamiltonian Paths and Cycles → Hamiltonian Circuits and Paths

Longest path: 88 steps · 407 total prerequisite topics

Prerequisites (3)

Leads To (1)