Definitions for finite and locally finite graphs #
This file defines finite versions of edgeSet
, neighborSet
and incidenceSet
and proves some
of their basic properties. It also defines the notion of a locally finite graph, which is one
whose vertices have finite degree.
The design for finiteness is that each definition takes the smallest finiteness assumption
necessary. For example, SimpleGraph.neighborFinset v
only requires that v
have
finitely many neighbors.
Main definitions #
SimpleGraph.edgeFinset
is theFinset
of edges in a graph, ifedgeSet
is finiteSimpleGraph.neighborFinset
is theFinset
of vertices adjacent to a given vertex, ifneighborSet
is finiteSimpleGraph.incidenceFinset
is theFinset
of edges containing a given vertex, ifincidenceSet
is finite
Naming conventions #
If the vertex type of a graph is finite, we refer to its cardinality as CardVerts
or card_verts
.
Implementation notes #
- A locally finite graph is one with instances
Π v, Fintype (G.neighborSet v)
. - Given instances
DecidableRel G.Adj
andFintype V
, then the graph is locally finite, too.
The edgeSet
of the graph as a Finset
.
Equations
- G.edgeFinset = G.edgeSet.toFinset
Instances For
Alias of the reverse direction of SimpleGraph.edgeFinset_subset_edgeFinset
.
Alias of the reverse direction of SimpleGraph.edgeFinset_ssubset_edgeFinset
.
The complete graph on n
vertices has n.choose 2
edges.
Any graph on n
vertices has at most n.choose 2
edges.
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
.
Equations
Instances For
Alias of the forward direction of SimpleGraph.deleteFar_iff
.
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.
G.neighbors v
is the Finset
version of G.Adj v
in case G
is
locally finite at v
.
Equations
- G.neighborFinset v = (G.neighborSet v).toFinset
Instances For
Equations
- G.incidenceSetFintype v = Fintype.ofEquiv (↑(G.neighborSet v)) (G.incidenceSetEquivNeighborSet v).symm
This is the Finset
version of incidenceSet
.
Equations
- G.incidenceFinset v = (G.incidenceSet v).toFinset
Instances For
A graph is locally finite if every vertex has a finite neighbor set.
Instances For
A locally finite simple graph is regular of degree d
if every vertex has degree d
.
Instances For
Equations
- G.neighborSetFintype v = Subtype.fintype fun (x : V) => x ∈ G.neighborSet v
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
.
Equations
- G.minDegree = WithTop.untop' 0 (Finset.image (fun (v : V) => G.degree v) Finset.univ).min
Instances For
There exists a vertex of minimal degree. Note the assumption of being nonempty is necessary, as the lemma implies there exists a vertex.
The minimum degree in the graph is at most the degree of any particular vertex.
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.
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
.
Equations
- G.maxDegree = Option.getD (Finset.image (fun (v : V) => G.degree v) Finset.univ).max 0
Instances For
There exists a vertex of maximal degree. Note the assumption of being nonempty is necessary, as the lemma implies there exists a vertex.
The maximum degree in the graph is at least the degree of any particular vertex.
In a graph, if k
is at least the degree of every vertex, then it is at least the maximum
degree.
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.
If the condition G.Adj v w
fails, then card_commonNeighbors_le_degree
is
the best we can do in general.