Documentation

Mathlib.Combinatorics.SimpleGraph.Connectivity

Graph connectivity #

In a simple graph,

Warning: graph theorists mean something different by "path" than do homotopy theorists. A "walk" in graph theory is a "path" in homotopy theory. Another warning: some graph theorists use "path" and "simple path" for "walk" and "path."

Some definitions and theorems have inspiration from multigraph counterparts in [Chou1994].

Main definitions #

Main statements #

Tags #

walks, trails, paths, circuits, cycles, bridge edges

inductive SimpleGraph.Walk {V : Type u} (G : SimpleGraph V) :
VVType u

A walk is a sequence of adjacent vertices. For vertices u v : V, the type walk u v consists of all walks starting at u and ending at v.

We say that a walk visits the vertices it contains. The set of vertices a walk visits is SimpleGraph.Walk.support.

See SimpleGraph.Walk.nil' and SimpleGraph.Walk.cons' for patterns that can be useful in definitions since they make the vertices explicit.

Instances For
    instance SimpleGraph.instDecidableEqWalk :
    {V : Type u_1} → {G : SimpleGraph V} → {a a_1 : V} → [inst : DecidableEq V] → DecidableEq (SimpleGraph.Walk G a a_1)
    @[simp]
    theorem SimpleGraph.Walk.instInhabited_default {V : Type u} (G : SimpleGraph V) (v : V) :
    default = SimpleGraph.Walk.nil
    @[match_pattern, reducible]
    def SimpleGraph.Adj.toWalk {V : Type u} {G : SimpleGraph V} {u : V} {v : V} (h : SimpleGraph.Adj G u v) :

    The one-edge walk associated to a pair of adjacent vertices.

    Instances For
      @[match_pattern, inline, reducible]
      abbrev SimpleGraph.Walk.nil' {V : Type u} {G : SimpleGraph V} (u : V) :

      Pattern to get Walk.nil with the vertex as an explicit argument.

      Instances For
        @[match_pattern, inline, reducible]
        abbrev SimpleGraph.Walk.cons' {V : Type u} {G : SimpleGraph V} (u : V) (v : V) (w : V) (h : SimpleGraph.Adj G u v) (p : SimpleGraph.Walk G v w) :

        Pattern to get Walk.cons with the vertices as explicit arguments.

        Instances For
          def SimpleGraph.Walk.copy {V : Type u} {G : SimpleGraph V} {u : V} {v : V} {u' : V} {v' : V} (p : SimpleGraph.Walk G u v) (hu : u = u') (hv : v = v') :

          Change the endpoints of a walk using equalities. This is helpful for relaxing definitional equality constraints and to be able to state otherwise difficult-to-state lemmas. While this is a simple wrapper around Eq.rec, it gives a canonical way to write it.

          The simp-normal form is for the copy to be pushed outward. That way calculations can occur within the "copy context."

          Instances For
            @[simp]
            theorem SimpleGraph.Walk.copy_rfl_rfl {V : Type u} {G : SimpleGraph V} {u : V} {v : V} (p : SimpleGraph.Walk G u v) :
            SimpleGraph.Walk.copy p (_ : u = u) (_ : v = v) = p
            @[simp]
            theorem SimpleGraph.Walk.copy_copy {V : Type u} {G : SimpleGraph V} {u : V} {v : V} {u' : V} {v' : V} {u'' : V} {v'' : V} (p : SimpleGraph.Walk G u v) (hu : u = u') (hv : v = v') (hu' : u' = u'') (hv' : v' = v'') :
            SimpleGraph.Walk.copy (SimpleGraph.Walk.copy p hu hv) hu' hv' = SimpleGraph.Walk.copy p (_ : u = u'') (_ : v = v'')
            @[simp]
            theorem SimpleGraph.Walk.copy_nil {V : Type u} {G : SimpleGraph V} {u : V} {u' : V} (hu : u = u') :
            SimpleGraph.Walk.copy SimpleGraph.Walk.nil hu hu = SimpleGraph.Walk.nil
            theorem SimpleGraph.Walk.copy_cons {V : Type u} {G : SimpleGraph V} {u : V} {v : V} {w : V} {u' : V} {w' : V} (h : SimpleGraph.Adj G u v) (p : SimpleGraph.Walk G v w) (hu : u = u') (hw : w = w') :
            @[simp]
            theorem SimpleGraph.Walk.cons_copy {V : Type u} {G : SimpleGraph V} {u : V} {v : V} {w : V} {v' : V} {w' : V} (h : SimpleGraph.Adj G u v) (p : SimpleGraph.Walk G v' w') (hv : v' = v) (hw : w' = w) :
            theorem SimpleGraph.Walk.exists_eq_cons_of_ne {V : Type u} {G : SimpleGraph V} {u : V} {v : V} (hne : u v) (p : SimpleGraph.Walk G u v) :
            w h p', p = SimpleGraph.Walk.cons h p'
            def SimpleGraph.Walk.length {V : Type u} {G : SimpleGraph V} {u : V} {v : V} :

            The length of a walk is the number of edges/darts along it.

            Equations
            Instances For
              def SimpleGraph.Walk.append {V : Type u} {G : SimpleGraph V} {u : V} {v : V} {w : V} :

              The concatenation of two compatible walks.

              Equations
              Instances For
                def SimpleGraph.Walk.concat {V : Type u} {G : SimpleGraph V} {u : V} {v : V} {w : V} (p : SimpleGraph.Walk G u v) (h : SimpleGraph.Adj G v w) :

                The reversed version of SimpleGraph.Walk.cons, concatenating an edge to the end of a walk.

                Instances For
                  theorem SimpleGraph.Walk.concat_eq_append {V : Type u} {G : SimpleGraph V} {u : V} {v : V} {w : V} (p : SimpleGraph.Walk G u v) (h : SimpleGraph.Adj G v w) :
                  def SimpleGraph.Walk.reverseAux {V : Type u} {G : SimpleGraph V} {u : V} {v : V} {w : V} :

                  The concatenation of the reverse of the first walk with the second walk.

                  Equations
                  Instances For
                    def SimpleGraph.Walk.reverse {V : Type u} {G : SimpleGraph V} {u : V} {v : V} (w : SimpleGraph.Walk G u v) :

                    The walk in reverse.

                    Instances For
                      def SimpleGraph.Walk.getVert {V : Type u} {G : SimpleGraph V} {u : V} {v : V} :
                      SimpleGraph.Walk G 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 : V} (w : SimpleGraph.Walk G u v) :
                        @[simp]
                        @[simp]
                        theorem SimpleGraph.Walk.cons_nil_append {V : Type u} {G : SimpleGraph V} {u : V} {v : V} {w : V} (h : SimpleGraph.Adj G u v) (p : SimpleGraph.Walk G v w) :
                        @[simp]
                        theorem SimpleGraph.Walk.append_nil {V : Type u} {G : SimpleGraph V} {u : V} {v : V} (p : SimpleGraph.Walk G u v) :
                        SimpleGraph.Walk.append p SimpleGraph.Walk.nil = p
                        @[simp]
                        theorem SimpleGraph.Walk.nil_append {V : Type u} {G : SimpleGraph V} {u : V} {v : V} (p : SimpleGraph.Walk G u v) :
                        SimpleGraph.Walk.append SimpleGraph.Walk.nil p = p
                        @[simp]
                        theorem SimpleGraph.Walk.append_copy_copy {V : Type u} {G : SimpleGraph V} {u : V} {v : V} {w : V} {u' : V} {v' : V} {w' : V} (p : SimpleGraph.Walk G u v) (q : SimpleGraph.Walk G v w) (hu : u = u') (hv : v = v') (hw : w = w') :
                        theorem SimpleGraph.Walk.concat_nil {V : Type u} {G : SimpleGraph V} {u : V} {v : V} (h : SimpleGraph.Adj G u v) :
                        SimpleGraph.Walk.concat SimpleGraph.Walk.nil h = SimpleGraph.Walk.cons h SimpleGraph.Walk.nil
                        @[simp]
                        theorem SimpleGraph.Walk.concat_cons {V : Type u} {G : SimpleGraph V} {u : V} {v : V} {w : V} {x : V} (h : SimpleGraph.Adj G u v) (p : SimpleGraph.Walk G v w) (h' : SimpleGraph.Adj G w x) :
                        theorem SimpleGraph.Walk.exists_cons_eq_concat {V : Type u} {G : SimpleGraph V} {u : V} {v : V} {w : V} (h : SimpleGraph.Adj G u v) (p : SimpleGraph.Walk G v w) :

                        A non-trivial cons walk is representable as a concat walk.

                        theorem SimpleGraph.Walk.exists_concat_eq_cons {V : Type u} {G : SimpleGraph V} {u : V} {v : V} {w : V} (p : SimpleGraph.Walk G u v) (h : SimpleGraph.Adj G v w) :

                        A non-trivial concat walk is representable as a cons walk.

                        @[simp]
                        theorem SimpleGraph.Walk.reverse_nil {V : Type u} {G : SimpleGraph V} {u : V} :
                        SimpleGraph.Walk.reverse SimpleGraph.Walk.nil = SimpleGraph.Walk.nil
                        theorem SimpleGraph.Walk.reverse_singleton {V : Type u} {G : SimpleGraph V} {u : V} {v : V} (h : SimpleGraph.Adj G u v) :
                        SimpleGraph.Walk.reverse (SimpleGraph.Walk.cons h SimpleGraph.Walk.nil) = SimpleGraph.Walk.cons (_ : SimpleGraph.Adj G v u) SimpleGraph.Walk.nil
                        @[simp]
                        theorem SimpleGraph.Walk.reverse_copy {V : Type u} {G : SimpleGraph V} {u : V} {v : V} {u' : V} {v' : V} (p : SimpleGraph.Walk G u v) (hu : u = u') (hv : v = v') :
                        @[simp]
                        theorem SimpleGraph.Walk.length_nil {V : Type u} {G : SimpleGraph V} {u : V} :
                        SimpleGraph.Walk.length SimpleGraph.Walk.nil = 0
                        @[simp]
                        @[simp]
                        theorem SimpleGraph.Walk.length_copy {V : Type u} {G : SimpleGraph V} {u : V} {v : V} {u' : V} {v' : V} (p : SimpleGraph.Walk G u v) (hu : u = u') (hv : v = v') :
                        theorem SimpleGraph.Walk.eq_of_length_eq_zero {V : Type u} {G : SimpleGraph V} {u : V} {v : V} {p : SimpleGraph.Walk G u v} :
                        @[simp]
                        theorem SimpleGraph.Walk.exists_length_eq_zero_iff {V : Type u} {G : SimpleGraph V} {u : V} {v : V} :
                        (p, SimpleGraph.Walk.length p = 0) u = v
                        @[simp]
                        theorem SimpleGraph.Walk.length_eq_zero_iff {V : Type u} {G : SimpleGraph V} {u : V} {p : SimpleGraph.Walk G u u} :
                        SimpleGraph.Walk.length p = 0 p = SimpleGraph.Walk.nil
                        def SimpleGraph.Walk.concatRecAux {V : Type u} {G : SimpleGraph V} {motive : (u v : V) → SimpleGraph.Walk G u vSort u_1} (Hnil : {u : V} → motive u u SimpleGraph.Walk.nil) (Hconcat : {u v w : V} → (p : SimpleGraph.Walk G u v) → (h : SimpleGraph.Adj G v w) → motive u v pmotive u w (SimpleGraph.Walk.concat p h)) {u : V} {v : V} (p : SimpleGraph.Walk G u v) :

                        Auxiliary definition for SimpleGraph.Walk.concatRec

                        Equations
                        Instances For
                          def SimpleGraph.Walk.concatRec {V : Type u} {G : SimpleGraph V} {motive : (u v : V) → SimpleGraph.Walk G u vSort u_1} (Hnil : {u : V} → motive u u SimpleGraph.Walk.nil) (Hconcat : {u v w : V} → (p : SimpleGraph.Walk G u v) → (h : SimpleGraph.Adj G v w) → motive u v pmotive u w (SimpleGraph.Walk.concat p h)) {u : V} {v : V} (p : SimpleGraph.Walk G u v) :
                          motive u v p

                          Recursor on walks by inducting on SimpleGraph.Walk.concat.

                          This is inducting from the opposite end of the walk compared to SimpleGraph.Walk.rec, which inducts on SimpleGraph.Walk.cons.

                          Instances For
                            @[simp]
                            theorem SimpleGraph.Walk.concatRec_nil {V : Type u} {G : SimpleGraph V} {motive : (u v : V) → SimpleGraph.Walk G u vSort u_1} (Hnil : {u : V} → motive u u SimpleGraph.Walk.nil) (Hconcat : {u v w : V} → (p : SimpleGraph.Walk G u v) → (h : SimpleGraph.Adj G v w) → motive u v pmotive u w (SimpleGraph.Walk.concat p h)) (u : V) :
                            SimpleGraph.Walk.concatRec Hnil Hconcat SimpleGraph.Walk.nil = Hnil u
                            @[simp]
                            theorem SimpleGraph.Walk.concatRec_concat {V : Type u} {G : SimpleGraph V} {motive : (u v : V) → SimpleGraph.Walk G u vSort u_1} (Hnil : {u : V} → motive u u SimpleGraph.Walk.nil) (Hconcat : {u v w : V} → (p : SimpleGraph.Walk G u v) → (h : SimpleGraph.Adj G v w) → motive u v pmotive u w (SimpleGraph.Walk.concat p h)) {u : V} {v : V} {w : V} (p : SimpleGraph.Walk G u v) (h : SimpleGraph.Adj G v w) :
                            SimpleGraph.Walk.concatRec Hnil Hconcat (SimpleGraph.Walk.concat p h) = Hconcat u v w p h (SimpleGraph.Walk.concatRec Hnil Hconcat p)
                            theorem SimpleGraph.Walk.concat_ne_nil {V : Type u} {G : SimpleGraph V} {u : V} {v : V} (p : SimpleGraph.Walk G u v) (h : SimpleGraph.Adj G v u) :
                            SimpleGraph.Walk.concat p h SimpleGraph.Walk.nil
                            theorem SimpleGraph.Walk.concat_inj {V : Type u} {G : SimpleGraph V} {u : V} {v : V} {v' : V} {w : V} {p : SimpleGraph.Walk G u v} {h : SimpleGraph.Adj G v w} {p' : SimpleGraph.Walk G u v'} {h' : SimpleGraph.Adj G v' w} (he : SimpleGraph.Walk.concat p h = SimpleGraph.Walk.concat p' h') :
                            hv, SimpleGraph.Walk.copy p (_ : u = u) hv = p'
                            def SimpleGraph.Walk.support {V : Type u} {G : SimpleGraph V} {u : V} {v : V} :

                            The support of a walk is the list of vertices it visits in order.

                            Equations
                            Instances For
                              def SimpleGraph.Walk.darts {V : Type u} {G : SimpleGraph V} {u : V} {v : V} :

                              The darts of a walk is the list of darts it visits in order.

                              Equations
                              Instances For
                                def SimpleGraph.Walk.edges {V : Type u} {G : SimpleGraph V} {u : V} {v : V} (p : SimpleGraph.Walk G u v) :

                                The edges of a walk is the list of edges it visits in order. This is defined to be the list of edges underlying SimpleGraph.Walk.darts.

                                Instances For
                                  @[simp]
                                  theorem SimpleGraph.Walk.support_nil {V : Type u} {G : SimpleGraph V} {u : V} :
                                  SimpleGraph.Walk.support SimpleGraph.Walk.nil = [u]
                                  @[simp]
                                  theorem SimpleGraph.Walk.support_copy {V : Type u} {G : SimpleGraph V} {u : V} {v : V} {u' : V} {v' : V} (p : SimpleGraph.Walk G u v) (hu : u = u') (hv : v = v') :
                                  @[simp]
                                  theorem SimpleGraph.Walk.support_ne_nil {V : Type u} {G : SimpleGraph V} {u : V} {v : V} (p : SimpleGraph.Walk G u v) :
                                  @[simp]
                                  theorem SimpleGraph.Walk.start_mem_support {V : Type u} {G : SimpleGraph V} {u : V} {v : V} (p : SimpleGraph.Walk G u v) :
                                  @[simp]
                                  theorem SimpleGraph.Walk.end_mem_support {V : Type u} {G : SimpleGraph V} {u : V} {v : V} (p : SimpleGraph.Walk G u v) :
                                  @[simp]
                                  theorem SimpleGraph.Walk.support_nonempty {V : Type u} {G : SimpleGraph V} {u : V} {v : V} (p : SimpleGraph.Walk G u v) :
                                  theorem SimpleGraph.Walk.mem_support_nil_iff {V : Type u} {G : SimpleGraph V} {u : V} {v : V} :
                                  u SimpleGraph.Walk.support SimpleGraph.Walk.nil u = v
                                  @[simp]
                                  theorem SimpleGraph.Walk.end_mem_tail_support_of_ne {V : Type u} {G : SimpleGraph V} {u : V} {v : V} (h : u v) (p : SimpleGraph.Walk G u v) :
                                  theorem SimpleGraph.Walk.chain_adj_support {V : Type u} {G : SimpleGraph V} {u : V} {v : V} {w : V} (h : SimpleGraph.Adj G u v) (p : SimpleGraph.Walk G v w) :
                                  theorem SimpleGraph.Walk.edges_subset_edgeSet {V : Type u} {G : SimpleGraph V} {u : V} {v : V} (p : SimpleGraph.Walk G u v) ⦃e : Sym2 V :

                                  Every edge in a walk's edge list is an edge of the graph. It is written in this form (rather than using ) to avoid unsightly coercions.

                                  theorem SimpleGraph.Walk.adj_of_mem_edges {V : Type u} {G : SimpleGraph V} {u : V} {v : V} {x : V} {y : V} (p : SimpleGraph.Walk G u v) (h : Quotient.mk (Sym2.Rel.setoid V) (x, y) SimpleGraph.Walk.edges p) :
                                  @[simp]
                                  theorem SimpleGraph.Walk.darts_nil {V : Type u} {G : SimpleGraph V} {u : V} :
                                  SimpleGraph.Walk.darts SimpleGraph.Walk.nil = []
                                  @[simp]
                                  theorem SimpleGraph.Walk.darts_cons {V : Type u} {G : SimpleGraph V} {u : V} {v : V} {w : V} (h : SimpleGraph.Adj G u v) (p : SimpleGraph.Walk G v w) :
                                  SimpleGraph.Walk.darts (SimpleGraph.Walk.cons h p) = { toProd := (u, v), is_adj := h } :: SimpleGraph.Walk.darts p
                                  @[simp]
                                  theorem SimpleGraph.Walk.darts_concat {V : Type u} {G : SimpleGraph V} {u : V} {v : V} {w : V} (p : SimpleGraph.Walk G u v) (h : SimpleGraph.Adj G v w) :
                                  @[simp]
                                  theorem SimpleGraph.Walk.darts_copy {V : Type u} {G : SimpleGraph V} {u : V} {v : V} {u' : V} {v' : V} (p : SimpleGraph.Walk G u v) (hu : u = u') (hv : v = v') :
                                  theorem SimpleGraph.Walk.cons_map_snd_darts {V : Type u} {G : SimpleGraph V} {u : V} {v : V} (p : SimpleGraph.Walk G u v) :
                                  theorem SimpleGraph.Walk.map_fst_darts_append {V : Type u} {G : SimpleGraph V} {u : V} {v : V} (p : SimpleGraph.Walk G u v) :
                                  @[simp]
                                  theorem SimpleGraph.Walk.edges_nil {V : Type u} {G : SimpleGraph V} {u : V} :
                                  SimpleGraph.Walk.edges SimpleGraph.Walk.nil = []
                                  @[simp]
                                  theorem SimpleGraph.Walk.edges_copy {V : Type u} {G : SimpleGraph V} {u : V} {v : V} {u' : V} {v' : V} (p : SimpleGraph.Walk G u v) (hu : u = u') (hv : v = v') :
                                  inductive SimpleGraph.Walk.Nil {V : Type u} {G : SimpleGraph V} {v : V} {w : V} :

                                  Predicate for the empty walk.

                                  Solves the dependent type problem where p = G.Walk.nil typechecks only if p has defeq endpoints.

                                  Instances For
                                    @[simp]
                                    theorem SimpleGraph.Walk.nil_nil {V : Type u} {G : SimpleGraph V} {u : V} :
                                    SimpleGraph.Walk.Nil SimpleGraph.Walk.nil
                                    @[simp]
                                    theorem SimpleGraph.Walk.not_nil_cons {V : Type u} {G : SimpleGraph V} {u : V} {v : V} {w : V} {h : SimpleGraph.Adj G u v} {p : SimpleGraph.Walk G v w} :
                                    theorem SimpleGraph.Walk.Nil.eq {V : Type u} {G : SimpleGraph V} {v : V} {w : V} {p : SimpleGraph.Walk G v w} :
                                    theorem SimpleGraph.Walk.not_nil_of_ne {V : Type u} {G : SimpleGraph V} {v : V} {w : V} {p : SimpleGraph.Walk G v w} :
                                    theorem SimpleGraph.Walk.not_nil_iff {V : Type u} {G : SimpleGraph V} {v : V} {w : V} {p : SimpleGraph.Walk G v w} :
                                    def SimpleGraph.Walk.notNilRec {V : Type u} {G : SimpleGraph V} {u : V} {w : V} {motive : {u w : V} → (p : SimpleGraph.Walk G u w) → ¬SimpleGraph.Walk.Nil pSort u_1} (cons : {u v w : V} → (h : SimpleGraph.Adj G u v) → (q : SimpleGraph.Walk G v w) → motive u w (SimpleGraph.Walk.cons h q) (_ : ¬SimpleGraph.Walk.Nil (SimpleGraph.Walk.cons h q))) (p : SimpleGraph.Walk G u w) (hp : ¬SimpleGraph.Walk.Nil p) :
                                    motive u w p hp
                                    Instances For
                                      def SimpleGraph.Walk.sndOfNotNil {V : Type u} {G : SimpleGraph V} {v : V} {w : V} (p : SimpleGraph.Walk G v w) (hp : ¬SimpleGraph.Walk.Nil p) :
                                      V

                                      The second vertex along a non-nil walk.

                                      Instances For

                                        The walk obtained by removing the first dart of a non-nil walk.

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

                                          The first dart of a walk.

                                          Instances For
                                            @[simp]
                                            theorem SimpleGraph.Walk.nil_copy {V : Type u} {G : SimpleGraph V} {x : V} {y : V} {x' : V} {y' : V} {p : SimpleGraph.Walk G x y} (hx : x = x') (hy : y = y') :

                                            Trails, paths, circuits, cycles #

                                            structure SimpleGraph.Walk.IsTrail {V : Type u} {G : SimpleGraph V} {u : V} {v : V} (p : SimpleGraph.Walk G u v) :

                                            A trail is a walk with no repeating edges.

                                            Instances For
                                              structure SimpleGraph.Walk.IsPath {V : Type u} {G : SimpleGraph V} {u : V} {v : V} (p : SimpleGraph.Walk G u v) extends SimpleGraph.Walk.IsTrail :

                                              A path is a walk with no repeating vertices. Use simple_graph.walk.is_path.mk' for a simpler constructor.

                                              Instances For
                                                structure SimpleGraph.Walk.IsCircuit {V : Type u} {G : SimpleGraph V} {u : V} (p : SimpleGraph.Walk G u u) extends SimpleGraph.Walk.IsTrail :

                                                A circuit at u : V is a nonempty trail beginning and ending at u.

                                                Instances For
                                                  structure SimpleGraph.Walk.IsCycle {V : Type u} {G : SimpleGraph V} {u : V} (p : SimpleGraph.Walk G u u) extends SimpleGraph.Walk.IsCircuit :

                                                  A cycle at u : V is a circuit at u whose only repeating vertex is u (which appears exactly twice).

                                                  Instances For
                                                    @[simp]
                                                    theorem SimpleGraph.Walk.isTrail_copy {V : Type u} {G : SimpleGraph V} {u : V} {v : V} {u' : V} {v' : V} (p : SimpleGraph.Walk G u v) (hu : u = u') (hv : v = v') :
                                                    @[simp]
                                                    theorem SimpleGraph.Walk.isPath_copy {V : Type u} {G : SimpleGraph V} {u : V} {v : V} {u' : V} {v' : V} (p : SimpleGraph.Walk G u v) (hu : u = u') (hv : v = v') :
                                                    @[simp]
                                                    @[simp]
                                                    theorem SimpleGraph.Walk.IsTrail.nil {V : Type u} {G : SimpleGraph V} {u : V} :
                                                    SimpleGraph.Walk.IsTrail SimpleGraph.Walk.nil
                                                    theorem SimpleGraph.Walk.IsPath.nil {V : Type u} {G : SimpleGraph V} {u : V} :
                                                    SimpleGraph.Walk.IsPath SimpleGraph.Walk.nil
                                                    @[simp]
                                                    theorem SimpleGraph.Walk.isPath_iff_eq_nil {V : Type u} {G : SimpleGraph V} {u : V} (p : SimpleGraph.Walk G u u) :
                                                    SimpleGraph.Walk.IsPath p p = SimpleGraph.Walk.nil
                                                    @[simp]
                                                    theorem SimpleGraph.Walk.IsCycle.not_of_nil {V : Type u} {G : SimpleGraph V} {u : V} :
                                                    ¬SimpleGraph.Walk.IsCycle SimpleGraph.Walk.nil

                                                    About paths #

                                                    Walk decompositions #

                                                    def SimpleGraph.Walk.takeUntil {V : Type u} {G : SimpleGraph V} [DecidableEq V] {v : V} {w : V} (p : SimpleGraph.Walk G v w) (u : V) :

                                                    Given a vertex in the support of a path, give the path up until (and including) that vertex.

                                                    Equations
                                                    Instances For
                                                      def SimpleGraph.Walk.dropUntil {V : Type u} {G : SimpleGraph V} [DecidableEq V] {v : V} {w : V} (p : SimpleGraph.Walk G v w) (u : V) :

                                                      Given a vertex in the support of a path, give the path from (and including) that vertex to the end. In other words, drop vertices from the front of a path until (and not including) that vertex.

                                                      Equations
                                                      Instances For
                                                        @[simp]

                                                        The takeUntil and dropUntil functions split a walk into two pieces. The lemma SimpleGraph.Walk.count_support_takeUntil_eq_one specifies where this split occurs.

                                                        @[simp]
                                                        theorem SimpleGraph.Walk.takeUntil_copy {V : Type u} {G : SimpleGraph V} [DecidableEq V] {u : V} {v : V} {w : V} {v' : V} {w' : V} (p : SimpleGraph.Walk G v w) (hv : v = v') (hw : w = w') (h : u SimpleGraph.Walk.support (SimpleGraph.Walk.copy p hv hw)) :
                                                        @[simp]
                                                        theorem SimpleGraph.Walk.dropUntil_copy {V : Type u} {G : SimpleGraph V} [DecidableEq V] {u : V} {v : V} {w : V} {v' : V} {w' : V} (p : SimpleGraph.Walk G v w) (hv : v = v') (hw : w = w') (h : u SimpleGraph.Walk.support (SimpleGraph.Walk.copy p hv hw)) :
                                                        def SimpleGraph.Walk.rotate {V : Type u} {G : SimpleGraph V} [DecidableEq V] {u : V} {v : V} (c : SimpleGraph.Walk G v v) (h : u SimpleGraph.Walk.support c) :

                                                        Rotate a loop walk such that it is centered at the given vertex.

                                                        Instances For
                                                          theorem SimpleGraph.Walk.exists_boundary_dart {V : Type u} {G : SimpleGraph V} {u : V} {v : V} (p : SimpleGraph.Walk G u v) (S : Set V) (uS : u S) (vS : ¬v S) :
                                                          d, d SimpleGraph.Walk.darts p d.fst S ¬d.snd S

                                                          Given a set S and a walk w from u to v such that u ∈ S but v ∉ S, there exists a dart in the walk whose start is in S but whose end is not.

                                                          Type of paths #

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

                                                          The type for paths between two vertices.

                                                          Instances For
                                                            @[simp]
                                                            theorem SimpleGraph.Path.isPath {V : Type u} {G : SimpleGraph V} {u : V} {v : V} (p : SimpleGraph.Path G u v) :
                                                            @[simp]
                                                            theorem SimpleGraph.Path.isTrail {V : Type u} {G : SimpleGraph V} {u : V} {v : V} (p : SimpleGraph.Path G u v) :
                                                            @[simp]
                                                            theorem SimpleGraph.Path.nil_coe {V : Type u} {G : SimpleGraph V} {u : V} :
                                                            SimpleGraph.Path.nil = SimpleGraph.Walk.nil
                                                            def SimpleGraph.Path.nil {V : Type u} {G : SimpleGraph V} {u : V} :

                                                            The length-0 path at a vertex.

                                                            Instances For
                                                              @[simp]
                                                              theorem SimpleGraph.Path.singleton_coe {V : Type u} {G : SimpleGraph V} {u : V} {v : V} (h : SimpleGraph.Adj G u v) :
                                                              ↑(SimpleGraph.Path.singleton h) = SimpleGraph.Walk.cons h SimpleGraph.Walk.nil
                                                              def SimpleGraph.Path.singleton {V : Type u} {G : SimpleGraph V} {u : V} {v : V} (h : SimpleGraph.Adj G u v) :

                                                              The length-1 path between a pair of adjacent vertices.

                                                              Instances For
                                                                @[simp]
                                                                def SimpleGraph.Path.reverse {V : Type u} {G : SimpleGraph V} {u : V} {v : V} (p : SimpleGraph.Path G u v) :

                                                                The reverse of a path is another path. See also SimpleGraph.Walk.reverse.

                                                                Instances For
                                                                  theorem SimpleGraph.Path.count_support_eq_one {V : Type u} {G : SimpleGraph V} [DecidableEq V] {u : V} {v : V} {w : V} {p : SimpleGraph.Path G u v} (hw : w SimpleGraph.Walk.support p) :
                                                                  theorem SimpleGraph.Path.count_edges_eq_one {V : Type u} {G : SimpleGraph V} [DecidableEq V] {u : V} {v : V} {p : SimpleGraph.Path G u v} (e : Sym2 V) (hw : e SimpleGraph.Walk.edges p) :
                                                                  @[simp]
                                                                  theorem SimpleGraph.Path.nodup_support {V : Type u} {G : SimpleGraph V} {u : V} {v : V} (p : SimpleGraph.Path G u v) :
                                                                  theorem SimpleGraph.Path.loop_eq {V : Type u} {G : SimpleGraph V} {v : V} (p : SimpleGraph.Path G v v) :
                                                                  p = SimpleGraph.Path.nil

                                                                  Walks to paths #

                                                                  def SimpleGraph.Walk.bypass {V : Type u} {G : SimpleGraph V} [DecidableEq V] {u : V} {v : V} :

                                                                  Given a walk, produces a walk from it by bypassing subwalks between repeated vertices. The result is a path, as shown in SimpleGraph.Walk.bypass_isPath. This is packaged up in SimpleGraph.Walk.toPath.

                                                                  Equations
                                                                  • One or more equations did not get rendered due to their size.
                                                                  • SimpleGraph.Walk.bypass SimpleGraph.Walk.nil = SimpleGraph.Walk.nil
                                                                  Instances For
                                                                    @[simp]
                                                                    theorem SimpleGraph.Walk.bypass_copy {V : Type u} {G : SimpleGraph V} [DecidableEq V] {u : V} {v : V} {u' : V} {v' : V} (p : SimpleGraph.Walk G u v) (hu : u = u') (hv : v = v') :
                                                                    def SimpleGraph.Walk.toPath {V : Type u} {G : SimpleGraph V} [DecidableEq V] {u : V} {v : V} (p : SimpleGraph.Walk G u v) :

                                                                    Given a walk, produces a path with the same endpoints using SimpleGraph.Walk.bypass.

                                                                    Instances For

                                                                      Mapping paths #

                                                                      def SimpleGraph.Walk.map {V : Type u} {V' : Type v} {G : SimpleGraph V} {G' : SimpleGraph V'} (f : G →g G') {u : V} {v : V} :
                                                                      SimpleGraph.Walk G u vSimpleGraph.Walk G' (f u) (f v)

                                                                      Given a graph homomorphism, map walks to walks.

                                                                      Equations
                                                                      Instances For
                                                                        @[simp]
                                                                        theorem SimpleGraph.Walk.map_nil {V : Type u} {V' : Type v} {G : SimpleGraph V} {G' : SimpleGraph V'} (f : G →g G') {u : V} :
                                                                        SimpleGraph.Walk.map f SimpleGraph.Walk.nil = SimpleGraph.Walk.nil
                                                                        @[simp]
                                                                        theorem SimpleGraph.Walk.map_cons {V : Type u} {V' : Type v} {G : SimpleGraph V} {G' : SimpleGraph V'} (f : G →g G') {u : V} {v : V} (p : SimpleGraph.Walk G u v) {w : V} (h : SimpleGraph.Adj G w u) :
                                                                        @[simp]
                                                                        theorem SimpleGraph.Walk.map_copy {V : Type u} {V' : Type v} {G : SimpleGraph V} {G' : SimpleGraph V'} (f : G →g G') {u : V} {v : V} {u' : V} {v' : V} (p : SimpleGraph.Walk G u v) (hu : u = u') (hv : v = v') :
                                                                        SimpleGraph.Walk.map f (SimpleGraph.Walk.copy p hu hv) = SimpleGraph.Walk.copy (SimpleGraph.Walk.map f p) (_ : f u = f u') (_ : f v = f v')
                                                                        @[simp]
                                                                        theorem SimpleGraph.Walk.map_id {V : Type u} {G : SimpleGraph V} {u : V} {v : V} (p : SimpleGraph.Walk G u v) (p : SimpleGraph.Walk G u v) :
                                                                        SimpleGraph.Walk.map SimpleGraph.Hom.id p = p
                                                                        @[simp]
                                                                        theorem SimpleGraph.Walk.map_map {V : Type u} {V' : Type v} {V'' : Type w} {G : SimpleGraph V} {G' : SimpleGraph V'} {G'' : SimpleGraph V''} (f : G →g G') (f' : G' →g G'') {u : V} {v : V} (p : SimpleGraph.Walk G u v) :
                                                                        theorem SimpleGraph.Walk.map_eq_of_eq {V : Type u} {V' : Type v} {G : SimpleGraph V} {G' : SimpleGraph V'} {u : V} {v : V} (p : SimpleGraph.Walk G u v) {f : G →g G'} (f' : G →g G') (h : f = f') :
                                                                        SimpleGraph.Walk.map f p = SimpleGraph.Walk.copy (SimpleGraph.Walk.map f' p) (_ : f' u = f u) (_ : f' v = f v)

                                                                        Unlike categories, for graphs vertex equality is an important notion, so needing to be able to work with equality of graph homomorphisms is a necessary evil.

                                                                        @[simp]
                                                                        theorem SimpleGraph.Walk.map_eq_nil_iff {V : Type u} {V' : Type v} {G : SimpleGraph V} {G' : SimpleGraph V'} (f : G →g G') {u : V} {p : SimpleGraph.Walk G u u} :
                                                                        SimpleGraph.Walk.map f p = SimpleGraph.Walk.nil p = SimpleGraph.Walk.nil
                                                                        @[simp]
                                                                        theorem SimpleGraph.Walk.length_map {V : Type u} {V' : Type v} {G : SimpleGraph V} {G' : SimpleGraph V'} (f : G →g G') {u : V} {v : V} (p : SimpleGraph.Walk G u v) :
                                                                        @[simp]
                                                                        theorem SimpleGraph.Walk.support_map {V : Type u} {V' : Type v} {G : SimpleGraph V} {G' : SimpleGraph V'} (f : G →g G') {u : V} {v : V} (p : SimpleGraph.Walk G u v) :
                                                                        @[simp]
                                                                        theorem SimpleGraph.Walk.edges_map {V : Type u} {V' : Type v} {G : SimpleGraph V} {G' : SimpleGraph V'} (f : G →g G') {u : V} {v : V} (p : SimpleGraph.Walk G u v) :
                                                                        theorem SimpleGraph.Walk.map_isPath_of_injective {V : Type u} {V' : Type v} {G : SimpleGraph V} {G' : SimpleGraph V'} {f : G →g G'} {u : V} {v : V} {p : SimpleGraph.Walk G u v} (hinj : Function.Injective f) (hp : SimpleGraph.Walk.IsPath p) :
                                                                        theorem SimpleGraph.Walk.IsPath.of_map {V : Type u} {V' : Type v} {G : SimpleGraph V} {G' : SimpleGraph V'} {u : V} {v : V} {p : SimpleGraph.Walk G u v} {f : G →g G'} (hp : SimpleGraph.Walk.IsPath (SimpleGraph.Walk.map f p)) :
                                                                        theorem SimpleGraph.Walk.map_isTrail_of_injective {V : Type u} {V' : Type v} {G : SimpleGraph V} {G' : SimpleGraph V'} {f : G →g G'} {u : V} {v : V} {p : SimpleGraph.Walk G u v} (hinj : Function.Injective f) :

                                                                        Alias of the reverse direction of SimpleGraph.Walk.map_isTrail_iff_of_injective.

                                                                        theorem SimpleGraph.Walk.map_injective_of_injective {V : Type u} {V' : Type v} {G : SimpleGraph V} {G' : SimpleGraph V'} {f : G →g G'} (hinj : Function.Injective f) (u : V) (v : V) :
                                                                        @[reducible]
                                                                        def SimpleGraph.Walk.mapLe {V : Type u} {G : SimpleGraph V} {G' : SimpleGraph V} (h : G G') {u : V} {v : V} (p : SimpleGraph.Walk G u v) :

                                                                        The specialization of SimpleGraph.Walk.map for mapping walks to supergraphs.

                                                                        Instances For

                                                                          Alias of the reverse direction of SimpleGraph.Walk.mapLe_isTrail.

                                                                          Alias of the forward direction of SimpleGraph.Walk.mapLe_isTrail.

                                                                          Alias of the forward direction of SimpleGraph.Walk.mapLe_isPath.

                                                                          Alias of the reverse direction of SimpleGraph.Walk.mapLe_isPath.

                                                                          @[simp]
                                                                          theorem SimpleGraph.Path.map_coe {V : Type u} {V' : Type v} {G : SimpleGraph V} {G' : SimpleGraph V'} (f : G →g G') (hinj : Function.Injective f) {u : V} {v : V} (p : SimpleGraph.Path G u v) :
                                                                          def SimpleGraph.Path.map {V : Type u} {V' : Type v} {G : SimpleGraph V} {G' : SimpleGraph V'} (f : G →g G') (hinj : Function.Injective f) {u : V} {v : V} (p : SimpleGraph.Path G u v) :
                                                                          SimpleGraph.Path G' (f u) (f v)

                                                                          Given an injective graph homomorphism, map paths to paths.

                                                                          Instances For
                                                                            theorem SimpleGraph.Path.map_injective {V : Type u} {V' : Type v} {G : SimpleGraph V} {G' : SimpleGraph V'} {f : G →g G'} (hinj : Function.Injective f) (u : V) (v : V) :
                                                                            @[simp]
                                                                            theorem SimpleGraph.Path.mapEmbedding_coe {V : Type u} {V' : Type v} {G : SimpleGraph V} {G' : SimpleGraph V'} (f : G ↪g G') {u : V} {v : V} (p : SimpleGraph.Path G u v) :
                                                                            def SimpleGraph.Path.mapEmbedding {V : Type u} {V' : Type v} {G : SimpleGraph V} {G' : SimpleGraph V'} (f : G ↪g G') {u : V} {v : V} (p : SimpleGraph.Path G u v) :
                                                                            SimpleGraph.Path G' (f u) (f v)

                                                                            Given a graph embedding, map paths to paths.

                                                                            Instances For

                                                                              ### Transferring between graphs

                                                                              def SimpleGraph.Walk.transfer {V : Type u} {G : SimpleGraph V} {u : V} {v : V} (p : SimpleGraph.Walk G u v) (H : SimpleGraph V) (h : ∀ (e : Sym2 V), e SimpleGraph.Walk.edges pe SimpleGraph.edgeSet H) :

                                                                              The walk p transferred to lie in H, given that H contains its edges.

                                                                              Equations
                                                                              • One or more equations did not get rendered due to their size.
                                                                              • SimpleGraph.Walk.transfer SimpleGraph.Walk.nil H h_2 = SimpleGraph.Walk.nil
                                                                              Instances For
                                                                                theorem SimpleGraph.Walk.transfer_self {V : Type u} {G : SimpleGraph V} {u : V} {v : V} (p : SimpleGraph.Walk G u v) :

                                                                                Deleting edges #

                                                                                @[reducible]
                                                                                def SimpleGraph.Walk.toDeleteEdges {V : Type u} {G : SimpleGraph V} (s : Set (Sym2 V)) {v : V} {w : V} (p : SimpleGraph.Walk G v w) (hp : ∀ (e : Sym2 V), e SimpleGraph.Walk.edges p¬e s) :

                                                                                Given a walk that avoids a set of edges, produce a walk in the graph with those edges deleted.

                                                                                Instances For
                                                                                  @[simp]
                                                                                  theorem SimpleGraph.Walk.toDeleteEdges_nil {V : Type u} {G : SimpleGraph V} (s : Set (Sym2 V)) {v : V} (hp : ∀ (e : Sym2 V), e SimpleGraph.Walk.edges SimpleGraph.Walk.nil¬e s) :
                                                                                  SimpleGraph.Walk.toDeleteEdges s SimpleGraph.Walk.nil hp = SimpleGraph.Walk.nil
                                                                                  @[simp]
                                                                                  theorem SimpleGraph.Walk.toDeleteEdges_cons {V : Type u} {G : SimpleGraph V} (s : Set (Sym2 V)) {u : V} {v : V} {w : V} (h : SimpleGraph.Adj G u v) (p : SimpleGraph.Walk G v w) (hp : ∀ (e : Sym2 V), e SimpleGraph.Walk.edges (SimpleGraph.Walk.cons h p)¬e s) :
                                                                                  @[inline, reducible]
                                                                                  abbrev SimpleGraph.Walk.toDeleteEdge {V : Type u} {G : SimpleGraph V} {v : V} {w : V} (e : Sym2 V) (p : SimpleGraph.Walk G v w) (hp : ¬e SimpleGraph.Walk.edges p) :

                                                                                  Given a walk that avoids an edge, create a walk in the subgraph with that edge deleted. This is an abbreviation for SimpleGraph.Walk.toDeleteEdges.

                                                                                  Instances For
                                                                                    @[simp]
                                                                                    theorem SimpleGraph.Walk.toDeleteEdges_copy {V : Type u} {G : SimpleGraph V} {u : V} {v : V} {u' : V} {v' : V} (s : Set (Sym2 V)) (p : SimpleGraph.Walk G u v) (hu : u = u') (hv : v = v') (h : ∀ (e : Sym2 V), e SimpleGraph.Walk.edges (SimpleGraph.Walk.copy p hu hv)¬e s) :

                                                                                    Reachable and Connected #

                                                                                    def SimpleGraph.Reachable {V : Type u} (G : SimpleGraph V) (u : V) (v : V) :

                                                                                    Two vertices are reachable if there is a walk between them. This is equivalent to Relation.ReflTransGen of G.Adj. See SimpleGraph.reachable_iff_reflTransGen.

                                                                                    Instances For
                                                                                      theorem SimpleGraph.Reachable.elim {V : Type u} {G : SimpleGraph V} {p : Prop} {u : V} {v : V} (h : SimpleGraph.Reachable G u v) (hp : SimpleGraph.Walk G u vp) :
                                                                                      p
                                                                                      theorem SimpleGraph.Reachable.elim_path {V : Type u} {G : SimpleGraph V} {p : Prop} {u : V} {v : V} (h : SimpleGraph.Reachable G u v) (hp : SimpleGraph.Path G u vp) :
                                                                                      p
                                                                                      theorem SimpleGraph.Walk.reachable {V : Type u} {G : SimpleGraph V} {u : V} {v : V} (p : SimpleGraph.Walk G u v) :
                                                                                      theorem SimpleGraph.Adj.reachable {V : Type u} {G : SimpleGraph V} {u : V} {v : V} (h : SimpleGraph.Adj G u v) :
                                                                                      theorem SimpleGraph.Reachable.symm {V : Type u} {G : SimpleGraph V} {u : V} {v : V} (huv : SimpleGraph.Reachable G u v) :
                                                                                      theorem SimpleGraph.Reachable.trans {V : Type u} {G : SimpleGraph V} {u : V} {v : V} {w : V} (huv : SimpleGraph.Reachable G u v) (hvw : SimpleGraph.Reachable G v w) :
                                                                                      theorem SimpleGraph.Reachable.map {V : Type u} {V' : Type v} {u : V} {v : V} {G : SimpleGraph V} {G' : SimpleGraph V'} (f : G →g G') (h : SimpleGraph.Reachable G u v) :
                                                                                      SimpleGraph.Reachable G' (f u) (f v)
                                                                                      theorem SimpleGraph.Reachable.mono {V : Type u} {u : V} {v : V} {G : SimpleGraph V} {G' : SimpleGraph V} (h : G G') (Guv : SimpleGraph.Reachable G u v) :
                                                                                      theorem SimpleGraph.Iso.reachable_iff {V : Type u} {V' : Type v} {G : SimpleGraph V} {G' : SimpleGraph V'} {φ : G ≃g G'} {u : V} {v : V} :
                                                                                      SimpleGraph.Reachable G' (φ u) (φ v) SimpleGraph.Reachable G u v
                                                                                      theorem SimpleGraph.Iso.symm_apply_reachable {V : Type u} {V' : Type v} {G : SimpleGraph V} {G' : SimpleGraph V'} {φ : G ≃g G'} {u : V} {v : V'} :

                                                                                      The equivalence relation on vertices given by SimpleGraph.Reachable.

                                                                                      Instances For

                                                                                        A graph is preconnected if every pair of vertices is reachable from one another.

                                                                                        Instances For
                                                                                          structure SimpleGraph.Connected {V : Type u} (G : SimpleGraph V) :

                                                                                          A graph is connected if it's preconnected and contains at least one vertex. This follows the convention observed by mathlib that something is connected iff it has exactly one connected component.

                                                                                          There is a CoeFun instance so that h u v can be used instead of h.Preconnected u v.

                                                                                          Instances For
                                                                                            theorem SimpleGraph.Connected.map {V : Type u} {V' : Type v} {G : SimpleGraph V} {H : SimpleGraph V'} (f : G →g H) (hf : Function.Surjective f) (hG : SimpleGraph.Connected G) :

                                                                                            The quotient of V by the SimpleGraph.Reachable relation gives the connected components of a graph.

                                                                                            Instances For

                                                                                              Gives the connected component containing a particular vertex.

                                                                                              Instances For
                                                                                                def SimpleGraph.ConnectedComponent.lift {V : Type u} {G : SimpleGraph V} {β : Sort u_1} (f : Vβ) (h : ∀ (v w : V) (p : SimpleGraph.Walk G v w), SimpleGraph.Walk.IsPath pf v = f w) :

                                                                                                The ConnectedComponent specialization of Quot.lift. Provides the stronger assumption that the vertices are connected by a path.

                                                                                                Instances For
                                                                                                  @[simp]
                                                                                                  theorem SimpleGraph.ConnectedComponent.lift_mk {V : Type u} {G : SimpleGraph V} {β : Sort u_1} {f : Vβ} {h : ∀ (v w : V) (p : SimpleGraph.Walk G v w), SimpleGraph.Walk.IsPath pf v = f w} {v : V} :

                                                                                                  The map on connected components induced by a graph homomorphism.

                                                                                                  Instances For

                                                                                                    An isomorphism of graphs induces a bijection of connected components.

                                                                                                    Instances For

                                                                                                      The set of vertices in a connected component of a graph.

                                                                                                      Instances For
                                                                                                        theorem SimpleGraph.ConnectedComponent.supp_injective {V : Type u} {G : SimpleGraph V} :
                                                                                                        Function.Injective SimpleGraph.ConnectedComponent.supp

                                                                                                        The equivalence between connected components, induced by an isomorphism of graphs, itself defines an equivalence on the supports of each connected component.

                                                                                                        Instances For
                                                                                                          theorem SimpleGraph.Connected.set_univ_walk_nonempty {V : Type u} {G : SimpleGraph V} (hconn : SimpleGraph.Connected G) (u : V) (v : V) :
                                                                                                          Set.Nonempty Set.univ

                                                                                                          Walks as subgraphs #

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

                                                                                                          The subgraph consisting of the vertices and edges of the walk.

                                                                                                          Equations
                                                                                                          Instances For
                                                                                                            @[simp]
                                                                                                            theorem SimpleGraph.Walk.verts_toSubgraph {V : Type u} {G : SimpleGraph V} {u : V} {v : V} (p : SimpleGraph.Walk G u v) :