Documentation

CslibFrontier.Foundations.Combinatorics.SimpleGraph.OrientedIncidence

The oriented incidence matrix of a simple graph #

SimpleGraph.orientedIncMatrix G is the integer V × G.edgeSet matrix whose column at an edge e has 1 in the row of one endpoint of e, -1 in the row of the other, and 0 elsewhere. The orientation of each edge is the arbitrary but fixed one given by the representative Quot.out e of e : Sym2 V. No order on V is needed. Mathlib's SimpleGraph.incMatrix is the unoriented incidence matrix.

The Gram matrix of this orientation is the Laplacian: N * Nᵀ = G.lapMatrix ℤ (SimpleGraph.orientedIncMatrix_mul_transpose). Each column of N sums to zero, and pairing a column with a vertex function f gives the difference of the values of f at the two endpoints (SimpleGraph.sum_mul_orientedIncMatrix).

For edge weights w : Sym2 V → R, the weighted adjacency matrix SimpleGraph.weightedAdjMatrix G w has entry w s(u, v) at adjacent u, v. The weighted Gram identity N * diagonal w * Nᵀ = (G.weightedAdjMatrix w).laplacian (SimpleGraph.orientedIncMatrix_map_mul_diagonal_mul_transpose) generalizes SimpleGraph.orientedIncMatrix_mul_transpose, which is its case of all weights 1; here Matrix.laplacian is the diagonal matrix of row sums minus the matrix.

Main definitions #

Main results #

theorem SimpleGraph.out_fst_ne_out_snd_of_mem_edgeSet {V : Type u_1} (G : SimpleGraph V) {e : Sym2 V} (he : e ∈ G.edgeSet) :
(Quot.out e).1 ≠ (Quot.out e).2

The two endpoints (Quot.out e).1 and (Quot.out e).2 of an edge are distinct.

def SimpleGraph.weightedAdjMatrix {V : Type u_1} (G : SimpleGraph V) {R : Type u_2} [Zero R] [DecidableRel G.Adj] (w : Sym2 V → R) :
Matrix V V R

The weighted adjacency matrix of G for edge weights w : Sym2 V → R: the entry (u, v) is w s(u, v) if u and v are adjacent and 0 otherwise. Only the values of w on the edges of G matter.

@[simp]
theorem SimpleGraph.weightedAdjMatrix_apply {V : Type u_1} (G : SimpleGraph V) {R : Type u_2} [Zero R] [DecidableRel G.Adj] (w : Sym2 V → R) (u v : V) :
G.weightedAdjMatrix w u v = if G.Adj u v then w s(u, v) else 0

The entries of the weighted adjacency matrix.

noncomputable def SimpleGraph.orientedIncMatrix {V : Type u_1} (G : SimpleGraph V) [DecidableEq V] :

The oriented incidence matrix of G: the column of an edge e is 1 at the endpoint (Quot.out e).1, -1 at the endpoint (Quot.out e).2, and 0 elsewhere.

theorem SimpleGraph.orientedIncMatrix_apply {V : Type u_1} {G : SimpleGraph V} [DecidableEq V] (v : V) (e : ↑G.edgeSet) :
G.orientedIncMatrix v e = (if v = (Quot.out ↑e).1 then 1 else 0) - if v = (Quot.out ↑e).2 then 1 else 0

The entries of the oriented incidence matrix.

theorem SimpleGraph.sum_mul_orientedIncMatrix {V : Type u_1} {G : SimpleGraph V} [DecidableEq V] [Fintype V] (f : V → ℤ) (e : ↑G.edgeSet) :
∑ v : V, f v * G.orientedIncMatrix v e = f (Quot.out ↑e).1 - f (Quot.out ↑e).2

Pairing a vertex function with a column of the oriented incidence matrix gives the difference of its values at the two endpoints. In particular every column sums to zero.

theorem SimpleGraph.orientedIncMatrix_mul_self {V : Type u_1} {G : SimpleGraph V} [DecidableEq V] (u : V) (e : ↑G.edgeSet) :

The square of an entry of the oriented incidence matrix is 1 at the endpoints of the edge and 0 elsewhere.

theorem SimpleGraph.orientedIncMatrix_eq_zero_of_notMem {V : Type u_1} {G : SimpleGraph V} [DecidableEq V] {u : V} {e : ↑G.edgeSet} (hu : u ∉ ↑e) :

An entry of the oriented incidence matrix vanishes off the endpoints of its edge.

theorem SimpleGraph.orientedIncMatrix_mul_of_ne {V : Type u_1} {G : SimpleGraph V} [DecidableEq V] {u w : V} (huw : u ≠ w) (e : ↑G.edgeSet) :

For distinct vertices u and w, the product of their entries in the column of e is -1 when e joins them and 0 otherwise.

The Laplacian is the Gram matrix of the oriented incidence matrix: N * Nᵀ = G.lapMatrix ℤ, for the orientation of SimpleGraph.orientedIncMatrix.

theorem SimpleGraph.weightedAdjMatrix_one {V : Type u_1} {G : SimpleGraph V} [DecidableRel G.Adj] (R : Type u_2) [Zero R] [One R] :
(G.weightedAdjMatrix fun (x : Sym2 V) => 1) = adjMatrix R G

The adjacency matrix of G is its weighted adjacency matrix with all weights 1.

The Laplacian of G is the Laplacian (Matrix.laplacian) of its adjacency matrix.

The Laplacian of G is the Laplacian (Matrix.laplacian) of its weighted adjacency matrix with all weights 1.

The weighted Laplacian is a weighted Gram matrix of the oriented incidence matrix: N * diagonal w * Nᵀ is the Laplacian of the weighted adjacency matrix G.weightedAdjMatrix w, where N is SimpleGraph.orientedIncMatrix G cast to R.