Documentation

Mathlib.Combinatorics.SimpleGraph.Walks.Traversal

Traversing walks #

Functions that help access different parts of a walk.

Main definitions #

Tags #

walks

def SimpleGraph.Walk.getVert {V : Type u} {G : SimpleGraph V} {u v : V} :
G.Walk u vV

Get the nth vertex from a walk, where n is generally expected to be between 0 and p.length, inclusive. If n is greater than or equal to p.length, the result is the path's endpoint.

Equations
    Instances For
      @[simp]
      theorem SimpleGraph.Walk.getVert_zero {V : Type u} {G : SimpleGraph V} {u v : V} (w : G.Walk u v) :
      w.getVert 0 = u
      @[simp]
      theorem SimpleGraph.Walk.getVert_nil {V : Type u} {G : SimpleGraph V} (u : V) {i : } :
      theorem SimpleGraph.Walk.getVert_of_length_le {V : Type u} {G : SimpleGraph V} {u v : V} (w : G.Walk u v) {i : } (hi : w.length i) :
      w.getVert i = v
      @[simp]
      theorem SimpleGraph.Walk.getVert_length {V : Type u} {G : SimpleGraph V} {u v : V} (w : G.Walk u v) :
      theorem SimpleGraph.Walk.adj_getVert_succ {V : Type u} {G : SimpleGraph V} {u v : V} (w : G.Walk u v) {i : } (hi : i < w.length) :
      G.Adj (w.getVert i) (w.getVert (i + 1))
      @[simp]
      theorem SimpleGraph.Walk.getVert_cons_succ {V : Type u} {G : SimpleGraph V} {u v w : V} {n : } (p : G.Walk v w) (h : G.Adj u v) :
      (cons h p).getVert (n + 1) = p.getVert n
      theorem SimpleGraph.Walk.getVert_cons {V : Type u} {G : SimpleGraph V} {u v w : V} {n : } (p : G.Walk v w) (h : G.Adj u v) (hn : n 0) :
      (cons h p).getVert n = p.getVert (n - 1)
      @[simp]
      theorem SimpleGraph.Walk.getVert_mem_support {V : Type u} {G : SimpleGraph V} {u v : V} (p : G.Walk u v) (i : ) :
      @[irreducible]
      theorem SimpleGraph.Walk.getVert_eq_support_getElem {V : Type u} {G : SimpleGraph V} {u v : V} {n : } (p : G.Walk u v) (h : n p.length) :

      Use support_getElem_eq_getVert to rewrite in the reverse direction.

      theorem SimpleGraph.Walk.support_getElem_eq_getVert {V : Type u} {G : SimpleGraph V} {u v : V} {n : } (p : G.Walk u v) (h : n < p.support.length) :

      Use getVert_eq_support_getElem to rewrite in the reverse direction.

      theorem SimpleGraph.Walk.getVert_eq_support_getElem? {V : Type u} {G : SimpleGraph V} {u v : V} {n : } (p : G.Walk u v) (h : n p.length) :
      theorem SimpleGraph.Walk.getVert_eq_getD_support {V : Type u} {G : SimpleGraph V} {u v : V} (p : G.Walk u v) (n : ) :
      p.getVert n = p.support.getD n v
      @[simp]
      theorem SimpleGraph.Walk.getVert_support_idxOf {V : Type u} {G : SimpleGraph V} {u v w : V} [DecidableEq V] (p : G.Walk u v) (h : w p.support) :
      theorem SimpleGraph.Walk.darts_getElem_eq_getVert {V : Type u} {G : SimpleGraph V} {u v : V} {p : G.Walk u v} (n : ) (h : n < p.darts.length) :
      p.darts[n] = { fst := p.getVert n, snd := p.getVert (n + 1), adj := }
      theorem SimpleGraph.Walk.adj_of_infix_support {V : Type u} {G : SimpleGraph V} {u v u' v' : V} {p : G.Walk u v} (h : [u', v'] <:+: p.support) :
      G.Adj u' v'
      @[reducible, inline]
      abbrev SimpleGraph.Walk.snd {V : Type u} {G : SimpleGraph V} {u v : V} (p : G.Walk u v) :
      V

      The second vertex of a walk, or the only vertex in a nil walk.

      Equations
        Instances For
          @[simp]
          theorem SimpleGraph.Walk.adj_snd {V : Type u} {G : SimpleGraph V} {v w : V} {p : G.Walk v w} (hp : ¬p.Nil) :
          G.Adj v p.snd
          theorem SimpleGraph.Walk.snd_cons {V : Type u} {G : SimpleGraph V} {u v w : V} (q : G.Walk v w) (hadj : G.Adj u v) :
          (cons hadj q).snd = v
          theorem SimpleGraph.Walk.snd_mem_tail_support {V : Type u} {G : SimpleGraph V} {u v : V} {p : G.Walk u v} (h : ¬p.Nil) :
          @[simp]
          theorem SimpleGraph.Walk.support_getElem_one {V : Type u} {G : SimpleGraph V} {u v : V} {p : G.Walk u v} (hp : 1 < p.support.length) :

          Use snd_eq_support_getElem_one to rewrite in the reverse direction.

          theorem SimpleGraph.Walk.snd_eq_support_getElem_one {V : Type u} {G : SimpleGraph V} {u v : V} {p : G.Walk u v} (hnil : ¬p.Nil) :

          Use support_getElem_one to rewrite in the reverse direction.

          @[reducible, inline]
          abbrev SimpleGraph.Walk.penultimate {V : Type u} {G : SimpleGraph V} {u v : V} (p : G.Walk u v) :
          V

          The penultimate vertex of a walk, or the only vertex in a nil walk.

          Equations
            Instances For
              @[simp]
              theorem SimpleGraph.Walk.penultimate_cons_nil {V : Type u} {G : SimpleGraph V} {u v : V} (h : G.Adj u v) :
              @[simp]
              theorem SimpleGraph.Walk.penultimate_cons_cons {V : Type u} {G : SimpleGraph V} {u v w w' : V} (h : G.Adj u v) (h₂ : G.Adj v w) (p : G.Walk w w') :
              (cons h (cons h₂ p)).penultimate = (cons h₂ p).penultimate
              theorem SimpleGraph.Walk.penultimate_cons_of_not_nil {V : Type u} {G : SimpleGraph V} {u v w : V} (h : G.Adj u v) (p : G.Walk v w) (hp : ¬p.Nil) :
              @[simp]
              theorem SimpleGraph.Walk.adj_penultimate {V : Type u} {G : SimpleGraph V} {v w : V} {p : G.Walk v w} (hp : ¬p.Nil) :
              def SimpleGraph.Walk.firstDart {V : Type u} {G : SimpleGraph V} {v w : V} (p : G.Walk v w) (hp : ¬p.Nil) :

              The first dart of a walk.

              Equations
                Instances For
                  @[simp]
                  theorem SimpleGraph.Walk.firstDart_toProd {V : Type u} {G : SimpleGraph V} {v w : V} (p : G.Walk v w) (hp : ¬p.Nil) :
                  def SimpleGraph.Walk.lastDart {V : Type u} {G : SimpleGraph V} {v w : V} (p : G.Walk v w) (hp : ¬p.Nil) :

                  The last dart of a walk.

                  Equations
                    Instances For
                      @[simp]
                      theorem SimpleGraph.Walk.lastDart_toProd {V : Type u} {G : SimpleGraph V} {v w : V} (p : G.Walk v w) (hp : ¬p.Nil) :
                      theorem SimpleGraph.Walk.edge_firstDart {V : Type u} {G : SimpleGraph V} {v w : V} (p : G.Walk v w) (hp : ¬p.Nil) :
                      (p.firstDart hp).edge = s(v, p.snd)
                      theorem SimpleGraph.Walk.edge_lastDart {V : Type u} {G : SimpleGraph V} {v w : V} (p : G.Walk v w) (hp : ¬p.Nil) :
                      theorem SimpleGraph.Walk.firstDart_eq {V : Type u} {G : SimpleGraph V} {v w : V} {p : G.Walk v w} (h₁ : ¬p.Nil) (h₂ : 0 < p.darts.length) :
                      p.firstDart h₁ = p.darts[0]
                      theorem SimpleGraph.Walk.lastDart_eq {V : Type u} {G : SimpleGraph V} {v w : V} {p : G.Walk v w} (h₁ : ¬p.Nil) (h₂ : 0 < p.darts.length) :
                      @[simp]
                      theorem SimpleGraph.Walk.head_darts_eq_firstDart {V : Type u} {G : SimpleGraph V} {v w : V} {p : G.Walk v w} (hnil : p.darts []) :
                      p.darts.head hnil = p.firstDart

                      Use firstDart_eq_head_darts to rewrite in the reverse direction.

                      theorem SimpleGraph.Walk.firstDart_eq_head_darts {V : Type u} {G : SimpleGraph V} {v w : V} {p : G.Walk v w} (hnil : ¬p.Nil) :
                      p.firstDart hnil = p.darts.head

                      Use head_darts_eq_firstDart to rewrite in the reverse direction.

                      @[deprecated "Use `head_darts_eq_firstDart`" (since := "2025-12-10")]
                      theorem SimpleGraph.Walk.head_darts_fst {V : Type u} {G : SimpleGraph V} {a b : V} (p : G.Walk a b) (hp : p.darts []) :
                      (p.darts.head hp).toProd.1 = a
                      @[simp]
                      theorem SimpleGraph.Walk.firstDart_mem_darts {V : Type u} {G : SimpleGraph V} {v w : V} {p : G.Walk v w} (hnil : ¬p.Nil) :
                      @[simp]
                      theorem SimpleGraph.Walk.getLast_darts_eq_lastDart {V : Type u} {G : SimpleGraph V} {v w : V} {p : G.Walk v w} (hnil : p.darts []) :
                      p.darts.getLast hnil = p.lastDart
                      theorem SimpleGraph.Walk.lastDart_eq_getLast_darts {V : Type u} {G : SimpleGraph V} {v w : V} {p : G.Walk v w} (hnil : ¬p.Nil) :
                      p.lastDart hnil = p.darts.getLast
                      @[deprecated "Use `getLast_darts_eq_lastDart`" (since := "2025-12-10")]
                      theorem SimpleGraph.Walk.getLast_darts_snd {V : Type u} {G : SimpleGraph V} {a b : V} (p : G.Walk a b) (hp : p.darts []) :
                      (p.darts.getLast hp).toProd.2 = b
                      @[simp]
                      theorem SimpleGraph.Walk.lastDart_mem_darts {V : Type u} {G : SimpleGraph V} {v w : V} {p : G.Walk v w} (hnil : ¬p.Nil) :
                      p.lastDart hnil p.darts
                      @[simp]
                      theorem SimpleGraph.Walk.head_edges_eq_mk_start_snd {V : Type u} {G : SimpleGraph V} {v w : V} {p : G.Walk v w} (hp : p.edges []) :
                      p.edges.head hp = s(v, p.snd)

                      Use mk_start_snd_eq_head_edges to rewrite in the reverse direction.

                      theorem SimpleGraph.Walk.mk_start_snd_eq_head_edges {V : Type u} {G : SimpleGraph V} {v w : V} {p : G.Walk v w} (hnil : ¬p.Nil) :
                      s(v, p.snd) = p.edges.head

                      Use head_edges_eq_mk_start_snd to rewrite in the reverse direction.

                      theorem SimpleGraph.Walk.mk_start_snd_mem_edges {V : Type u} {G : SimpleGraph V} {v w : V} {p : G.Walk v w} (hnil : ¬p.Nil) :
                      @[simp]
                      theorem SimpleGraph.Walk.getLast_edges_eq_mk_penultimate_end {V : Type u} {G : SimpleGraph V} {v w : V} {p : G.Walk v w} (hp : p.edges []) :

                      Use mk_penultimate_end_eq_getLast_edges to rewrite in the reverse direction.

                      theorem SimpleGraph.Walk.mk_penultimate_end_eq_getLast_edges {V : Type u} {G : SimpleGraph V} {v w : V} {p : G.Walk v w} (hnil : ¬p.Nil) :

                      Use getLast_edges_eq_mk_penultimate_end to rewrite in the reverse direction.