Subgraphs of a simple graph #
A subgraph of a simple graph consists of subsets of the graph's vertices and edges such that the endpoints of each edge are present in the vertex subset. The edge subset is formalized as a sub-relation of the adjacency relation of the simple graph.
Main definitions #
-
subgraph Gis the type of subgraphs of aG : simple_graph -
subgraph.neighbor_set,subgraph.incidence_set, andsubgraph.degreeare like theirsimple_graphcounterparts, but they refer to vertices fromGto avoid subtype coercions. -
subgraph.coeis the coercion from aG' : subgraph Gto asimple_graph G'.verts. (This cannot be ahas_coeinstance since the destination type depends onG'.) -
subgraph.is_spanningfor whether a subgraph is a spanning subgraph andsubgraph.is_inducedfor whether a subgraph is an induced subgraph. -
Instances for
lattice (subgraph G)andbounded_order (subgraph G). -
simple_graph.to_subgraph: If asimple_graphis a subgraph of another, then you can turn it into a member of the larger graph'ssimple_graph.subgraphtype. -
Graph homomorphisms from a subgraph to a graph (
subgraph.map_top) and between subgraphs (subgraph.map).
Implementation notes #
- Recall that subgraphs are not determined by their vertex sets, so
set_likedoes not apply to this kind of subobject.
Todo #
- Images of graph homomorphisms as subgraphs.
- verts : set V
- adj : V → V → Prop
- adj_sub : ∀ {v w : V}, self.adj v w → G.adj v w
- edge_vert : ∀ {v w : V}, self.adj v w → v ∈ self.verts
- symm : symmetric self.adj . "obviously"
A subgraph of a simple_graph is a subset of vertices along with a restriction of the adjacency
relation that is symmetric and is supported by the vertex subset. They also form a bounded lattice.
Thinking of V → V → Prop as set (V × V), a set of darts (i.e., half-edges), then
subgraph.adj_sub is that the darts of a subgraph are a subset of the darts of G.
Instances for simple_graph.subgraph
- simple_graph.subgraph.has_sizeof_inst
- simple_graph.subgraph.lattice
- simple_graph.subgraph.bounded_order
- simple_graph.subgraph.subgraph_inhabited
Coercion from G' : subgraph G to a simple_graph ↥G'.verts.
A subgraph is called a spanning subgraph if it contains all the vertices of G. -
Equations
- G'.is_spanning = ∀ (v : V), v ∈ G'.verts
Coercion from subgraph G to simple_graph V. If G' is a spanning
subgraph, then G'.spanning_coe yields an isomorphic graph.
In general, this adds in all vertices from V as isolated vertices.
spanning_coe is equivalent to coe for a subgraph that is_spanning.
A subgraph is called an induced subgraph if vertices of G' are adjacent if
they are adjacent in G.
H.support is the set of vertices that form edges in the subgraph H.
G'.neighbor_set v is the set of vertices adjacent to v in G'.
Equations
- G'.neighbor_set v = set_of (G'.adj v)
Instances for ↥simple_graph.subgraph.neighbor_set
A subgraph as a graph has equivalent neighbor sets.
The edge set of G' consists of a subset of edges of G.
Equations
- G'.edge_set = sym2.from_rel _
The incidence_set is the set of edges incident to a given vertex.
Equations
- G'.incidence_set v = {e ∈ G'.edge_set | v ∈ e}
Create an equal copy of a subgraph (see copy_eq) with possibly different definitional equalities.
See Note [range copy pattern].
The top subgraph is G as a subgraph of itself.
The bot subgraph is the subgraph with no vertices or edges.
The relation that one subgraph is a subgraph of another.
Equations
- simple_graph.subgraph.lattice = {sup := simple_graph.subgraph.union G, le := simple_graph.subgraph.is_subgraph G, lt := semilattice_sup.lt._default simple_graph.subgraph.is_subgraph, le_refl := _, le_trans := _, lt_iff_le_not_le := _, le_antisymm := _, le_sup_left := _, le_sup_right := _, sup_le := _, inf := simple_graph.subgraph.inter G, inf_le_left := _, inf_le_right := _, le_inf := _}
Equations
- simple_graph.subgraph.bounded_order = {top := simple_graph.subgraph.top G, le_top := _, bot := simple_graph.subgraph.bot G, bot_le := _}
Equations
Turn a subgraph of a simple_graph into a member of its subgraph type.
The top of the subgraph G lattice is equivalent to the graph itself.
The bottom of the subgraph G lattice is equivalent to the empty graph on the empty
vertex type.
Graph homomorphisms induce a covariant function on subgraphs.
Graph homomorphisms induce a contravariant function on subgraphs.
Given two subgraphs, one a subgraph of the other, there is an induced injective homomorphism of the subgraphs as graphs.
There is an induced injective homomorphism of a subgraph of G as
a spanning subgraph into G.
Equations
If a graph is locally finite at a vertex, then so is a subgraph of that graph.
Equations
If a subgraph is locally finite at a vertex, then so are subgraphs of that subgraph.
This is not an instance because G'' cannot be inferred.
Equations
Equations
The degree of a vertex in a subgraph. It's zero for vertices outside the subgraph.
Equations
- G'.degree v = fintype.card ↥(G'.neighbor_set v)
Subgraphs of subgraphs #
Given a subgraph of a subgraph of G, construct a subgraph of G.
Equations
Given a subgraph of G, restrict it to being a subgraph of another subgraph G' by
taking the portion of G that intersects G'.
Equations
Edge deletion #
Given a subgraph G' and a set of vertex pairs, remove all of the corresponding edges
from its edge set, if present.
See also: simple_graph.delete_edges.
Induced subgraphs #
The induced subgraph of a subgraph. The expectation is that s ⊆ G'.verts for the usual
notion of an induced subgraph, but, in general, s is taken to be the new vertex set and edges
are induced from the subgraph G'.
Given a subgraph and a set of vertices, delete all the vertices from the subgraph, if present. Any edges indicent to the deleted vertices are deleted as well.
Equations
- G'.delete_verts s = G'.induce (G'.verts \ s)