Documentation

CslibFrontier.Foundations.LinearAlgebra.Matrix.Laplacian

The Laplacian of a weight matrix #

A square matrix A : Matrix κ κ R can be read as the arc weights of a weighted digraph on κ. Its Laplacian Matrix.laplacian A is the diagonal matrix of the row sums of A, minus A. Row u of the Laplacian is ∑ v, A u v • (eᵤ - eᵥ). In particular every row sums to zero, and the diagonal entries A u u (loops) cancel. For the adjacency matrix of a simple graph this is Mathlib's SimpleGraph.lapMatrix. For a digraph it is the out-degree Laplacian.

The determinants of its principal minors count spanning trees and arborescences. These are the matrix-tree theorems in CslibFrontier.Foundations.Combinatorics.SimpleGraph.MatrixTree and CslibFrontier.Foundations.Combinatorics.Digraph.MatrixTree. Both proofs evaluate determinants of matrices that become triangular after the index set is ordered by a weight. The determinant of such a matrix is the product of its diagonal (Matrix.det_eq_prod_diag_of_weight).

Main definitions #

Main results #

def Matrix.laplacian {κ : Type u_1} {R : Type u_2} [Fintype κ] [DecidableEq κ] [AddCommGroup R] (A : Matrix κ κ R) :
Matrix κ κ R

The Laplacian of a square matrix A, read as the arc weights of a weighted digraph: the diagonal matrix of the row sums of A, minus A. Its row u is ∑ v, A u v • (eᵤ - eᵥ), so the diagonal entries A u u (loops) cancel.

theorem Matrix.laplacian_apply {κ : Type u_1} {R : Type u_2} [Fintype κ] [DecidableEq κ] [AddCommGroup R] (A : Matrix κ κ R) (u v : κ) :
A.laplacian u v = (if u = v then ∑ w : κ, A u w else 0) - A u v

The entries of the Laplacian.

theorem Matrix.det_eq_prod_diag_of_weight {κ : Type u_1} {R : Type u_2} [Fintype κ] [DecidableEq κ] [CommRing R] (M : Matrix κ κ R) (d : κ → ℕ) (hM : ∀ (i j : κ), i ≠ j → M i j ≠ 0 → d i < d j) :
M.det = ∏ i : κ, M i i

A square matrix whose off-diagonal nonzero entries M i j all satisfy d i < d j for a weight d has determinant the product of its diagonal entries.

theorem Matrix.det_submatrix_eq_of_sum_eq_zero {R : Type u_3} {V : Type u_4} [CommRing R] [Fintype V] [DecidableEq V] (L : Matrix V V R) (hrow : ∀ (u : V), ∑ v : V, L u v = 0) (hcol : ∀ (v : V), ∑ u : V, L u v = 0) (u v : V) :

For a matrix L whose row sums and column sums all vanish, all principal cofactors obtained by deleting a single row and matching column are equal.

theorem Matrix.det_laplacian_submatrix_eq {R : Type u_3} {V : Type u_4} [CommRing R] [Fintype V] [DecidableEq V] (A : Matrix V V R) (hbal : ∀ (v : V), ∑ w : V, A v w = ∑ u : V, A u v) (u v : V) :

For a balanced weight matrix A (∑ w, A v w = ∑ u, A u v), all reduced Laplacian determinants are equal across roots.