Undirected hypergraphs #
An undirected hypergraph (here abbreviated as hypergraph) H is a generalization of a graph
(see Mathlib.Combinatorics.Graph or Mathlib.Combinatorics.SimpleGraph) and consists of a set of
vertices, usually denoted V or V(H), and a set of hyperedges, here called edges and
denoted E or E(H). In contrast with a graph, where edges are unordered pairs of vertices, in
hypergraphs, edges are unordered sets of vertices; i.e., they are subsets of the vertex set V.
A hypergraph where V = ∅ and E = ∅ is empty, denoted ⊥. A hypergraph with a nonempty
vertex set (V ≠ ∅) and empty edge set is trivial. A hypergraph where the edge set is the power
set of the vertex set (or, equivalently, where all possible subsets of the vertex sets are in the
edge set) is complete.
If a edge e contains only one vertex (i.e., |e| = 1), then it is a loop.
This module defines Hypergraph α for a vertex type α (edges are defined as Set (Set α)).
Main definitions #
Hypergraph αis the type of undirected hypergraphs with vertices of typeαand edges of typeSet α. In addition to vertices and hyperedges, aHypergraphmust have the property that all edges are subsets of the vertex set.
For H : Hypergraph α:
H.vertexSet(abbrev.V(H)) denotes the vertex set ofHas a term inSet α.H.edgeSet(abbrev.E(H)) denotes the edge set ofHas a term inSet (Set α). Hyperedges must be subsets ofV(H).H.Adj x ymeans that there exists some edge containing bothxandy(or, in other words,xandyare incident to some shared edgee).H.EAdj e fmeans that there exists some vertex that is incident to the edgeseandf : Set α.
Implementation details #
This implementation is heavily inspired by Peter Nelson and Jun Kwon's Graph implementation,
which was in turn inspired by Matroid.
Paraphrasing Mathlib.Combinatorics.Graph.Basic:
"The main tradeoff is that parts of the API will need to care about whether a term
x : α or e : Set α is a 'real' vertex or edge of the graph, rather than something outside
the vertex or edge set. This is an issue, but is likely amenable to automation."
Because edgeSet is a Set (Set α), rather than a multiset, here we are assuming that
all hypergraphs are without repeated edge.
An undirected hypergraph with vertices of type α and edges of type Set α, as described by vertex
and edge sets vertexSet : Set α and edgeSet : Set (Set α).
The requirement subset_vertexSet_of_mem_edgeSet ensures that all vertices in edges are part of
vertexSet, i.e., all edges are subsets of the vertexSet.
- vertexSet : Set α
The vertex set
The edge set
All edges must be subsets of the vertex set
Instances For
Notation #
V(H) denotes the vertexSet of a hypergraph H
Equations
- One or more equations did not get rendered due to their size.
Instances For
E(H) denotes the edgeSet of a hypergraph H
Equations
- One or more equations did not get rendered due to their size.
Instances For
Vertex-Hyperedge Incidence #
Vertex and Hyperedge Adjacency #
Predicate for adjacency. Two vertices x and y are adjacent if there is some edge e ∈ E(H)
where x and y are both incident to e.
Note that we do not need to explicitly check that x, y ∈ V(H) here because a vertex that is not in
the vertex set cannot be incident to any edge.
Instances For
Predicate for edge adjacency. Analogous to Hypergraph.Adj, edges e and f are
adjacent if there is some vertex x ∈ V(H) where x is incident to both e and f.
Instances For
Basic Hypergraph Definitions & Predicates #
The image of a hypergraph H : Hypergraph α under a function f : α → β is the hypergraph
Hᶠ : Hypergraph β where the vertex set of Hᶠ is the image of V(H) under f and the edge set
of Hᶠ is the set of images of the edges (subsets of vertices) in E(H).
Equations
Instances For
A vertex is isolated if it is not incident to any edges (including loops).
Equations
- H.IsIsolated x = ∀ e ∈ H.edgeSet, x ∉ e
Instances For
A hypergraph is nonempty if it has at least one vertex or at least one edge.
Instances For
The empty hypergraph (bottom) on a type.
Alias of the reverse direction of Hypergraph.ne_bot_iff.
The trivial hypergraph with a given vertex set is defined by having no edges on that vertex set.
Equations
- Hypergraph.trivialOn f = { vertexSet := f, edgeSet := ∅, subset_vertexSet_of_mem_edgeSet' := ⋯ }
Instances For
A hypergraph is complete if every subset of the vertex set is in the edge set.
Equations
- H.IsComplete = ∀ e ⊆ H.vertexSet, e ∈ H.edgeSet
Instances For
The complete hypergraph with a given vertex set, which has each subset of the vertex set as an edge.
Equations
- Hypergraph.completeOn f = { vertexSet := f, edgeSet := 𝒫 f, subset_vertexSet_of_mem_edgeSet' := ⋯ }