Containment of graphs #
This file introduces the concept of one simple graph containing a copy of another.
For two simple graph G and H, a copy of G in H is a (not necessarily induced) subgraph of
H isomorphic to G.
If there exists a copy of G in H, we say that H contains G. This is equivalent to saying
that there is an injective graph homomorphism G → H them (this is not the same as a graph
embedding, as we do not require the subgraph to be induced).
If there exists an induced copy of G in H, we say that H inducingly contains G. This is
equivalent to saying that there is a graph embedding G ↪ H.
Main declarations #
Containment:
SimpleGraph.Copy G His the type of copies ofGinH, implemented as the subtype of injective homomorphisms.SimpleGraph.IsContained G H,G ⊑ His the relation thatHcontains a copy ofG, that is, the type of copies ofGinHis nonempty. This is equivalent to the existence of an isomorphism fromGto a subgraph ofH. This is similar toSimpleGraph.IsSubgraphexcept that the simple graphs here need not have the same underlying vertex type.SimpleGraph.Freeis the predicate thatHisG-free, that is,Hdoes not contain a copy ofG. This is the negation ofSimpleGraph.IsContainedimplemented for convenience.SimpleGraph.killCopies G H: Subgraph ofGthat does not containH. Obtained by arbitrarily removing an edge from each copy ofHinG.SimpleGraph.copyCount G H: Number of copies ofHinG, ie number of subgraphs ofGisomorphic toH.SimpleGraph.labelledCopyCount G H: Number of labelled copies ofHinG, ie number of graph embeddings fromHtoG.
Induced containment:
- Induced copies of
GinsideHare already defined asG ↪g H. SimpleGraph.IsIndContained G H:Gis contained as an induced subgraph inH.
Notation #
The following notation is declared in locale SimpleGraph:
G ⊑ HforSimpleGraph.IsContained G H.G ⊴ HforSimpleGraph.IsIndContained G H.
TODO #
- Relate
⊤ ⊑ H/⊥ ⊑ Hto there being a clique/independent set inH. - Count induced copies of a graph inside another.
- Make
copyCount/labelledCopyCountcomputable (not necessarily efficiently).
Copies #
Not necessarily induced copies #
A copy of a subgraph G inside a subgraph H is an embedding of the vertices of G into the
vertices of H, such that adjacency in G implies adjacency in H.
We capture this concept by injective graph homomorphisms.
The type of copies as a subtype of injective homomorphisms.
A copy gives rise to a homomorphism.
- injective' : Function.Injective ⇑self.toHom
Instances For
An injective homomorphism gives rise to a copy.
Instances For
An embedding gives rise to a copy.
Instances For
An isomorphism gives rise to a copy.
Equations
- f.toCopy = f.toEmbedding.toCopy
Instances For
Alias of SimpleGraph.Copy.toHom_apply.
A copy induces an embedding of edge sets.
Equations
- f.mapEdgeSet = { toFun := f.toHom.mapEdgeSet, inj' := ⋯ }
Instances For
A copy induces an embedding of neighbor sets.
Equations
- f.mapNeighborSet a = { toFun := fun (v : ↑(A.neighborSet a)) => ⟨f ↑v, ⋯⟩, inj' := ⋯ }
Instances For
A copy gives rise to an embedding of vertex types.
Equations
- f.toEmbedding = { toFun := ⇑f, inj' := ⋯ }
Instances For
The identity copy from a simple graph to itself.
Equations
- SimpleGraph.Copy.id G = { toHom := SimpleGraph.Hom.id, injective' := ⋯ }
Instances For
The composition of copies is a copy.
Instances For
The copy from a subgraph to the supergraph.
Equations
- SimpleGraph.Copy.ofLE G₁ G₂ h = { toHom := SimpleGraph.Hom.ofLE h, injective' := ⋯ }
Instances For
The copy from an induced subgraph to the initial simple graph.
Equations
Instances For
The copy of ⊥ in any simple graph that can embed its vertices.
Instances For
The isomorphism from a subgraph of A to its map under a copy f : Copy A B.
Equations
- f.isoSubgraphMap A' = { toEquiv := Equiv.Set.image (⇑f.toHom) A'.verts ⋯, map_rel_iff' := ⋯ }
Instances For
The subgraph of B corresponding to a copy of A inside B.
Equations
Instances For
The isomorphism from A to its copy under f : Copy A B.
Equations
Instances For
Equations
- One or more equations did not get rendered due to their size.
Induced copies #
An induced copy of a graph G inside a graph H is an embedding from the vertices of
G into the vertices of H which preserves the adjacency relation.
This is already captured by the notion of graph embeddings, defined as G ↪g H.
Containment #
Not necessarily induced containment #
A graph H contains a graph G if there is some copy f : Copy G H of G inside H. This
amounts to H having a subgraph isomorphic to G.
We denote "G is contained in H" by G ⊑ H (\squb).
The relation IsContained A B, A ⊑ B says that B contains a copy of A.
This is equivalent to the existence of an isomorphism from A to a subgraph of B.
Equations
- A.IsContained B = Nonempty (A.Copy B)
Instances For
The relation IsContained A B, A ⊑ B says that B contains a copy of A.
This is equivalent to the existence of an isomorphism from A to a subgraph of B.
Equations
- SimpleGraph.«term_⊑_» = Lean.ParserDescr.trailingNode `SimpleGraph.«term_⊑_» 50 50 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol " ⊑ ") (Lean.ParserDescr.cat `term 51))
Instances For
A simple graph contains itself.
A simple graph contains its subgraphs.
If A contains B and B contains C, then A contains C.
If B contains C and A contains B, then A contains C.
Alias of SimpleGraph.IsContained.mono_right.
Alias of SimpleGraph.IsContained.mono_left.
If A ≃g H and B ≃g G then A is contained in B if and only if H is contained
in G.
Alias of the reverse direction of SimpleGraph.isContained_congr_left.
Alias of the reverse direction of SimpleGraph.isContained_congr_right.
A simple graph having no vertices is contained in any simple graph.
⊥ is contained in any simple graph having sufficiently many vertices.
Alias of SimpleGraph.bot_isContained_iff_card_le.
⊥ is contained in any simple graph having sufficiently many vertices.
A simple graph G contains all Subgraph G coercions.
Alias of SimpleGraph.Copy.isoSubgraphMap.
The isomorphism from a subgraph of A to its map under a copy f : Copy A B.
Instances For
B contains A if and only if B has a subgraph B' and B' is isomorphic to A.
Alias of the forward direction of SimpleGraph.isContained_iff_exists_iso_subgraph.
B contains A if and only if B has a subgraph B' and B' is isomorphic to A.
Alias of the reverse direction of SimpleGraph.isContained_iff_exists_iso_subgraph.
B contains A if and only if B has a subgraph B' and B' is isomorphic to A.
A.Free B means that B does not contain a copy of A.
Equations
- A.Free B = ¬A.IsContained B
Instances For
If A ≃g H and B ≃g G then B is A-free if and only if G is H-free.
Alias of the reverse direction of SimpleGraph.free_congr_left.
Alias of the reverse direction of SimpleGraph.free_congr_right.
Induced containment #
A graph H inducingly contains a graph G if there is some graph embedding G ↪ H. This amounts
to H having an induced subgraph isomorphic to G.
We denote "G is inducingly contained in H" by G ⊴ H (\trianglelefteq).
A simple graph G is inducingly contained in a simple graph H if there exists an induced
subgraph of H isomorphic to G. This is denoted by G ⊴ H.
Equations
- G.IsIndContained H = Nonempty (G ↪g H)
Instances For
A simple graph G is inducingly contained in a simple graph H if there exists an induced
subgraph of H isomorphic to G. This is denoted by G ⊴ H.
Equations
- SimpleGraph.«term_⊴_» = Lean.ParserDescr.trailingNode `SimpleGraph.«term_⊴_» 50 50 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol " ⊴ ") (Lean.ParserDescr.cat `term 51))
Instances For
If G is isomorphic to H, then G is inducingly contained in H.
If G is isomorphic to H, then H is inducingly contained in G.
Alias of the reverse direction of SimpleGraph.isIndContained_iff_exists_iso_subgraph.
Alias of the forward direction of SimpleGraph.isIndContained_iff_exists_iso_subgraph.
Alias of the reverse direction of SimpleGraph.compl_isIndContained_compl.
Alias of the forward direction of SimpleGraph.compl_isIndContained_compl.
Counting the copies #
If G and H are finite graphs, we can count the number of unlabelled and labelled copies of G
in H.
Not necessarily induced copies #
G.labelledCopyCount H is the number of labelled copies of H in G, i.e. the number of graph
embeddings from H to G. See SimpleGraph.copyCount for the number of unlabelled copies.
Equations
- G.labelledCopyCount H = Fintype.card (H.Copy G)
Instances For
G.copyCount H is the number of unlabelled copies of H in G, i.e. the number of subgraphs
of G isomorphic to H. See SimpleGraph.labelledCopyCount for the number of labelled copies.
Instances For
There's at least as many labelled copies of H in G than unlabelled ones.
Induced copies #
TODO
Killing a subgraph #
An important aspect of graph containment is that we can remove not too many edges from a graph H
to get a graph H' that doesn't contain G.
Killing not necessarily induced copies #
SimpleGraph.killCopies G H is a subgraph of G where an edge was removed from each copy of H in
G. By construction, it doesn't contain H and has at most the number of copies of H edges less
than G.
G.killCopies H is a subgraph of G where an arbitrary edge was removed from each copy of
H in G. By construction, it doesn't contain H (unless H had no edges) and has at most the
number of copies of H edges less than G. See free_killCopies and
le_card_edgeFinset_killCopies for these two properties.
Equations
Instances For
Removing an edge from G for each subgraph isomorphic to H results in a subgraph of G.
G.killCopies H has no effect on G if and only if G already contained no copies of H. See
Free.killCopies_eq_left for the reverse implication with no assumption on H.
Removing an edge from G for each subgraph isomorphic to H results in a graph that doesn't
contain H.
Removing an edge from H for each subgraph isomorphic to G means that the number of edges
we've removed is at most the number of copies of G in H.
Removing an edge from H for each subgraph isomorphic to G means that the number of edges
we've removed is at most the number of copies of G in H.
Killing induced copies #
TODO