# Documentation

Mathlib.Combinatorics.SimpleGraph.Basic

# Simple graphs #

This module defines simple graphs on a vertex type V as an irreflexive symmetric relation.

There is a basic API for locally finite graphs and for graphs with finitely many vertices.

## Main definitions #

• SimpleGraph is a structure for symmetric, irreflexive relations

• SimpleGraph.neighborSet is the Set of vertices adjacent to a given vertex

• SimpleGraph.commonNeighbors is the intersection of the neighbor sets of two given vertices

• SimpleGraph.neighborFinset is the Finset of vertices adjacent to a given vertex, if neighborSet is finite

• SimpleGraph.incidenceSet is the Set of edges containing a given vertex

• SimpleGraph.incidenceFinset is the Finset of edges containing a given vertex, if incidenceSet is finite

• SimpleGraph.Dart is an ordered pair of adjacent vertices, thought of as being an orientated edge. These are also known as "half-edges" or "bonds."

• SimpleGraph.Hom, SimpleGraph.Embedding, and SimpleGraph.Iso for graph homomorphisms, graph embeddings, and graph isomorphisms. Note that a graph embedding is a stronger notion than an injective graph homomorphism, since its image is an induced subgraph.

• CompleteAtomicBooleanAlgebra instance: Under the subgraph relation, SimpleGraph forms a CompleteAtomicBooleanAlgebra. In other words, this is the complete lattice of spanning subgraphs of the complete graph.

## Notations #

• →g, ↪g, and ≃g for graph homomorphisms, graph embeddings, and graph isomorphisms, respectively.

## Implementation notes #

• A locally finite graph is one with instances Π v, Fintype (G.neighborSet v).

• Given instances DecidableRel G.Adj and Fintype V, then the graph is locally finite, too.

• Morphisms of graphs are abbreviations for RelHom, RelEmbedding, and RelIso. To make use of pre-existing simp lemmas, definitions involving morphisms are abbreviations as well.

## Naming Conventions #

• If the vertex type of a graph is finite, we refer to its cardinality as CardVerts.

## Todo #

• This is the simplest notion of an unoriented graph. This should eventually fit into a more complete combinatorics hierarchy which includes multigraphs and directed graphs. We begin with simple graphs in order to start learning what the combinatorics hierarchy should look like.

A variant of the aesop tactic for use in the graph library. Changes relative to standard aesop:

• We use the SimpleGraph rule set in addition to the default rule sets.
• We instruct Aesop's intro rule to unfold with default transparency.
• We instruct Aesop to fail if it can't fully solve the goal. This allows us to use aesop_graph for auto-params.
Instances For

Use aesop_graph? to pass along a Try this suggestion when using aesop_graph

Instances For

A variant of aesop_graph which does not fail if it is unable to solve the goal. Use this only for exploration! Nonterminal Aesop is even worse than nonterminal simp.

Instances For
theorem SimpleGraph.ext {V : Type u} (x : ) (y : ) (Adj : x.Adj = y.Adj) :
x = y
theorem SimpleGraph.ext_iff {V : Type u} (x : ) (y : ) :
structure SimpleGraph (V : Type u) :

A simple graph is an irreflexive symmetric relation Adj on a vertex type V. The relation describes which pairs of vertices are adjacent. There is exactly one edge for every pair of adjacent vertices; see SimpleGraph.edgeSet for the corresponding edge set.

