Documentation

Mathlib.Combinatorics.Graph.Subgraph

Subgraphs of multigraphs #

This file develops the basic theory of subgraphs for multigraphs Graph α β: the subgraph relation, standard classes of subgraphs (spanning, induced, closed), and components.

Main definitions #

Implementation notes #

Following the overall design of Graph, subgraphs are terms of the same type Graph α β rather than a separate Subgraph structure. This allows us to reuse notation and lemmas uniformly and to express the subgraph order directly as a partial order on Graph α β.

G ≤ H is the canonical spelling for "G is a subgraph of H". This is definitionally equal to G.IsSubgraph H which exists only for implementation reasons. The explicit IsSubgraph structure is defined so that stronger subgraph notions (such as IsSpanningSubgraph, IsInducedSubgraph, and IsClosedSubgraph) can extend it. This allows them to inherit fundamental fields and lemmas like vertexSet_mono and edgeSet_mono without lemma duplication. However, in statements and proofs, users use G ≤ H instead. The relation is the simp normal form, and the API is developed entirely in terms of it.

Tags #

graphs, subgraph, induced subgraph, spanning subgraph, closed subgraph

structure Graph.IsSubgraph {α : Type u_1} {β : Type u_2} (H G : Graph α β) :

IsSubgraph H G is NOT the preferred spelling for the subgraph relation. Please use H ≤ G instead.

