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.

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

      The length of the support of a Hamiltonian path equals the number of vertices of the graph.

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

      If a path p is Hamiltonian, then p.support.get defines an equivalence between Fin p.support.length and α.

      Equations
      Instances For
        @[simp]
        theorem SimpleGraph.Walk.IsHamiltonian.supportGetEquiv_symm_apply_val {α : Type u_1} [DecidableEq α] {G : SimpleGraph α} {a b : α} {p : G.Walk a b} (hp : p.IsHamiltonian) (a✝ : α) :
        @[simp]
        theorem SimpleGraph.Walk.IsHamiltonian.supportGetEquiv_apply {α : Type u_1} [DecidableEq α] {G : SimpleGraph α} {a b : α} {p : G.Walk a b} (hp : p.IsHamiltonian) (i : Fin p.support.length) :
        def SimpleGraph.Walk.IsHamiltonian.getVertEquiv {α : Type u_1} [DecidableEq α] {G : SimpleGraph α} {a b : α} {p : G.Walk a b} (hp : p.IsHamiltonian) :

        If a path p is Hamiltonian, then p.getVert defines an equivalence between Fin p.support.length and α.

        Equations
        Instances For
          @[simp]
          theorem SimpleGraph.Walk.IsHamiltonian.getVertEquiv_apply {α : Type u_1} [DecidableEq α] {G : SimpleGraph α} {a b : α} {p : G.Walk a b} (hp : p.IsHamiltonian) (a✝ : Fin p.support.length) :
          hp.getVertEquiv a✝ = (p.getVert Fin.val) a✝
          @[simp]
          theorem SimpleGraph.Walk.IsHamiltonian.getVertEquiv_symm_apply {α : Type u_1} [DecidableEq α] {G : SimpleGraph α} {a b : α} {p : G.Walk a b} (hp : p.IsHamiltonian) (a✝ : α) :
          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) :