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) :
    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) :
    @[deprecated SimpleGraph.Walk.getVert_eq_support_getElem? (since := "2025-06-10")]
    theorem SimpleGraph.Walk.getVert_eq_support_get? {V : Type u} {G : SimpleGraph V} {u v : V} {n : } (p : G.Walk u v) (h : n p.length) :

    Alias of SimpleGraph.Walk.getVert_eq_support_getElem?.

    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
    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 := }
    @[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) :
      @[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]
        @[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) :