Instances For
    theorem Graph.isSubgraph_iff {α : Type u_1} {β : Type u_2} (H G : Graph α β) :
    theorem Graph.IsSubgraph.trans {α : Type u_1} {β : Type u_2} {G G₁ H : Graph α β} (h₁ : H.IsSubgraph G) (h₂ : G.IsSubgraph G₁) :
    H.IsSubgraph G₁
    theorem Graph.IsSubgraph.antisymm {α : Type u_1} {β : Type u_2} {G H : Graph α β} (h₁ : H.IsSubgraph G) (h₂ : G.IsSubgraph H) :
    H = G
    @[implicit_reducible]
    instance Graph.instPartialOrder {α : Type u_1} {β : Type u_2} :

    H ≤ G means H is a subgraph of G. It is defined as V(H) ⊆ V(G) and every link of H being a link of G.

    Equations
    @[simp]
    theorem Graph.isSubgraph_iff_le {α : Type u_1} {β : Type u_2} {G H : Graph α β} :
    theorem Graph.IsLink.mono {α : Type u_1} {β : Type u_2} {x y : α} {e : β} {G H : Graph α β} (hHG : H G) (h : H.IsLink e x y) :
    G.IsLink e x y
    theorem Graph.IsSubgraph.edgeSet_mono {α : Type u_1} {β : Type u_2} {G H : Graph α β} (h : H G) :
    theorem Graph.Compatible.of_le_le {α : Type u_1} {β : Type u_2} {G H₁ H₂ : Graph α β} (hH₁G : H₁ G) (hH₂G : H₂ G) :
    H₁.Compatible H₂

    Two subgraphs of the same graph are compatible.

    theorem Graph.Compatible.of_le {α : Type u_1} {β : Type u_2} {G H : Graph α β} (hHG : H G) :
    theorem Graph.Compatible.of_ge {α : Type u_1} {β : Type u_2} {G H : Graph α β} (hHG : G H) :
    theorem Graph.Compatible.anti_left {α : Type u_1} {β : Type u_2} {G G₁ H : Graph α β} (hG₁G : G₁ G) (h : G.Compatible H) :
    G₁.Compatible H
    theorem Graph.Compatible.anti_right {α : Type u_1} {β : Type u_2} {G H H₁ : Graph α β} (hH₁H : H₁ H) (h : G.Compatible H) :
    G.Compatible H₁
    theorem Graph.Compatible.anti {α : Type u_1} {β : Type u_2} {G G₁ H H₁ : Graph α β} (hG₁G : G₁ G) (hH₁H : H₁ H) (h : G.Compatible H) :
    G₁.Compatible H₁
    theorem Graph.Inc.mono {α : Type u_1} {β : Type u_2} {x : α} {e : β} {G H : Graph α β} (hHG : H G) (h : H.Inc e x) :
    G.Inc e x
    theorem Graph.IsSubgraph.inc_congr {α : Type u_1} {β : Type u_2} {x : α} {e : β} {G H : Graph α β} (hHG : H G) (he : e H.edgeSet) :
    H.Inc e x G.Inc e x
    theorem Graph.IsSubgraph.inc_eqOn {α : Type u_1} {β : Type u_2} {G H : Graph α β} (hHG : H G) :
    theorem Graph.IsLoopAt.mono {α : Type u_1} {β : Type u_2} {x : α} {e : β} {G H : Graph α β} (hHG : H G) (h : H.IsLoopAt e x) :
    G.IsLoopAt e x
    theorem Graph.IsSubgraph.isLoopAt_congr {α : Type u_1} {β : Type u_2} {x : α} {e : β} {G H : Graph α β} (hHG : H G) (he : e H.edgeSet) :
    H.IsLoopAt e x G.IsLoopAt e x
    theorem Graph.IsSubgraph.isLoopAt_eqOn {α : Type u_1} {β : Type u_2} {G H : Graph α β} (hHG : H G) :
    theorem Graph.IsNonloopAt.mono {α : Type u_1} {β : Type u_2} {x : α} {e : β} {G H : Graph α β} (hHG : H G) (h : H.IsNonloopAt e x) :
    theorem Graph.IsSubgraph.isNonloopAt_congr {α : Type u_1} {β : Type u_2} {x : α} {e : β} {G H : Graph α β} (hHG : H G) (he : e H.edgeSet) :
    theorem Graph.IsSubgraph.isNonloopAt_eqOn {α : Type u_1} {β : Type u_2} {G H : Graph α β} (hHG : H G) :
    theorem Graph.Adj.mono {α : Type u_1} {β : Type u_2} {x y : α} {G H : Graph α β} (hHG : H G) (h : H.Adj x y) :
    G.Adj x y
    theorem Graph.Compatible.le_iff {α : Type u_1} {β : Type u_2} {H₁ H₂ : Graph α β} (hH : H₁.Compatible H₂) :
    H₁ H₂ H₁.vertexSet H₂.vertexSet H₁.edgeSet H₂.edgeSet
    theorem Graph.Compatible.ext {α : Type u_1} {β : Type u_2} {H₁ H₂ : Graph α β} (hV : H₁.vertexSet = H₂.vertexSet) (hE : H₁.edgeSet = H₂.edgeSet) (h : H₁.Compatible H₂) :
    H₁ = H₂
    theorem Graph.vertexSet_ssubset_or_edgeSet_ssubset_of_lt {α : Type u_1} {β : Type u_2} {G H : Graph α β} (hGH : G < H) :

    Spanning Subgraphs #

    structure Graph.IsSpanningSubgraph {α : Type u_1} {β : Type u_2} (H G : Graph α β) extends H.IsSubgraph G :

    H ≤s G (Graph.IsSpanningSubgraph) is a subgraph of G with the same vertex set.

    Instances For
      theorem Graph.isSpanningSubgraph_iff {α : Type u_1} {β : Type u_2} (H G : Graph α β) :

      H ≤s G (Graph.IsSpanningSubgraph) is a subgraph of G with the same vertex set.

      Equations
      Instances For
        theorem Graph.IsSpanningSubgraph.le {α : Type u_1} {β : Type u_2} {H G : Graph α β} (self : H ≤s G) :

        Alias of Graph.IsSpanningSubgraph.toIsSubgraph.

        theorem Graph.IsSpanningSubgraph.trans {α : Type u_1} {β : Type u_2} {G G₁ G₂ : Graph α β} (h₁ : G ≤s G₁) (h₂ : G₁ ≤s G₂) :
        G ≤s G₂
        instance Graph.IsSpanningSubgraph.instIsPartialOrder {α : Type u_1} {β : Type u_2} :
        IsPartialOrder (Graph α β) fun (x1 x2 : Graph α β) => x1 ≤s x2
        @[simp]
        theorem Graph.IsSpanningSubgraph.rfl {α : Type u_1} {β : Type u_2} {G : Graph α β} :
        G ≤s G
        theorem Graph.IsSpanningSubgraph.anti_right {α : Type u_1} {β : Type u_2} {G H K : Graph α β} (hHK : H K) (hKG : K G) (h : H ≤s G) :
        H ≤s K
        theorem Graph.IsSpanningSubgraph.mono_left {α : Type u_1} {β : Type u_2} {G H K : Graph α β} (hHK : H K) (hKG : K G) (h : H ≤s G) :
        K ≤s G
        theorem Graph.IsSpanningSubgraph.ext_of_edgeSet {α : Type u_1} {β : Type u_2} {G H : Graph α β} (hE : H.edgeSet = G.edgeSet) (h : H ≤s G) :
        H = G

        Induced Subgraphs #

        structure Graph.IsInducedSubgraph {α : Type u_1} {β : Type u_2} (H G : Graph α β) extends H.IsSubgraph G :

        H ≤i G (Graph.IsInducedSubgraph) is a subgraph of G such that every link of G involving two vertices of H is also a link of H.

        Instances For
          theorem Graph.isInducedSubgraph_iff {α : Type u_1} {β : Type u_2} (H G : Graph α β) :
          H.IsInducedSubgraph G H.IsSubgraph G ∀ ⦃e : β⦄ ⦃x y : α⦄, G.IsLink e x yx H.vertexSety H.vertexSetH.IsLink e x y

          H ≤i G (Graph.IsInducedSubgraph) is a subgraph of G such that every link of G involving two vertices of H is also a link of H.

          Equations
          Instances For
            theorem Graph.IsInducedSubgraph.le {α : Type u_1} {β : Type u_2} {H G : Graph α β} (self : H.IsInducedSubgraph G) :

            Alias of Graph.IsInducedSubgraph.toIsSubgraph.

            theorem Graph.IsInducedSubgraph.trans {α : Type u_1} {β : Type u_2} {G G₁ G₂ : Graph α β} (h₁ : G.IsInducedSubgraph G₁) (h₂ : G₁.IsInducedSubgraph G₂) :
            instance Graph.IsInducedSubgraph.instIsPartialOrder {α : Type u_1} {β : Type u_2} :
            IsPartialOrder (Graph α β) fun (x1 x2 : Graph α β) => x1.IsInducedSubgraph x2
            @[simp]
            theorem Graph.IsInducedSubgraph.rfl {α : Type u_1} {β : Type u_2} {G : Graph α β} :
            theorem Graph.IsInducedSubgraph.adj_congr {α : Type u_1} {β : Type u_2} {x y : α} {G H : Graph α β} (hx : x H.vertexSet) (hy : y H.vertexSet) (h : H.IsInducedSubgraph G) :
            H.Adj x y G.Adj x y
            theorem Graph.IsInducedSubgraph.anti_right {α : Type u_1} {β : Type u_2} {G H K : Graph α β} (hHK : H K) (hKG : K G) (h : H.IsInducedSubgraph G) :
            theorem Graph.IsInducedSubgraph.le_of_le_subset {α : Type u_1} {β : Type u_2} {G H K : Graph α β} (h' : K G) (hsu : K.vertexSet H.vertexSet) (h : H.IsInducedSubgraph G) :
            K H
            theorem Graph.IsInducedSubgraph.ext_of_vertexSet {α : Type u_1} {β : Type u_2} {G H : Graph α β} (hV : H.vertexSet = G.vertexSet) (h : H.IsInducedSubgraph G) :
            H = G
            theorem Graph.IsSubgraph.not_isInducedSubgraph_iff {α : Type u_1} {β : Type u_2} {G H : Graph α β} (hHG : H G) :
            ¬H.IsInducedSubgraph G ∃ (e : β) (x : α) (y : α), G.IsLink e x y x H.vertexSet y H.vertexSet eH.edgeSet

            Closed Subgraphs #

            structure Graph.IsClosedSubgraph {α : Type u_1} {β : Type u_2} (H G : Graph α β) extends H.IsInducedSubgraph G :

            H ≤c G (Graph.IsClosedSubgraph) is a union of components of G.

            Instances For
              theorem Graph.isClosedSubgraph_iff {α : Type u_1} {β : Type u_2} (H G : Graph α β) :
              H.IsClosedSubgraph G H.IsInducedSubgraph G ∀ ⦃e : β⦄ ⦃x : α⦄, G.Inc e xx H.vertexSete H.edgeSet

              H ≤c G (Graph.IsClosedSubgraph) is a union of components of G.

              Equations
              Instances For
                theorem Graph.IsClosedSubgraph.mk' {α : Type u_1} {β : Type u_2} {G H : Graph α β} (hHG : H G) (hclosed : ∀ ⦃e : β⦄ ⦃x : α⦄, G.Inc e xx H.vertexSete H.edgeSet) :
                theorem Graph.IsClosedSubgraph.trans {α : Type u_1} {β : Type u_2} {G G₁ G₂ : Graph α β} (h₁ : G.IsClosedSubgraph G₁) (h₂ : G₁.IsClosedSubgraph G₂) :
                instance Graph.IsClosedSubgraph.instIsPartialOrder {α : Type u_1} {β : Type u_2} :
                IsPartialOrder (Graph α β) fun (x1 x2 : Graph α β) => x1.IsClosedSubgraph x2
                @[simp]
                theorem Graph.IsClosedSubgraph.rfl {α : Type u_1} {β : Type u_2} {G : Graph α β} :
                theorem Graph.IsClosedSubgraph.inc_congr {α : Type u_1} {β : Type u_2} {x : α} {e : β} {G H : Graph α β} (hx : x H.vertexSet) (hHG : H.IsClosedSubgraph G) :
                H.Inc e x G.Inc e x
                theorem Graph.IsClosedSubgraph.adj_congr {α : Type u_1} {β : Type u_2} {x y : α} {G H : Graph α β} (hx : x H.vertexSet) (hHG : H.IsClosedSubgraph G) :
                H.Adj x y G.Adj x y
                theorem Graph.IsClosedSubgraph.mem_iff_of_adj {α : Type u_1} {β : Type u_2} {x y : α} {G H : Graph α β} (hxy : G.Adj x y) (hHG : H.IsClosedSubgraph G) :
                theorem Graph.IsClosedSubgraph.anti_right {α : Type u_1} {β : Type u_2} {G G₁ H : Graph α β} (hHG₁ : H G₁) (hG₁ : G₁ G) (hHG : H.IsClosedSubgraph G) :
                theorem Graph.IsInducedSubgraph.not_isClosedSubgraph_iff_exists_adj {α : Type u_1} {β : Type u_2} {G H : Graph α β} (hHG : H.IsInducedSubgraph G) :
                ¬H.IsClosedSubgraph G ∃ (x : α) (y : α), G.Adj x y x H.vertexSet yH.vertexSet