Hamiltonian Graphs #
In this file we introduce Hamiltonian paths, cycles and graphs.
Main definitions #
SimpleGraph.Walk.IsHamiltonian: Predicate for a walk to be Hamiltonian.SimpleGraph.Walk.IsHamiltonianCycle: Predicate for a walk to be a Hamiltonian cycle.SimpleGraph.IsHamiltonian: Predicate for a graph to be Hamiltonian.
A Hamiltonian path is a walk p that visits every vertex exactly once. Note that while
this definition doesn't contain that p is a path, p.isPath gives that.
Equations
- p.IsHamiltonian = ∀ (a_1 : α), List.count a_1 p.support = 1
Instances For
A Hamiltonian path visits every vertex.
Hamiltonian paths are paths.
A path whose support contains every vertex is Hamiltonian.
If a path p is Hamiltonian then the graph has finitely many vertices.
Instances For
If a path p is Hamiltonian then the graph has finitely many vertices.
The support of a Hamiltonian walk is the entire vertex set.
Alias of SimpleGraph.Walk.IsHamiltonian.toFinset_support.
The support of a Hamiltonian walk is the entire vertex set.
The length of a Hamiltonian path is one less than the number of vertices of the graph.
The length of the support of a Hamiltonian path equals the number of vertices of the graph.
If a path p is Hamiltonian, then p.support.get defines an equivalence between
Fin p.support.length and α.
Equations
Instances For
If a path p is Hamiltonian, then p.getVert defines an equivalence between
Fin p.support.length and α.
Equations
- hp.getVertEquiv = { toFun := p.getVert ∘ Fin.val, invFun := hp.supportGetEquiv.invFun, left_inv := ⋯, right_inv := ⋯ }
Instances For
A Hamiltonian cycle is a cycle that visits every vertex once.
- edges_nodup : p.edges.Nodup
- isHamiltonian_tail : p.tail.IsHamiltonian
Instances For
If a cycle p is Hamiltonian then the graph has finitely many vertices.
A Hamiltonian cycle visits every vertex.
The length of a Hamiltonian cycle is the number of vertices.
Alias of the forward direction of SimpleGraph.Walk.isHamiltonianCycle_rotate.
Alias of the reverse direction of SimpleGraph.Walk.isHamiltonianCycle_rotate.
A Hamiltonian graph is a graph that contains a Hamiltonian cycle.
This is equivalent to there being an Hamiltonian cycle based at each vertex.
See IsHamiltonian.exists_isHamiltonianCycle.
By convention, the singleton graph is considered to be Hamiltonian and the empty graph is not.
Equations
- G.IsHamiltonian = (Fintype.card α ≠ 1 → ∃ (a : α) (p : G.Walk a a), p.IsHamiltonianCycle)
Instances For
A finite simple graph with a bridge is not hamiltonian.