Incidence matrix of a simple graph #
This file defines the unoriented incidence matrix of a simple graph.
Main definitions #
SimpleGraph.incMatrix:G.incMatrix Ris the incidence matrix ofGover the ringR.
Main results #
SimpleGraph.incMatrix_mul_transpose_diag: The diagonal entries of the product ofG.incMatrix Rand its transpose are the degrees of the vertices.SimpleGraph.incMatrix_mul_transpose: Gives a complete description of the product ofG.incMatrix Rand its transpose; the diagonal is the degrees of each vertex, and the off-diagonals are 1 or 0 depending on whether or not the vertices are adjacent.SimpleGraph.incMatrix_transpose_mul_diag: The diagonal entries of the product of the transpose ofG.incMatrix RandG.inc_matrix Rare2or0depending on whether or not the unordered pair is an edge ofG.
Implementation notes #
The usual definition of an incidence matrix has one row per vertex and one column per edge.
However, this definition has columns indexed by all of Sym2 α, where α is the vertex type.
This appears not to change the theory, and for simple graphs it has the nice effect that every
incidence matrix for each SimpleGraph α has the same type.
TODO #
Define the oriented incidence matrices for oriented graphs.
Define the graph Laplacian of a simple graph using the oriented incidence matrix from an arbitrary orientation of a simple graph.
G.incMatrix R is the α × Sym2 α matrix whose (a, e)-entry is 1 if e is incident to
a and 0 otherwise.
Equations
- SimpleGraph.incMatrix R G = Matrix.of fun (a : α) (e : Sym2 α) => if e ∈ G.incidenceSet a then 1 else 0
Instances For
Entries of the incidence matrix can be computed given additional decidable instances.