Instances For
@[simp]
theorem SimpleGraph.mk'_apply_Adj {V : Type u} (x : { adj // (∀ (x y : V), adj x y = adj y x) ∀ (x : V), ¬adj x x = true }) (v : V) (w : V) :
SimpleGraph.Adj (SimpleGraph.mk' x) v w = (x v w = true)
def SimpleGraph.mk' {V : Type u} :
{ adj // (∀ (x y : V), adj x y = adj y x) ∀ (x : V), ¬adj x x = true }

Constructor for simple graphs using a symmetric irreflexive boolean function.

Instances For
instance instFintypeSimpleGraph {V : Type u} [] [] :

We can enumerate simple graphs by enumerating all functions V → V → Bool and filtering on whether they are symmetric and irreflexive.

def SimpleGraph.fromRel {V : Type u} (r : VVProp) :

Construct the simple graph induced by the given relation. It symmetrizes the relation and makes it irreflexive.

Instances For
@[simp]
theorem SimpleGraph.fromRel_adj {V : Type u} (r : VVProp) (v : V) (w : V) :
v w (r v w r w v)
def completeGraph (V : Type u) :

The complete graph on a type V is the simple graph with all pairs of distinct vertices adjacent. In Mathlib, this is usually referred to as ⊤.

Instances For
def emptyGraph (V : Type u) :

The graph with no edges on a given vertex type V. Mathlib prefers the notation ⊥.

Instances For
@[simp]
theorem completeBipartiteGraph_Adj (V : Type u_1) (W : Type u_2) (v : V W) (w : V W) :
= ( )
def completeBipartiteGraph (V : Type u_1) (W : Type u_2) :

Two vertices are adjacent in the complete bipartite graph on two vertex types if and only if they are not from the same side. Any bipartite graph may be regarded as a subgraph of one of these.

Instances For
@[simp]
theorem SimpleGraph.irrefl {V : Type u} (G : ) {v : V} :
theorem SimpleGraph.adj_comm {V : Type u} (G : ) (u : V) (v : V) :
theorem SimpleGraph.adj_symm {V : Type u} (G : ) {u : V} {v : V} (h : ) :
theorem SimpleGraph.Adj.symm {V : Type u} {G : } {u : V} {v : V} (h : ) :
theorem SimpleGraph.ne_of_adj {V : Type u} (G : ) {a : V} {b : V} (h : ) :
a b
theorem SimpleGraph.Adj.ne {V : Type u} {G : } {a : V} {b : V} (h : ) :
a b
theorem SimpleGraph.Adj.ne' {V : Type u} {G : } {a : V} {b : V} (h : ) :
b a
theorem SimpleGraph.ne_of_adj_of_not_adj {V : Type u} (G : ) {v : V} {w : V} {x : V} (h : ) (hn : ¬) :
v w
@[simp]
theorem SimpleGraph.adj_inj {V : Type u} {G : } {H : } :
def SimpleGraph.IsSubgraph {V : Type u} (x : ) (y : ) :

The relation that one SimpleGraph is a subgraph of another. Note that this should be spelled ≤.

Instances For
@[simp]
theorem SimpleGraph.isSubgraph_eq_le {V : Type u} :
SimpleGraph.IsSubgraph = fun x x_1 => x x_1

The supremum of two graphs x ⊔ y has edges where either x or y have edges.

@[simp]
theorem SimpleGraph.sup_adj {V : Type u} (x : ) (y : ) (v : V) (w : V) :

The infimum of two graphs x ⊓ y has edges where both x and y have edges.

@[simp]
theorem SimpleGraph.inf_adj {V : Type u} (x : ) (y : ) (v : V) (w : V) :
instance SimpleGraph.hasCompl {V : Type u} :

We define Gᶜ to be the SimpleGraph V such that no two adjacent vertices in G are adjacent in the complement, and every nonadjacent pair of vertices is adjacent (still ensuring that vertices are not adjacent to themselves).

@[simp]
theorem SimpleGraph.compl_adj {V : Type u} (G : ) (v : V) (w : V) :
v w ¬
instance SimpleGraph.sdiff {V : Type u} :

The difference of two graphs x \ y has the edges of x with the edges of y removed.

@[simp]
theorem SimpleGraph.sdiff_adj {V : Type u} (x : ) (y : ) (v : V) (w : V) :
instance SimpleGraph.supSet {V : Type u} :
instance SimpleGraph.infSet {V : Type u} :
@[simp]
theorem SimpleGraph.sSup_adj {V : Type u} {s : Set ()} {a : V} {b : V} :
SimpleGraph.Adj (sSup s) a b G, G s
@[simp]
theorem SimpleGraph.sInf_adj {V : Type u} {a : V} {b : V} {s : Set ()} :
SimpleGraph.Adj (sInf s) a b (∀ (G : ), G s) a b
@[simp]
theorem SimpleGraph.iSup_adj {ι : Sort u_1} {V : Type u} {a : V} {b : V} {f : ι} :
SimpleGraph.Adj (⨆ (i : ι), f i) a b i, SimpleGraph.Adj (f i) a b
@[simp]
theorem SimpleGraph.iInf_adj {ι : Sort u_1} {V : Type u} {a : V} {b : V} {f : ι} :
SimpleGraph.Adj (⨅ (i : ι), f i) a b (∀ (i : ι), SimpleGraph.Adj (f i) a b) a b
theorem SimpleGraph.sInf_adj_of_nonempty {V : Type u} {a : V} {b : V} {s : Set ()} (hs : ) :
SimpleGraph.Adj (sInf s) a b ∀ (G : ), G s
theorem SimpleGraph.iInf_adj_of_nonempty {ι : Sort u_1} {V : Type u} {a : V} {b : V} [] {f : ι} :
SimpleGraph.Adj (⨅ (i : ι), f i) a b ∀ (i : ι), SimpleGraph.Adj (f i) a b
instance SimpleGraph.distribLattice {V : Type u} :

For graphs G, H, G ≤ H iff ∀ a b, G.Adj a b → H.Adj a b.

@[simp]
theorem SimpleGraph.top_adj {V : Type u} (v : V) (w : V) :
v w
@[simp]
theorem SimpleGraph.bot_adj {V : Type u} (v : V) (w : V) :
@[simp]
instance SimpleGraph.Sup.adjDecidable (V : Type u) (G : ) (H : ) [DecidableRel G.Adj] [DecidableRel H.Adj] :
instance SimpleGraph.Inf.adjDecidable (V : Type u) (G : ) (H : ) [DecidableRel G.Adj] [DecidableRel H.Adj] :
instance SimpleGraph.Sdiff.adjDecidable (V : Type u) (G : ) (H : ) [DecidableRel G.Adj] [DecidableRel H.Adj] :
instance SimpleGraph.Compl.adjDecidable (V : Type u) (G : ) [DecidableRel G.Adj] [] :
def SimpleGraph.support {V : Type u} (G : ) :
Set V

G.support is the set of vertices that form edges in G.

Instances For
theorem SimpleGraph.mem_support {V : Type u} (G : ) {v : V} :
w,
theorem SimpleGraph.support_mono {V : Type u} {G : } {G' : } (h : G G') :
def SimpleGraph.neighborSet {V : Type u} (G : ) (v : V) :
Set V

G.neighborSet v is the set of vertices adjacent to v in G.

Instances For
instance SimpleGraph.neighborSet.memDecidable {V : Type u} (G : ) (v : V) [DecidableRel G.Adj] :
DecidablePred fun x =>

The edges of G consist of the unordered pairs of vertices related by G.Adj. This is the order embedding; for the edge set of a particular graph, see SimpleGraph.edgeSet.

The way edgeSet is defined is such that mem_edgeSet is proved by refl. (That is, ⟦(v, w)⟧ ∈ G.edgeSet is definitionally equal to G.Adj v w.)

Instances For
@[inline, reducible]
abbrev SimpleGraph.edgeSet {V : Type u} (G : ) :
Set (Sym2 V)

G.edgeSet is the edge set for G. This is an abbreviation for edgeSetEmbedding G that permits dot notation.

Instances For
@[simp]
theorem SimpleGraph.mem_edgeSet {V : Type u} (G : ) {v : V} {w : V} :
Quotient.mk () (v, w)
theorem SimpleGraph.not_isDiag_of_mem_edgeSet {V : Type u} (G : ) {e : Sym2 V} :
theorem SimpleGraph.edgeSet_inj {V : Type u} {G₁ : } {G₂ : } :
G₁ = G₂
@[simp]
theorem SimpleGraph.edgeSet_subset_edgeSet {V : Type u} {G₁ : } {G₂ : } :
G₁ G₂
@[simp]
theorem SimpleGraph.edgeSet_ssubset_edgeSet {V : Type u} {G₁ : } {G₂ : } :
G₁ < G₂
theorem SimpleGraph.edgeSet_injective {V : Type u} :
Function.Injective SimpleGraph.edgeSet
theorem SimpleGraph.edgeSet_mono {V : Type u} {G₁ : } {G₂ : } :
G₁ G₂

Alias of the reverse direction of SimpleGraph.edgeSet_subset_edgeSet.

theorem SimpleGraph.edgeSet_strict_mono {V : Type u} {G₁ : } {G₂ : } :
G₁ < G₂

Alias of the reverse direction of SimpleGraph.edgeSet_ssubset_edgeSet.

@[simp]
theorem SimpleGraph.edgeSet_bot {V : Type u} :
@[simp]
theorem SimpleGraph.edgeSet_sup {V : Type u} (G₁ : ) (G₂ : ) :
@[simp]
theorem SimpleGraph.edgeSet_inf {V : Type u} (G₁ : ) (G₂ : ) :
@[simp]
theorem SimpleGraph.edgeSet_sdiff {V : Type u} (G₁ : ) (G₂ : ) :
SimpleGraph.edgeSet (G₁ \ G₂) =
@[simp]
theorem SimpleGraph.edgeSet_sdiff_sdiff_isDiag {V : Type u} (G : ) (s : Set (Sym2 V)) :
\ (s \ {e | }) =

This lemma, combined with edgeSet_sdiff and edgeSet_from_edgeSet, allows proving (G \ from_edgeSet s).edge_set = G.edgeSet \ s by simp.

theorem SimpleGraph.adj_iff_exists_edge {V : Type u} (G : ) {v : V} {w : V} :
v w e, v e w e

Two vertices are adjacent iff there is an edge between them. The condition v ≠ w ensures they are different endpoints of the edge, which is necessary since when v = w the existential ∃ (e ∈ G.edgeSet), v ∈ e ∧ w ∈ e is satisfied by every edge incident to v.

theorem SimpleGraph.adj_iff_exists_edge_coe {V : Type u} (G : ) {a : V} {b : V} :
e, e = Quotient.mk () (a, b)
theorem SimpleGraph.edge_other_ne {V : Type u} (G : ) {e : Sym2 V} (he : ) {v : V} (h : v e) :
instance SimpleGraph.decidableMemEdgeSet {V : Type u} (G : ) [DecidableRel G.Adj] :
DecidablePred fun x =>
instance SimpleGraph.fintypeEdgeSet {V : Type u} (G : ) [Fintype (Sym2 V)] [DecidableRel G.Adj] :
instance SimpleGraph.fintypeEdgeSetSup {V : Type u} (G₁ : ) (G₂ : ) [] [] [] :
instance SimpleGraph.fintypeEdgeSetInf {V : Type u} (G₁ : ) (G₂ : ) [] [] [] :
instance SimpleGraph.fintypeEdgeSetSdiff {V : Type u} (G₁ : ) (G₂ : ) [] [] [] :
Fintype ↑(SimpleGraph.edgeSet (G₁ \ G₂))
def SimpleGraph.fromEdgeSet {V : Type u} (s : Set (Sym2 V)) :

fromEdgeSet constructs a SimpleGraph from a set of edges, without loops.

Instances For
@[simp]
theorem SimpleGraph.fromEdgeSet_adj {V : Type u} {v : V} {w : V} (s : Set (Sym2 V)) :
Quotient.mk () (v, w) s v w
@[simp]
theorem SimpleGraph.edgeSet_fromEdgeSet {V : Type u} (s : Set (Sym2 V)) :
= s \ {e | }
@[simp]
theorem SimpleGraph.fromEdgeSet_edgeSet {V : Type u} (G : ) :
@[simp]
@[simp]
theorem SimpleGraph.fromEdgeSet_inf {V : Type u} (s : Set (Sym2 V)) (t : Set (Sym2 V)) :
@[simp]
theorem SimpleGraph.fromEdgeSet_sup {V : Type u} (s : Set (Sym2 V)) (t : Set (Sym2 V)) :
@[simp]
theorem SimpleGraph.fromEdgeSet_sdiff {V : Type u} (s : Set (Sym2 V)) (t : Set (Sym2 V)) :
theorem SimpleGraph.fromEdgeSet_mono {V : Type u} {s : Set (Sym2 V)} {t : Set (Sym2 V)} (h : s t) :

## Darts #

structure SimpleGraph.Dart {V : Type u} (G : ) extends :

A Dart is an oriented edge, implemented as an ordered pair of adjacent vertices. This terminology comes from combinatorial maps, and they are also known as "half-edges" or "bonds."

Instances For
instance SimpleGraph.instDecidableEqDart :
{V : Type u_3} → {G : } → [inst : ] →
theorem SimpleGraph.Dart.ext_iff {V : Type u} {G : } (d₁ : ) (d₂ : ) :
d₁ = d₂ d₁.toProd = d₂.toProd
theorem SimpleGraph.Dart.ext {V : Type u} {G : } (d₁ : ) (d₂ : ) (h : d₁.toProd = d₂.toProd) :
d₁ = d₂
theorem SimpleGraph.Dart.toProd_injective {V : Type u} {G : } :
Function.Injective SimpleGraph.Dart.toProd
instance SimpleGraph.Dart.fintype {V : Type u} {G : } [] [DecidableRel G.Adj] :
def SimpleGraph.Dart.edge {V : Type u} {G : } (d : ) :

The edge associated to the dart.

Instances For
@[simp]
theorem SimpleGraph.Dart.edge_mk {V : Type u} {G : } {p : V × V} (h : SimpleGraph.Adj G p.fst p.snd) :
SimpleGraph.Dart.edge { toProd := p, is_adj := h } =
@[simp]
theorem SimpleGraph.Dart.edge_mem {V : Type u} {G : } (d : ) :
@[simp]
theorem SimpleGraph.Dart.symm_toProd {V : Type u} {G : } (d : ) :
().toProd = Prod.swap d.toProd
def SimpleGraph.Dart.symm {V : Type u} {G : } (d : ) :

The dart with reversed orientation from a given dart.

Instances For
@[simp]
theorem SimpleGraph.Dart.symm_mk {V : Type u} {G : } {p : V × V} (h : SimpleGraph.Adj G p.fst p.snd) :
SimpleGraph.Dart.symm { toProd := p, is_adj := h } = { toProd := , is_adj := (_ : SimpleGraph.Adj G p.snd p.fst) }
@[simp]
theorem SimpleGraph.Dart.edge_symm {V : Type u} {G : } (d : ) :
@[simp]
theorem SimpleGraph.Dart.edge_comp_symm {V : Type u} {G : } :
SimpleGraph.Dart.edge SimpleGraph.Dart.symm = SimpleGraph.Dart.edge
@[simp]
theorem SimpleGraph.Dart.symm_symm {V : Type u} {G : } (d : ) :
@[simp]
theorem SimpleGraph.Dart.symm_involutive {V : Type u} {G : } :
Function.Involutive SimpleGraph.Dart.symm
theorem SimpleGraph.Dart.symm_ne {V : Type u} {G : } (d : ) :
theorem SimpleGraph.dart_edge_eq_iff {V : Type u} {G : } (d₁ : ) (d₂ : ) :
d₁ = d₂
theorem SimpleGraph.dart_edge_eq_mk'_iff {V : Type u} {G : } {d : } {p : V × V} :
d.toProd = p d.toProd =
theorem SimpleGraph.dart_edge_eq_mk'_iff' {V : Type u} {G : } {d : } {u : V} {v : V} :
= Quotient.mk () (u, v) d.fst = u d.snd = v d.fst = v d.snd = u
def SimpleGraph.DartAdj {V : Type u} (G : ) (d : ) (d' : ) :

Two darts are said to be adjacent if they could be consecutive darts in a walk -- that is, the first dart's second vertex is equal to the second dart's first vertex.

Instances For
@[simp]
theorem SimpleGraph.dartOfNeighborSet_toProd {V : Type u} (G : ) (v : V) (w : ↑()) :
().toProd = (v, w)
def SimpleGraph.dartOfNeighborSet {V : Type u} (G : ) (v : V) (w : ↑()) :

For a given vertex v, this is the bijective map from the neighbor set at v to the darts d with d.fst = v.

Instances For
theorem SimpleGraph.dartOfNeighborSet_injective {V : Type u} (G : ) (v : V) :

### Incidence set #

def SimpleGraph.incidenceSet {V : Type u} (G : ) (v : V) :
Set (Sym2 V)

Set of edges incident to a given vertex, aka incidence set.

Instances For
theorem SimpleGraph.incidenceSet_subset {V : Type u} (G : ) (v : V) :
theorem SimpleGraph.mk'_mem_incidenceSet_iff {V : Type u} (G : ) {a : V} {b : V} {c : V} :
Quotient.mk () (b, c) (a = b a = c)
theorem SimpleGraph.mk'_mem_incidenceSet_left_iff {V : Type u} (G : ) {a : V} {b : V} :
Quotient.mk () (a, b)
theorem SimpleGraph.mk'_mem_incidenceSet_right_iff {V : Type u} (G : ) {a : V} {b : V} :
Quotient.mk () (a, b)
theorem SimpleGraph.edge_mem_incidenceSet_iff {V : Type u} (G : ) {a : V} {e : ↑()} :
a e
theorem SimpleGraph.incidenceSet_inter_incidenceSet_subset {V : Type u} (G : ) {a : V} {b : V} (h : a b) :
{Quotient.mk () (a, b)}
theorem SimpleGraph.incidenceSet_inter_incidenceSet_of_adj {V : Type u} (G : ) {a : V} {b : V} (h : ) :
= {Quotient.mk () (a, b)}
theorem SimpleGraph.adj_of_mem_incidenceSet {V : Type u} (G : ) {a : V} {b : V} {e : Sym2 V} (h : a b) (ha : ) (hb : ) :
theorem SimpleGraph.incidenceSet_inter_incidenceSet_of_not_adj {V : Type u} (G : ) {a : V} {b : V} (h : ¬) (hn : a b) :
instance SimpleGraph.decidableMemIncidenceSet {V : Type u} (G : ) [] [DecidableRel G.Adj] (v : V) :
DecidablePred fun x =>
@[reducible]
def SimpleGraph.edgeFinset {V : Type u} (G : ) [] :

The edgeSet of the graph as a Finset.

Instances For
theorem SimpleGraph.coe_edgeFinset {V : Type u} (G : ) [] :
theorem SimpleGraph.mem_edgeFinset {V : Type u} {G : } {e : Sym2 V} [] :
theorem SimpleGraph.not_isDiag_of_mem_edgeFinset {V : Type u} {G : } {e : Sym2 V} [] :
theorem SimpleGraph.edgeFinset_inj {V : Type u} {G₁ : } {G₂ : } [] [] :
G₁ = G₂
theorem SimpleGraph.edgeFinset_subset_edgeFinset {V : Type u} {G₁ : } {G₂ : } [] [] :
G₁ G₂
theorem SimpleGraph.edgeFinset_ssubset_edgeFinset {V : Type u} {G₁ : } {G₂ : } [] [] :
G₁ < G₂
theorem SimpleGraph.edgeFinset_mono {V : Type u} {G₁ : } {G₂ : } [] [] :
G₁ G₂

Alias of the reverse direction of SimpleGraph.edgeFinset_subset_edgeFinset.

theorem SimpleGraph.edgeFinset_strict_mono {V : Type u} {G₁ : } {G₂ : } [] [] :
G₁ < G₂

Alias of the reverse direction of SimpleGraph.edgeFinset_ssubset_edgeFinset.

@[simp]
@[simp]
theorem SimpleGraph.edgeFinset_sup {V : Type u} {G₁ : } {G₂ : } [] [] [] :
@[simp]
theorem SimpleGraph.edgeFinset_inf {V : Type u} {G₁ : } {G₂ : } [] [] [] :
@[simp]
theorem SimpleGraph.edgeFinset_sdiff {V : Type u} {G₁ : } {G₂ : } [] [] [] :
theorem SimpleGraph.edgeFinset_card {V : Type u} {G : } [] :
@[simp]
theorem SimpleGraph.edgeSet_univ_card {V : Type u} {G : } [] :
Finset.card Finset.univ =
@[simp]
theorem SimpleGraph.mem_neighborSet {V : Type u} (G : ) (v : V) (w : V) :
@[simp]
theorem SimpleGraph.mem_incidenceSet {V : Type u} (G : ) (v : V) (w : V) :
Quotient.mk () (v, w)
theorem SimpleGraph.mem_incidence_iff_neighbor {V : Type u} (G : ) {v : V} {w : V} :
Quotient.mk () (v, w)
theorem SimpleGraph.adj_incidenceSet_inter {V : Type u} (G : ) {v : V} {e : Sym2 V} (he : ) (h : v e) :
= {e}
theorem SimpleGraph.compl_neighborSet_disjoint {V : Type u} (G : ) (v : V) :
theorem SimpleGraph.neighborSet_compl {V : Type u} (G : ) (v : V) :
= () \ {v}
def SimpleGraph.commonNeighbors {V : Type u} (G : ) (v : V) (w : V) :
Set V

The set of common neighbors between two vertices v and w in a graph G is the intersection of the neighbor sets of v and w.

Instances For
theorem SimpleGraph.commonNeighbors_eq {V : Type u} (G : ) (v : V) (w : V) :
theorem SimpleGraph.mem_commonNeighbors {V : Type u} (G : ) {u : V} {v : V} {w : V} :
theorem SimpleGraph.commonNeighbors_symm {V : Type u} (G : ) (v : V) (w : V) :
theorem SimpleGraph.not_mem_commonNeighbors_left {V : Type u} (G : ) (v : V) (w : V) :
theorem SimpleGraph.not_mem_commonNeighbors_right {V : Type u} (G : ) (v : V) (w : V) :
theorem SimpleGraph.commonNeighbors_subset_neighborSet_left {V : Type u} (G : ) (v : V) (w : V) :
theorem SimpleGraph.commonNeighbors_subset_neighborSet_right {V : Type u} (G : ) (v : V) (w : V) :
instance SimpleGraph.decidableMemCommonNeighbors {V : Type u} (G : ) [DecidableRel G.Adj] (v : V) (w : V) :
DecidablePred fun x => x
theorem SimpleGraph.commonNeighbors_top_eq {V : Type u} {v : V} {w : V} :
= Set.univ \ {v, w}
def SimpleGraph.otherVertexOfIncident {V : Type u} (G : ) [] {v : V} {e : Sym2 V} (h : ) :
V

Given an edge incident to a particular vertex, get the other vertex on the edge.

Instances For
theorem SimpleGraph.edge_other_incident_set {V : Type u} (G : ) [] {v : V} {e : Sym2 V} (h : ) :
theorem SimpleGraph.incidence_other_prop {V : Type u} (G : ) [] {v : V} {e : Sym2 V} (h : ) :
theorem SimpleGraph.incidence_other_neighbor_edge {V : Type u} (G : ) [] {v : V} {w : V} (h : ) :
@[simp]
theorem SimpleGraph.incidenceSetEquivNeighborSet_symm_apply_coe {V : Type u} (G : ) [] (v : V) (w : ↑()) :
↑(().symm w) = Quotient.mk () (v, w)
@[simp]
theorem SimpleGraph.incidenceSetEquivNeighborSet_apply_coe {V : Type u} (G : ) [] (v : V) (e : ↑()) :
def SimpleGraph.incidenceSetEquivNeighborSet {V : Type u} (G : ) [] (v : V) :
↑() ↑()

There is an equivalence between the set of edges incident to a given vertex and the set of vertices adjacent to the vertex.

Instances For

## Edge deletion #

def SimpleGraph.deleteEdges {V : Type u} (G : ) (s : Set (Sym2 V)) :

Given a set of vertex pairs, remove all of the corresponding edges from the graph's edge set, if present.

See also: SimpleGraph.Subgraph.deleteEdges.

Instances For
@[simp]
theorem SimpleGraph.deleteEdges_adj {V : Type u} (G : ) (s : Set (Sym2 V)) (v : V) (w : V) :
¬Quotient.mk () (v, w) s
theorem SimpleGraph.sdiff_eq_deleteEdges {V : Type u} (G : ) (G' : ) :
G \ G' =
@[simp]
theorem SimpleGraph.deleteEdges_deleteEdges {V : Type u} (G : ) (s : Set (Sym2 V)) (s' : Set (Sym2 V)) :
@[simp]
theorem SimpleGraph.deleteEdges_empty_eq {V : Type u} (G : ) :
@[simp]
theorem SimpleGraph.deleteEdges_le {V : Type u} (G : ) (s : Set (Sym2 V)) :
theorem SimpleGraph.deleteEdges_le_of_le {V : Type u} (G : ) {s : Set (Sym2 V)} {s' : Set (Sym2 V)} (h : s s') :
theorem SimpleGraph.deleteEdges_eq_inter_edgeSet {V : Type u} (G : ) (s : Set (Sym2 V)) :
theorem SimpleGraph.deleteEdges_sdiff_eq_of_le {V : Type u} (G : ) {H : } (h : H G) :
theorem SimpleGraph.edgeSet_deleteEdges {V : Type u} (G : ) (s : Set (Sym2 V)) :
theorem SimpleGraph.edgeFinset_deleteEdges {V : Type u} (G : ) [Fintype (Sym2 V)] [] [DecidableRel G.Adj] (s : Finset (Sym2 V)) [DecidableRel ().Adj] :
def SimpleGraph.DeleteFar {𝕜 : Type u_2} {V : Type u} (G : ) [] [Fintype (Sym2 V)] [DecidableRel G.Adj] (p : ) (r : 𝕜) :

A graph is r-delete-far from a property p if we must delete at least r edges from it to get a graph with the property p.

Instances For
theorem SimpleGraph.deleteFar_iff {𝕜 : Type u_2} {V : Type u} {G : } [] [Fintype (Sym2 V)] [] [DecidableRel G.Adj] {p : } {r : 𝕜} :
∀ ⦃H : ⦄, H Gp Hr
theorem SimpleGraph.DeleteFar.le_card_sub_card {𝕜 : Type u_2} {V : Type u} {G : } [] [Fintype (Sym2 V)] [] [DecidableRel G.Adj] {p : } {r : 𝕜} :
∀ ⦃H : ⦄, H Gp Hr

Alias of the forward direction of SimpleGraph.deleteFar_iff.

theorem SimpleGraph.DeleteFar.mono {𝕜 : Type u_2} {V : Type u} {G : } [] [Fintype (Sym2 V)] [DecidableRel G.Adj] {p : } {r₁ : 𝕜} {r₂ : 𝕜} (h : ) (hr : r₁ r₂) :

## Map and comap #

def SimpleGraph.map {V : Type u} {W : Type v} (f : V W) (G : ) :

Given an injective function, there is a covariant induced map on graphs by pushing forward the adjacency relation.

This is injective (see SimpleGraph.map_injective).

Instances For
@[simp]
theorem SimpleGraph.map_adj {V : Type u} {W : Type v} (f : V W) (G : ) (u : W) (v : W) :
SimpleGraph.Adj () u v u' v', SimpleGraph.Adj G u' v' f u' = u f v' = v
theorem SimpleGraph.map_monotone {V : Type u} {W : Type v} (f : V W) :
@[simp]
theorem SimpleGraph.comap_Adj {V : Type u} {W : Type v} (f : VW) (G : ) (u : V) (v : V) :
def SimpleGraph.comap {V : Type u} {W : Type v} (f : VW) (G : ) :

Given a function, there is a contravariant induced map on graphs by pulling back the adjacency relation. This is one of the ways of creating induced graphs. See SimpleGraph.induce for a wrapper.

This is surjective when f is injective (see SimpleGraph.comap_surjective).

Instances For
theorem SimpleGraph.comap_monotone {V : Type u} {W : Type v} (f : V W) :
@[simp]
theorem SimpleGraph.comap_map_eq {V : Type u} {W : Type v} (f : V W) (G : ) :
SimpleGraph.comap (f) () = G
theorem SimpleGraph.leftInverse_comap_map {V : Type u} {W : Type v} (f : V W) :
theorem SimpleGraph.map_injective {V : Type u} {W : Type v} (f : V W) :
theorem SimpleGraph.comap_surjective {V : Type u} {W : Type v} (f : V W) :
theorem SimpleGraph.map_le_iff_le_comap {V : Type u} {W : Type v} (f : V W) (G : ) (G' : ) :
G' G SimpleGraph.comap (f) G'
theorem SimpleGraph.map_comap_le {V : Type u} {W : Type v} (f : V W) (G : ) :
theorem SimpleGraph.le_comap_of_subsingleton {V : Type u} {W : Type v} (G : ) (G' : ) (f : VW) [] :
G
theorem SimpleGraph.map_le_of_subsingleton {V : Type u} {W : Type v} (G : ) (G' : ) (f : V W) [] :
G'
@[inline, reducible]
abbrev SimpleGraph.completeMultipartiteGraph {ι : Type u_3} (V : ιType u_4) :
SimpleGraph ((i : ι) × V i)

Given a family of vertex types indexed by ι, pulling back from ⊤ : SimpleGraph ι yields the complete multipartite graph on the family. Two vertices are adjacent if and only if their indices are not equal.

Instances For

## Induced graphs #

@[reducible]
def SimpleGraph.induce {V : Type u} (s : Set V) (G : ) :

Restrict a graph to the vertices in the set s, deleting all edges incident to vertices outside the set. This is a wrapper around SimpleGraph.comap.

Instances For
@[simp]
theorem SimpleGraph.induce_singleton_eq_top {V : Type u} (G : ) (v : V) :
@[reducible]
def SimpleGraph.spanningCoe {V : Type u} {s : Set V} (G : ) :

Given a graph on a set of vertices, we can make it be a SimpleGraph V by adding in the remaining vertices without adding in any additional edges. This is a wrapper around SimpleGraph.map.

Instances For
theorem SimpleGraph.induce_spanningCoe {V : Type u} {s : Set V} {G : } :
theorem SimpleGraph.spanningCoe_induce_le {V : Type u} (G : ) (s : Set V) :

## Finiteness at a vertex #

This section contains definitions and lemmas concerning vertices that have finitely many adjacent vertices. We denote this condition by Fintype (G.neighborSet v).

We define G.neighborFinset v to be the Finset version of G.neighborSet v. Use neighborFinset_eq_filter to rewrite this definition as a Finset.filter expression.

def SimpleGraph.neighborFinset {V : Type u} (G : ) (v : V) [] :

G.neighbors v is the Finset version of G.Adj v in case G is locally finite at v.

Instances For
theorem SimpleGraph.neighborFinset_def {V : Type u} (G : ) (v : V) [] :
@[simp]
theorem SimpleGraph.mem_neighborFinset {V : Type u} (G : ) (v : V) [] (w : V) :
theorem SimpleGraph.not_mem_neighborFinset_self {V : Type u} (G : ) (v : V) [] :
theorem SimpleGraph.neighborFinset_disjoint_singleton {V : Type u} (G : ) (v : V) [] :
Disjoint () {v}
theorem SimpleGraph.singleton_disjoint_neighborFinset {V : Type u} (G : ) (v : V) [] :
Disjoint {v} ()
def SimpleGraph.degree {V : Type u} (G : ) (v : V) [] :

G.degree v is the number of vertices adjacent to v.

Instances For
@[simp]
theorem SimpleGraph.card_neighborFinset_eq_degree {V : Type u} (G : ) (v : V) [] :
@[simp]
theorem SimpleGraph.card_neighborSet_eq_degree {V : Type u} (G : ) (v : V) [] :
theorem SimpleGraph.degree_pos_iff_exists_adj {V : Type u} (G : ) (v : V) [] :
0 < w,
theorem SimpleGraph.degree_compl {V : Type u} (G : ) (v : V) [] [] [] :
= -
instance SimpleGraph.incidenceSetFintype {V : Type u} (G : ) (v : V) [] [] :
def SimpleGraph.incidenceFinset {V : Type u} (G : ) (v : V) [] [] :

This is the Finset version of incidenceSet.

Instances For
@[simp]
theorem SimpleGraph.card_incidenceSet_eq_degree {V : Type u} (G : ) (v : V) [] [] :
@[simp]
theorem SimpleGraph.card_incidenceFinset_eq_degree {V : Type u} (G : ) (v : V) [] [] :
@[simp]
theorem SimpleGraph.mem_incidenceFinset {V : Type u} (G : ) (v : V) [] [] (e : Sym2 V) :
theorem SimpleGraph.incidenceFinset_eq_filter {V : Type u} (G : ) (v : V) [] [] [] :
@[reducible]
def SimpleGraph.LocallyFinite {V : Type u} (G : ) :

A graph is locally finite if every vertex has a finite neighbor set.

Instances For
def SimpleGraph.IsRegularOfDegree {V : Type u} (G : ) (d : ) :

A locally finite simple graph is regular of degree d if every vertex has degree d.

Instances For
theorem SimpleGraph.IsRegularOfDegree.degree_eq {V : Type u} {G : } {d : } (h : ) (v : V) :
= d
theorem SimpleGraph.IsRegularOfDegree.compl {V : Type u} [] [] {G : } [DecidableRel G.Adj] {k : } (h : ) :
instance SimpleGraph.neighborSetFintype {V : Type u} (G : ) [] [DecidableRel G.Adj] (v : V) :
theorem SimpleGraph.neighborFinset_eq_filter {V : Type u} (G : ) [] {v : V} [DecidableRel G.Adj] :
= Finset.filter () Finset.univ
theorem SimpleGraph.neighborFinset_compl {V : Type u} (G : ) [] [] [DecidableRel G.Adj] (v : V) :
= \ {v}
@[simp]
theorem SimpleGraph.complete_graph_degree {V : Type u} [] [] (v : V) :
theorem SimpleGraph.bot_degree {V : Type u} [] (v : V) :
def SimpleGraph.minDegree {V : Type u} (G : ) [] [DecidableRel G.Adj] :

The minimum degree of all vertices (and 0 if there are no vertices). The key properties of this are given in exists_minimal_degree_vertex, minDegree_le_degree and le_minDegree_of_forall_le_degree.

Instances For
theorem SimpleGraph.exists_minimal_degree_vertex {V : Type u} (G : ) [] [DecidableRel G.Adj] [] :
v,

There exists a vertex of minimal degree. Note the assumption of being nonempty is necessary, as the lemma implies there exists a vertex.

theorem SimpleGraph.minDegree_le_degree {V : Type u} (G : ) [] [DecidableRel G.Adj] (v : V) :

The minimum degree in the graph is at most the degree of any particular vertex.

theorem SimpleGraph.le_minDegree_of_forall_le_degree {V : Type u} (G : ) [] [DecidableRel G.Adj] [] (k : ) (h : ∀ (v : V), k ) :

In a nonempty graph, if k is at most the degree of every vertex, it is at most the minimum degree. Note the assumption that the graph is nonempty is necessary as long as G.minDegree is defined to be a natural.

def SimpleGraph.maxDegree {V : Type u} (G : ) [] [DecidableRel G.Adj] :

The maximum degree of all vertices (and 0 if there are no vertices). The key properties of this are given in exists_maximal_degree_vertex, degree_le_maxDegree and maxDegree_le_of_forall_degree_le.

Instances For
theorem SimpleGraph.exists_maximal_degree_vertex {V : Type u} (G : ) [] [DecidableRel G.Adj] [] :
v,

There exists a vertex of maximal degree. Note the assumption of being nonempty is necessary, as the lemma implies there exists a vertex.

theorem SimpleGraph.degree_le_maxDegree {V : Type u} (G : ) [] [DecidableRel G.Adj] (v : V) :

The maximum degree in the graph is at least the degree of any particular vertex.

theorem SimpleGraph.maxDegree_le_of_forall_degree_le {V : Type u} (G : ) [] [DecidableRel G.Adj] (k : ) (h : ∀ (v : V), k) :

In a graph, if k is at least the degree of every vertex, then it is at least the maximum degree.

theorem SimpleGraph.degree_lt_card_verts {V : Type u} (G : ) [] [DecidableRel G.Adj] (v : V) :
theorem SimpleGraph.maxDegree_lt_card_verts {V : Type u} (G : ) [] [DecidableRel G.Adj] [] :

The maximum degree of a nonempty graph is less than the number of vertices. Note that the assumption that V is nonempty is necessary, as otherwise this would assert the existence of a natural number less than zero.

theorem SimpleGraph.card_commonNeighbors_le_degree_left {V : Type u} (G : ) [] [DecidableRel G.Adj] (v : V) (w : V) :
theorem SimpleGraph.card_commonNeighbors_le_degree_right {V : Type u} (G : ) [] [DecidableRel G.Adj] (v : V) (w : V) :
theorem SimpleGraph.card_commonNeighbors_lt_card_verts {V : Type u} (G : ) [] [DecidableRel G.Adj] (v : V) (w : V) :
theorem SimpleGraph.Adj.card_commonNeighbors_lt_degree {V : Type u} [] {G : } [DecidableRel G.Adj] {v : V} {w : V} (h : ) :

If the condition G.Adj v w fails, then card_commonNeighbors_le_degree is the best we can do in general.

theorem SimpleGraph.card_commonNeighbors_top {V : Type u} [] [] {v : V} {w : V} (h : v w) :
=
@[inline, reducible]
abbrev SimpleGraph.Hom {V : Type u} {W : Type v} (G : ) (G' : ) :
Type (max u v)

A graph homomorphism is a map on vertex sets that respects adjacency relations.

The notation G →g G' represents the type of graph homomorphisms.

Instances For
@[inline, reducible]
abbrev SimpleGraph.Embedding {V : Type u} {W : Type v} (G : ) (G' : ) :
Type (max u v)

A graph embedding is an embedding f such that for vertices v w : V, G.Adj (f v) (f w) ↔ G.Adj v w . Its image is an induced subgraph of G'.

The notation G ↪g G' represents the type of graph embeddings.

Instances For
@[inline, reducible]
abbrev SimpleGraph.Iso {V : Type u} {W : Type v} (G : ) (G' : ) :
Type (max u v)

A graph isomorphism is a bijective map on vertex sets that respects adjacency relations.

The notation G ≃g G' represents the type of graph isomorphisms.

Instances For
Instances For
Instances For
Instances For
@[inline, reducible]
abbrev SimpleGraph.Hom.id {V : Type u} {G : } :
G →g G

The identity homomorphism from a graph to itself.

Instances For
theorem SimpleGraph.Hom.map_adj {V : Type u} {W : Type v} {G : } {G' : } (f : G →g G') {v : V} {w : V} (h : ) :
SimpleGraph.Adj G' (f v) (f w)
theorem SimpleGraph.Hom.map_mem_edgeSet {V : Type u} {W : Type v} {G : } {G' : } (f : G →g G') {e : Sym2 V} (h : ) :
Sym2.map (f) e
theorem SimpleGraph.Hom.apply_mem_neighborSet {V : Type u} {W : Type v} {G : } {G' : } (f : G →g G') {v : V} {w : V} (h : ) :
f w SimpleGraph.neighborSet G' (f v)
@[simp]
theorem SimpleGraph.Hom.mapEdgeSet_coe {V : Type u} {W : Type v} {G : } {G' : } (f : G →g G') (e : ↑()) :
↑() = Sym2.map f e
def SimpleGraph.Hom.mapEdgeSet {V : Type u} {W : Type v} {G : } {G' : } (f : G →g G') (e : ↑()) :
↑()

The map between edge sets induced by a homomorphism. The underlying map on edges is given by Sym2.map.

Instances For
@[simp]
theorem SimpleGraph.Hom.mapNeighborSet_coe {V : Type u} {W : Type v} {G : } {G' : } (f : G →g G') (v : V) (w : ↑()) :
↑() = f w
def SimpleGraph.Hom.mapNeighborSet {V : Type u} {W : Type v} {G : } {G' : } (f : G →g G') (v : V) (w : ↑()) :
↑(SimpleGraph.neighborSet G' (f v))

The map between neighbor sets induced by a homomorphism.

Instances For
def SimpleGraph.Hom.mapDart {V : Type u} {W : Type v} {G : } {G' : } (f : G →g G') (d : ) :

The map between darts induced by a homomorphism.

Instances For
@[simp]
theorem SimpleGraph.Hom.mapDart_apply {V : Type u} {W : Type v} {G : } {G' : } (f : G →g G') (d : ) :
= { toProd := Prod.map (f) (f) d.toProd, is_adj := (_ : SimpleGraph.Adj G' (f d.1.fst) (f d.1.snd)) }
@[simp]
theorem SimpleGraph.Hom.mapSpanningSubgraphs_apply {V : Type u} {G : } {G' : } (h : G G') (x : V) :
def SimpleGraph.Hom.mapSpanningSubgraphs {V : Type u} {G : } {G' : } (h : G G') :
G →g G'

The induced map for spanning subgraphs, which is the identity on vertices.

Instances For
theorem SimpleGraph.Hom.mapEdgeSet.injective {V : Type u} {W : Type v} {G : } {G' : } (f : G →g G') (hinj : ) :
theorem SimpleGraph.Hom.injective_of_top_hom {V : Type u} {W : Type v} {G' : } (f : →g G') :

Every graph homomorphism from a complete graph is injective.

@[simp]
theorem SimpleGraph.Hom.comap_apply {V : Type u} {W : Type v} (f : VW) (G : ) :
∀ (a : V), ↑() a = f a
def SimpleGraph.Hom.comap {V : Type u} {W : Type v} (f : VW) (G : ) :
→g G

There is a homomorphism to a graph from a comapped graph. When the function is injective, this is an embedding (see SimpleGraph.Embedding.comap).

Instances For
@[inline, reducible]
abbrev SimpleGraph.Hom.comp {V : Type u} {W : Type v} {X : Type w} {G : } {G' : } {G'' : } (f' : G' →g G'') (f : G →g G') :
G →g G''

Composition of graph homomorphisms.

Instances For
@[simp]
theorem SimpleGraph.Hom.coe_comp {V : Type u} {W : Type v} {X : Type w} {G : } {G' : } {G'' : } (f' : G' →g G'') (f : G →g G') :
↑() = f' f
@[inline, reducible]
abbrev SimpleGraph.Embedding.refl {V : Type u} {G : } :
G ↪g G

The identity embedding from a graph to itself.

Instances For
@[inline, reducible]
abbrev SimpleGraph.Embedding.toHom {V : Type u} {W : Type v} {G : } {G' : } (f : G ↪g G') :
G →g G'

An embedding of graphs gives rise to a homomorphism of graphs.

Instances For
theorem SimpleGraph.Embedding.map_adj_iff {V : Type u} {W : Type v} {G : } {G' : } (f : G ↪g G') {v : V} {w : V} :
SimpleGraph.Adj G' (f v) (f w)
theorem SimpleGraph.Embedding.map_mem_edgeSet_iff {V : Type u} {W : Type v} {G : } {G' : } (f : G ↪g G') {e : Sym2 V} :
Sym2.map (f) e
theorem SimpleGraph.Embedding.apply_mem_neighborSet_iff {V : Type u} {W : Type v} {G : } {G' : } (f : G ↪g G') {v : V} {w : V} :
f w SimpleGraph.neighborSet G' (f v)
@[simp]
theorem SimpleGraph.Embedding.mapEdgeSet_apply {V : Type u} {W : Type v} {G : } {G' : } (f : G ↪g G') (e : ↑()) :
def SimpleGraph.Embedding.mapEdgeSet {V : Type u} {W : Type v} {G : } {G' : } (f : G ↪g G') :
↑() ↑()

A graph embedding induces an embedding of edge sets.

Instances For
@[simp]
theorem SimpleGraph.Embedding.mapNeighborSet_apply_coe {V : Type u} {W : Type v} {G : } {G' : } (f : G ↪g G') (v : V) (w : ↑()) :
↑() = f w
def SimpleGraph.Embedding.mapNeighborSet {V : Type u} {W : Type v} {G : } {G' : } (f : G ↪g G') (v : V) :
↑() ↑(SimpleGraph.neighborSet G' (f v))

A graph embedding induces an embedding of neighbor sets.

Instances For
def SimpleGraph.Embedding.comap {V : Type u} {W : Type v} (f : V W) (G : ) :

Given an injective function, there is an embedding from the comapped graph into the original graph.

Instances For
@[simp]
theorem SimpleGraph.Embedding.comap_apply {V : Type u} {W : Type v} (f : V W) (G : ) (v : V) :
↑() v = f v
def SimpleGraph.Embedding.map {V : Type u} {W : Type v} (f : V W) (G : ) :
G ↪g

Given an injective function, there is an embedding from a graph into the mapped graph.

Instances For
@[simp]
theorem SimpleGraph.Embedding.map_apply {V : Type u} {W : Type v} (f : V W) (G : ) (v : V) :
↑() v = f v
@[reducible]
def SimpleGraph.Embedding.induce {V : Type u} {G : } (s : Set V) :
↪g G

Induced graphs embed in the original graph.

Note that if G.induce s = ⊤ (i.e., if s is a clique) then this gives the embedding of a complete graph.

Instances For
@[reducible]
def SimpleGraph.Embedding.spanningCoe {V : Type u} {s : Set V} (G : ) :

Graphs on a set of vertices embed in their spanningCoe.

Instances For
def SimpleGraph.Embedding.completeGraph {α : Type u_3} {β : Type u_4} (f : α β) :

Embeddings of types induce embeddings of complete graphs on those types.

Instances For
@[inline, reducible]
abbrev SimpleGraph.Embedding.comp {V : Type u} {W : Type v} {X : Type w} {G : } {G' : } {G'' : } (f' : G' ↪g G'') (f : G ↪g G') :
G ↪g G''

Composition of graph embeddings.

Instances For
@[simp]
theorem SimpleGraph.Embedding.coe_comp {V : Type u} {W : Type v} {X : Type w} {G : } {G' : } {G'' : } (f' : G' ↪g G'') (f : G ↪g G') :
↑() = f' f
def SimpleGraph.induceHom {V : Type u} {W : Type v} {G : } {G' : } {s : Set V} {t : Set W} (φ : G →g G') (φst : Set.MapsTo (φ) s t) :

The restriction of a morphism of graphs to induced subgraphs.

Instances For
@[simp]
theorem SimpleGraph.coe_induceHom {V : Type u} {W : Type v} {G : } {G' : } {s : Set V} {t : Set W} (φ : G →g G') (φst : Set.MapsTo (φ) s t) :
↑() = Set.MapsTo.restrict (φ) s t φst
@[simp]
theorem SimpleGraph.induceHom_id {V : Type u} (G : ) (s : Set V) :
SimpleGraph.induceHom SimpleGraph.Hom.id (_ : Set.MapsTo id s s) = SimpleGraph.Hom.id
@[simp]
theorem SimpleGraph.induceHom_comp {V : Type u} {W : Type v} {X : Type w} {G : } {G' : } {G'' : } {s : Set V} {t : Set W} {r : Set X} (φ : G →g G') (φst : Set.MapsTo (φ) s t) (ψ : G' →g G'') (ψtr : Set.MapsTo (ψ) t r) :
SimpleGraph.Hom.comp () () = SimpleGraph.induceHom () (_ : Set.MapsTo (ψ fun x => φ x) s r)
theorem SimpleGraph.induceHom_injective {V : Type u} {W : Type v} {G : } {G' : } {s : Set V} {t : Set W} (φ : G →g G') (φst : Set.MapsTo (φ) s t) (hi : Set.InjOn (φ) s) :
def SimpleGraph.induceHomOfLE {V : Type u} (G : ) {s : Set V} {s' : Set V} (h : s s') :

Given an inclusion of vertex subsets, the induced embedding on induced graphs. This is not an abbreviation for induceHom since we get an embedding in this case.

Instances For
@[simp]
theorem SimpleGraph.induceHomOfLE_apply {V : Type u} (G : ) {s : Set V} {s' : Set V} (h : s s') (v : s) :
↑() v =
@[simp]
theorem SimpleGraph.induceHomOfLE_toHom {V : Type u} (G : ) {s : Set V} {s' : Set V} (h : s s') :
= SimpleGraph.induceHom SimpleGraph.Hom.id (_ : Set.MapsTo id s s')
@[inline, reducible]
abbrev SimpleGraph.Iso.refl {V : Type u} {G : } :
G ≃g G

The identity isomorphism of a graph with itself.

Instances For
@[inline, reducible]
abbrev SimpleGraph.Iso.toEmbedding {V : Type u} {W : Type v} {G : } {G' : } (f : G ≃g G') :
G ↪g G'

An isomorphism of graphs gives rise to an embedding of graphs.

Instances For
@[inline, reducible]
abbrev SimpleGraph.Iso.toHom {V : Type u} {W : Type v} {G : } {G' : } (f : G ≃g G') :
G →g G'

An isomorphism of graphs gives rise to a homomorphism of graphs.

Instances For
@[inline, reducible]
abbrev SimpleGraph.Iso.symm {V : Type u} {W : Type v} {G : } {G' : } (f : G ≃g G') :
G' ≃g G

The inverse of a graph isomorphism.

Instances For
theorem SimpleGraph.Iso.map_adj_iff {V : Type u} {W : Type v} {G : } {G' : } (f : G ≃g G') {v : V} {w : V} :
SimpleGraph.Adj G' (f v) (f w)
theorem SimpleGraph.Iso.map_mem_edgeSet_iff {V : Type u} {W : Type v} {G : } {G' : } (f : G ≃g G') {e : Sym2 V} :
Sym2.map (f) e
theorem SimpleGraph.Iso.apply_mem_neighborSet_iff {V : Type u} {W : Type v} {G : } {G' : } (f : G ≃g G') {v : V} {w : V} :
f w SimpleGraph.neighborSet G' (f v)
@[simp]
theorem SimpleGraph.Iso.mapEdgeSet_apply {V : Type u} {W : Type v} {G : } {G' : } (f : G ≃g G') (e : ↑()) :
@[simp]
theorem SimpleGraph.Iso.mapEdgeSet_symm_apply {V : Type u} {W : Type v} {G : } {G' : } (f : G ≃g G') (e : ↑()) :
def SimpleGraph.Iso.mapEdgeSet {V : Type u} {W : Type v} {G : } {G' : } (f : G ≃g G') :
↑() ↑()

An isomorphism of graphs induces an equivalence of edge sets.

Instances For
@[simp]
theorem SimpleGraph.Iso.mapNeighborSet_symm_apply_coe {V : Type u} {W : Type v} {G : } {G' : } (f : G ≃g G') (v : V) (w : ↑(SimpleGraph.neighborSet G' (f v))) :
↑(().symm w) = ↑() w
@[simp]
theorem SimpleGraph.Iso.mapNeighborSet_apply_coe {V : Type u} {W : Type v} {G : } {G' : } (f : G ≃g G') (v : V) (w : ↑()) :
↑(↑() w) = f w
def SimpleGraph.Iso.mapNeighborSet {V : Type u} {W : Type v} {G : } {G' : } (f : G ≃g G') (v : V) :
↑() ↑(SimpleGraph.neighborSet G' (f v))

A graph isomorphism induces an equivalence of neighbor sets.

Instances For
theorem SimpleGraph.Iso.card_eq_of_iso {V : Type u} {W : Type v} {G : } {G' : } [] [] (f : G ≃g G') :
def SimpleGraph.Iso.comap {V : Type u} {W : Type v} (f : V W) (G : ) :
≃g G

Given a bijection, there is an embedding from the comapped graph into the original graph.

Instances For
@[simp]
theorem SimpleGraph.Iso.comap_apply {V : Type u} {W : Type v} (f : V W) (G : ) (v : V) :
↑() v = f v
@[simp]
theorem SimpleGraph.Iso.comap_symm_apply {V : Type u} {W : Type v} (f : V W) (G : ) (w : W) :
↑() w = f.symm w
def SimpleGraph.Iso.map {V : Type u} {W : Type v} (f : V W) (G : ) :

Given an injective function, there is an embedding from a graph into the mapped graph.

Instances For
@[simp]
theorem SimpleGraph.Iso.map_apply {V : Type u} {W : Type v} (f : V W) (G : ) (v : V) :
↑() v = f v
@[simp]
theorem SimpleGraph.Iso.map_symm_apply {V : Type u} {W : Type v} (f : V W) (G : ) (w : W) :
↑() w = f.symm w
def SimpleGraph.Iso.completeGraph {α : Type u_3} {β : Type u_4} (f : α β) :

Equivalences of types induce isomorphisms of complete graphs on those types.

Instances For
theorem SimpleGraph.Iso.toEmbedding_completeGraph {α : Type u_3} {β : Type u_4} (f : α β) :
@[inline, reducible]
abbrev SimpleGraph.Iso.comp {V : Type u} {W : Type v} {X : Type w} {G : } {G' : } {G'' : } (f' : G' ≃g G'') (f : G ≃g G') :
G ≃g G''

Composition of graph isomorphisms.

Instances For
@[simp]
theorem SimpleGraph.Iso.coe_comp {V : Type u} {W : Type v} {X : Type w} {G : } {G' : } {G'' : } (f' : G' ≃g G'') (f : G ≃g G') :
↑() = f' f
@[simp]
theorem SimpleGraph.induceUnivIso_apply {V : Type u} (G : ) (self : { x // x Set.univ }) :
↑() self = self
@[simp]
theorem SimpleGraph.induceUnivIso_symm_apply_coe {V : Type u} (G : ) (a : V) :
↑(↑() a) = a
def SimpleGraph.induceUnivIso {V : Type u} (G : ) :

The graph induced on Set.univ is isomorphic to the original graph.

Instances For