Documentation

Mathlib.Combinatorics.SimpleGraph.Hamiltonian

Hamiltonian Graphs #

In this file we introduce Hamiltonian paths, cycles and graphs.

Main definitions #

def SimpleGraph.Walk.IsHamiltonian {α : Type u_1} [DecidableEq α] {G : SimpleGraph α} {a b : α} (p : G.Walk a b) :

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
Instances For
    theorem SimpleGraph.Walk.IsHamiltonian.map {α : Type u_1} {β : Type u_2} [DecidableEq α] [DecidableEq β] {G : SimpleGraph α} {a b : α} {p : G.Walk a b} {H : SimpleGraph β} (f : G →g H) (hf : Function.Bijective f) (hp : p.IsHamiltonian) :
    @[simp]
    theorem SimpleGraph.Walk.IsHamiltonian.mem_support {α : Type u_1} [DecidableEq α] {G : SimpleGraph α} {a b : α} {p : G.Walk a b} (hp : p.IsHamiltonian) (c : α) :

    A Hamiltonian path visits every vertex.

    theorem SimpleGraph.Walk.IsHamiltonian.isPath {α : Type u_1} [DecidableEq α] {G : SimpleGraph α} {a b : α} {p : G.Walk a b} (hp : p.IsHamiltonian) :

    Hamiltonian paths are paths.

    theorem SimpleGraph.Walk.IsPath.isHamiltonian_of_mem {α : Type u_1} [DecidableEq α] {G : SimpleGraph α} {a b : α} {p : G.Walk a b} (hp : p.IsPath) (hp' : ∀ (w : α), w p.support) :

    A path whose support contains every vertex is Hamiltonian.

    theorem SimpleGraph.Walk.IsPath.isHamiltonian_iff {α : Type u_1} [DecidableEq α] {G : SimpleGraph α} {a b : α} {p : G.Walk a b} (hp : p.IsPath) :
    p.IsHamiltonian ∀ (w : α), w p.support
    def SimpleGraph.Walk.IsHamiltonian.fintype {α : Type u_1} [DecidableEq α] {G : SimpleGraph α} {a b : α} {p : G.Walk a b} (hp : p.IsHamiltonian) :

    If a path p is Hamiltonian then its vertex set must be finite.

    Equations
    Instances For
      theorem SimpleGraph.Walk.IsHamiltonian.support_toFinset {α : Type u_1} [DecidableEq α] {G : SimpleGraph α} {a b : α} {p : G.Walk a b} [Fintype α] (hp : p.IsHamiltonian) :

      The support of a Hamiltonian walk is the entire vertex set.

      theorem SimpleGraph.Walk.IsHamiltonian.length_eq {α : Type u_1} [DecidableEq α] {G : SimpleGraph α} {a b : α} {p : G.Walk a b} [Fintype α] (hp : p.IsHamiltonian) :

      The length of a Hamiltonian path is one less than the number of vertices of the graph.

      structure SimpleGraph.Walk.IsHamiltonianCycle {α : Type u_1} [DecidableEq α] {G : SimpleGraph α} {a : α} (p : G.Walk a a) extends p.IsCycle :

      A Hamiltonian cycle is a cycle that visits every vertex once.

      Instances For
        theorem SimpleGraph.Walk.IsHamiltonianCycle.isCycle {α : Type u_1} [DecidableEq α] {G : SimpleGraph α} {a : α} {p : G.Walk a a} (hp : p.IsHamiltonianCycle) :
        theorem SimpleGraph.Walk.IsHamiltonianCycle.map {α : Type u_1} {β : Type u_2} [DecidableEq α] [DecidableEq β] {G : SimpleGraph α} {a : α} {p : G.Walk a a} {H : SimpleGraph β} (f : G →g H) (hf : Function.Bijective f) (hp : p.IsHamiltonianCycle) :
        theorem SimpleGraph.Walk.IsHamiltonianCycle.mem_support {α : Type u_1} [DecidableEq α] {G : SimpleGraph α} {a : α} {p : G.Walk a a} (hp : p.IsHamiltonianCycle) (b : α) :

        A Hamiltonian cycle visits every vertex.

        theorem SimpleGraph.Walk.IsHamiltonianCycle.length_eq {α : Type u_1} [DecidableEq α] {G : SimpleGraph α} {a : α} {p : G.Walk a a} [Fintype α] (hp : p.IsHamiltonianCycle) :

        The length of a Hamiltonian cycle is the number of vertices.

        theorem SimpleGraph.Walk.IsHamiltonianCycle.support_count_of_ne {α : Type u_1} [DecidableEq α] {G : SimpleGraph α} {a b : α} {p : G.Walk a a} (hp : p.IsHamiltonianCycle) (h : a b) :

        A Hamiltonian graph is a graph that contains a Hamiltonian cycle.

        By convention, the singleton graph is considered to be Hamiltonian.

        Equations
        Instances For
          theorem SimpleGraph.IsHamiltonian.mono {α : Type u_1} [DecidableEq α] {G : SimpleGraph α} [Fintype α] {H : SimpleGraph α} (hGH : G H) (hG : G.IsHamiltonian) :