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)
    Equations
    • SimpleGraph.instDecidableEqWalk = SimpleGraph.decEqWalk✝
    @[simp]
    theorem SimpleGraph.Walk.instInhabited_default {V : Type u} (G : SimpleGraph V) (v : V) :
    default = SimpleGraph.Walk.nil
    Equations
    @[match_pattern, reducible]
    def SimpleGraph.Adj.toWalk {V : Type u} {G : SimpleGraph V} {u : V} {v : V} (h : G.Adj u v) :

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

    Equations
    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.

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

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

        Equations
        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."

          Equations
          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 : G.Adj 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 : G.Adj 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 : V) (h : G.Adj u w) (p' : SimpleGraph.Walk G w v), 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 : G.Adj v w) :

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

                Equations
                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 : G.Adj 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.

                    Equations
                    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) :
                        theorem SimpleGraph.Walk.adj_getVert_succ {V : Type u} {G : SimpleGraph V} {u : V} {v : V} (w : SimpleGraph.Walk G u v) {i : } (hi : i < SimpleGraph.Walk.length w) :
                        @[simp]
                        theorem SimpleGraph.Walk.cons_append {V : Type u} {G : SimpleGraph V} {u : V} {v : V} {w : V} {x : V} (h : G.Adj u v) (p : SimpleGraph.Walk G v w) (q : SimpleGraph.Walk G w x) :
                        @[simp]
                        theorem SimpleGraph.Walk.cons_nil_append {V : Type u} {G : SimpleGraph V} {u : V} {v : V} {w : V} (h : G.Adj 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 : G.Adj 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 : G.Adj u v) (p : SimpleGraph.Walk G v w) (h' : G.Adj w x) :
                        theorem SimpleGraph.Walk.append_concat {V : Type u} {G : SimpleGraph V} {u : V} {v : V} {w : V} {x : V} (p : SimpleGraph.Walk G u v) (q : SimpleGraph.Walk G v w) (h : G.Adj w x) :
                        theorem SimpleGraph.Walk.concat_append {V : Type u} {G : SimpleGraph V} {u : V} {v : V} {w : V} {x : V} (p : SimpleGraph.Walk G u v) (h : G.Adj v w) (q : SimpleGraph.Walk G w x) :
                        theorem SimpleGraph.Walk.exists_cons_eq_concat {V : Type u} {G : SimpleGraph V} {u : V} {v : V} {w : V} (h : G.Adj u v) (p : SimpleGraph.Walk G v w) :
                        ∃ (x : V) (q : SimpleGraph.Walk G u x) (h' : G.Adj x w), SimpleGraph.Walk.cons h p = SimpleGraph.Walk.concat q h'

                        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 : G.Adj v w) :
                        ∃ (x : V) (h' : G.Adj u x) (q : SimpleGraph.Walk G x w), SimpleGraph.Walk.concat p h = SimpleGraph.Walk.cons h' q

                        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 : G.Adj u v) :
                        SimpleGraph.Walk.reverse (SimpleGraph.Walk.cons h SimpleGraph.Walk.nil) = SimpleGraph.Walk.cons (_ : G.Adj v u) SimpleGraph.Walk.nil
                        @[simp]
                        theorem SimpleGraph.Walk.cons_reverseAux {V : Type u} {G : SimpleGraph V} {u : V} {v : V} {w : V} {x : V} (p : SimpleGraph.Walk G u v) (q : SimpleGraph.Walk G w x) (h : G.Adj w u) :
                        @[simp]
                        theorem SimpleGraph.Walk.reverse_cons {V : Type u} {G : SimpleGraph V} {u : V} {v : V} {w : V} (h : G.Adj u v) (p : SimpleGraph.Walk G v w) :
                        @[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.reverse_concat {V : Type u} {G : SimpleGraph V} {u : V} {v : V} {w : V} (p : SimpleGraph.Walk G u v) (h : G.Adj v w) :
                        @[simp]
                        theorem SimpleGraph.Walk.length_nil {V : Type u} {G : SimpleGraph V} {u : V} :
                        SimpleGraph.Walk.length SimpleGraph.Walk.nil = 0
                        @[simp]
                        theorem SimpleGraph.Walk.length_cons {V : Type u} {G : SimpleGraph V} {u : V} {v : V} {w : V} (h : G.Adj u v) (p : SimpleGraph.Walk G v w) :
                        @[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') :
                        @[simp]
                        theorem SimpleGraph.Walk.length_concat {V : Type u} {G : SimpleGraph V} {u : V} {v : V} {w : V} (p : SimpleGraph.Walk G u v) (h : G.Adj v w) :
                        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 G u v), 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 : G.Adj 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 : G.Adj 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.

                          Equations
                          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 : G.Adj v w) → motive u v pmotive u w (SimpleGraph.Walk.concat p h)) (u : V) :
                            SimpleGraph.Walk.concatRec Hnil Hconcat SimpleGraph.Walk.nil = Hnil
                            @[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 : G.Adj 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 : G.Adj v w) :
                            SimpleGraph.Walk.concatRec Hnil Hconcat (SimpleGraph.Walk.concat p h) = Hconcat 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 : G.Adj 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 : G.Adj v w} {p' : SimpleGraph.Walk G u v'} {h' : G.Adj v' w} (he : SimpleGraph.Walk.concat p h = SimpleGraph.Walk.concat p' h') :
                            ∃ (hv : v = v'), 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.

                                Equations
                                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_cons {V : Type u} {G : SimpleGraph V} {u : V} {v : V} {w : V} (h : G.Adj u v) (p : SimpleGraph.Walk G v w) :
                                  @[simp]
                                  theorem SimpleGraph.Walk.support_concat {V : Type u} {G : SimpleGraph V} {u : V} {v : V} {w : V} (p : SimpleGraph.Walk G u v) (h : G.Adj v w) :
                                  @[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 : G.Adj u v) (p : SimpleGraph.Walk G v w) :
                                  theorem SimpleGraph.Walk.chain_dartAdj_darts {V : Type u} {G : SimpleGraph V} {d : SimpleGraph.Dart G} {v : V} {w : V} (h : d.toProd.2 = 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 : s(x, y) SimpleGraph.Walk.edges p) :
                                  G.Adj x y
                                  @[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 : G.Adj 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 : G.Adj 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_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_cons {V : Type u} {G : SimpleGraph V} {u : V} {v : V} {w : V} (h : G.Adj u v) (p : SimpleGraph.Walk G v w) :
                                  @[simp]
                                  theorem SimpleGraph.Walk.edges_concat {V : Type u} {G : SimpleGraph V} {u : V} {v : V} {w : V} (p : SimpleGraph.Walk G u v) (h : G.Adj v w) :
                                  @[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') :
                                  theorem SimpleGraph.Walk.fst_mem_support_of_mem_edges {V : Type u} {G : SimpleGraph V} {t : V} {u : V} {v : V} {w : V} (p : SimpleGraph.Walk G v w) (he : s(t, u) SimpleGraph.Walk.edges p) :
                                  theorem SimpleGraph.Walk.snd_mem_support_of_mem_edges {V : Type u} {G : SimpleGraph V} {t : V} {u : V} {v : V} {w : V} (p : SimpleGraph.Walk G v w) (he : s(t, u) SimpleGraph.Walk.edges p) :
                                  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 : G.Adj u v} {p : SimpleGraph.Walk G v w} :
                                    instance SimpleGraph.Walk.instDecidableNil {V : Type u} {G : SimpleGraph V} {v : V} {w : V} (p : SimpleGraph.Walk G v w) :
                                    Equations
                                    • One or more equations did not get rendered due to their size.
                                    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} :
                                    ¬SimpleGraph.Walk.Nil p ∃ (u : V) (h : G.Adj v u) (q : SimpleGraph.Walk G u w), p = SimpleGraph.Walk.cons h q
                                    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 : G.Adj u v) → (q : SimpleGraph.Walk G v w) → motive (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 p hp
                                    Equations
                                    • One or more equations did not get rendered due to their size.
                                    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.

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

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

                                        Equations
                                        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.

                                          Equations
                                          Instances For
                                            @[simp]
                                            @[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.IsTrail.of_cons {V : Type u} {G : SimpleGraph V} {u : V} {v : V} {w : V} {h : G.Adj u v} {p : SimpleGraph.Walk G v w} :
                                                    @[simp]
                                                    theorem SimpleGraph.Walk.cons_isTrail_iff {V : Type u} {G : SimpleGraph V} {u : V} {v : V} {w : V} (h : G.Adj u v) (p : SimpleGraph.Walk G v w) :
                                                    theorem SimpleGraph.Walk.IsPath.nil {V : Type u} {G : SimpleGraph V} {u : V} :
                                                    SimpleGraph.Walk.IsPath SimpleGraph.Walk.nil
                                                    theorem SimpleGraph.Walk.IsPath.of_cons {V : Type u} {G : SimpleGraph V} {u : V} {v : V} {w : V} {h : G.Adj u v} {p : SimpleGraph.Walk G v w} :
                                                    theorem SimpleGraph.Walk.IsPath.cons {V : Type u} {G : SimpleGraph V} {u : V} {v : V} :
                                                    ∀ {a : V} {p : SimpleGraph.Walk G v a}, SimpleGraph.Walk.IsPath puSimpleGraph.Walk.support p∀ {h : G.Adj u v}, SimpleGraph.Walk.IsPath (SimpleGraph.Walk.cons h p)
                                                    @[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.

                                                        Equations
                                                        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 : vS) :
                                                          ∃ d ∈ SimpleGraph.Walk.darts p, d.toProd.1 S d.toProd.2S

                                                          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.

                                                          Equations
                                                          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.

                                                            Equations
                                                            Instances For
                                                              @[simp]
                                                              theorem SimpleGraph.Path.singleton_coe {V : Type u} {G : SimpleGraph V} {u : V} {v : V} (h : G.Adj 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 : G.Adj u v) :

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

                                                              Equations
                                                              Instances For
                                                                theorem SimpleGraph.Path.mk'_mem_edges_singleton {V : Type u} {G : SimpleGraph V} {u : V} {v : V} (h : G.Adj u v) :
                                                                @[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.

                                                                Equations
                                                                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
                                                                  theorem SimpleGraph.Path.not_mem_edges_of_loop {V : Type u} {G : SimpleGraph V} {v : V} {e : Sym2 V} {p : SimpleGraph.Path G v v} :
                                                                  theorem SimpleGraph.Path.cons_isCycle {V : Type u} {G : SimpleGraph V} {u : V} {v : V} (p : SimpleGraph.Path G v u) (h : G.Adj u v) (he : s(u, v)SimpleGraph.Walk.edges p) :

                                                                  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.

                                                                    Equations
                                                                    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 : G.Adj 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') :
                                                                        @[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.

                                                                        Equations
                                                                        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 reverse direction of SimpleGraph.Walk.mapLe_isPath.

                                                                          Alias of the forward 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.

                                                                          Equations
                                                                          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.

                                                                            Equations
                                                                            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 : eSimpleGraph.Walk.edges p, e 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 : eSimpleGraph.Walk.edges p, es) :

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

                                                                                Equations
                                                                                Instances For
                                                                                  @[simp]
                                                                                  theorem SimpleGraph.Walk.toDeleteEdges_nil {V : Type u} {G : SimpleGraph V} (s : Set (Sym2 V)) {v : V} (hp : eSimpleGraph.Walk.edges SimpleGraph.Walk.nil, es) :
                                                                                  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 : G.Adj u v) (p : SimpleGraph.Walk G v w) (hp : eSimpleGraph.Walk.edges (SimpleGraph.Walk.cons h p), es) :
                                                                                  @[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 : eSimpleGraph.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.

                                                                                  Equations
                                                                                  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 : eSimpleGraph.Walk.edges (SimpleGraph.Walk.copy p hu hv), es) :

                                                                                    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.

                                                                                    Equations
                                                                                    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 : G.Adj 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} :
                                                                                      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.

                                                                                      Equations
                                                                                      Instances For

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

                                                                                        Equations
                                                                                        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.

                                                                                            Equations
                                                                                            Instances For

                                                                                              Gives the connected component containing a particular vertex.

                                                                                              Equations
                                                                                              Instances For
                                                                                                Equations
                                                                                                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.

                                                                                                Equations
                                                                                                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.

                                                                                                  Equations
                                                                                                  • One or more equations did not get rendered due to their size.
                                                                                                  Instances For

                                                                                                    An isomorphism of graphs induces a bijection of connected components.

                                                                                                    Equations
                                                                                                    • One or more equations did not get rendered due to their size.
                                                                                                    Instances For

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

                                                                                                      Equations
                                                                                                      Instances For
                                                                                                        theorem SimpleGraph.ConnectedComponent.supp_injective {V : Type u} {G : SimpleGraph V} :
                                                                                                        Function.Injective SimpleGraph.ConnectedComponent.supp
                                                                                                        Equations
                                                                                                        • SimpleGraph.ConnectedComponent.instSetLikeConnectedComponent = { coe := SimpleGraph.ConnectedComponent.supp, coe_injective' := (_ : 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.

                                                                                                        Equations
                                                                                                        • One or more equations did not get rendered due to their size.
                                                                                                        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) :

                                                                                                            Walks of a given length #

                                                                                                            theorem SimpleGraph.set_walk_self_length_zero_eq {V : Type u} {G : SimpleGraph V} (u : V) :
                                                                                                            {p : SimpleGraph.Walk G u u | SimpleGraph.Walk.length p = 0} = {SimpleGraph.Walk.nil}
                                                                                                            theorem SimpleGraph.set_walk_length_zero_eq_of_ne {V : Type u} {G : SimpleGraph V} {u : V} {v : V} (h : u v) :
                                                                                                            theorem SimpleGraph.set_walk_length_succ_eq {V : Type u} {G : SimpleGraph V} (u : V) (v : V) (n : ) :
                                                                                                            {p : SimpleGraph.Walk G u v | SimpleGraph.Walk.length p = Nat.succ n} = ⋃ (w : V), ⋃ (h : G.Adj u w), SimpleGraph.Walk.cons h '' {p' : SimpleGraph.Walk G w v | SimpleGraph.Walk.length p' = n}

                                                                                                            Walks of length two from u to v correspond bijectively to common neighbours of u and v. Note that u and v may be the same.

                                                                                                            Equations
                                                                                                            • One or more equations did not get rendered due to their size.
                                                                                                            Instances For

                                                                                                              The Finset of length-n walks from u to v. This is used to give {p : G.walk u v | p.length = n} a Fintype instance, and it can also be useful as a recursive description of this set when V is finite.

                                                                                                              See SimpleGraph.coe_finsetWalkLength_eq for the relationship between this Finset and the set of length-n walks.

                                                                                                              Equations
                                                                                                              Instances For
                                                                                                                Equations
                                                                                                                • One or more equations did not get rendered due to their size.
                                                                                                                Equations
                                                                                                                • One or more equations did not get rendered due to their size.
                                                                                                                Equations
                                                                                                                • One or more equations did not get rendered due to their size.
                                                                                                                Equations
                                                                                                                • One or more equations did not get rendered due to their size.

                                                                                                                Bridge edges #

                                                                                                                def SimpleGraph.IsBridge {V : Type u} (G : SimpleGraph V) (e : Sym2 V) :

                                                                                                                An edge of a graph is a bridge if, after removing it, its incident vertices are no longer reachable from one another.

                                                                                                                Equations
                                                                                                                • One or more equations did not get rendered due to their size.
                                                                                                                Instances For
                                                                                                                  theorem SimpleGraph.isBridge_iff {V : Type u} {G : SimpleGraph V} {u : V} {v : V} :
                                                                                                                  theorem SimpleGraph.isBridge_iff_adj_and_forall_walk_mem_edges {V : Type u} {G : SimpleGraph V} {v : V} {w : V} :
                                                                                                                  SimpleGraph.IsBridge G s(v, w) G.Adj v w ∀ (p : SimpleGraph.Walk G v w), s(v, w) SimpleGraph.Walk.edges p
                                                                                                                  theorem SimpleGraph.isBridge_iff_adj_and_forall_cycle_not_mem {V : Type u} {G : SimpleGraph V} {v : V} {w : V} :
                                                                                                                  SimpleGraph.IsBridge G s(v, w) G.Adj v w ∀ ⦃u : V⦄ (p : SimpleGraph.Walk G u u), SimpleGraph.Walk.IsCycle ps(v, w)SimpleGraph.Walk.edges p