Laplacian Matrix #
This module defines the Laplacian matrix of a graph, and proves some of its elementary properties.
Main definitions & Results #
SimpleGraph.degMatrix
: The degree matrix of a simple graphSimpleGraph.lapMatrix
: The Laplacian matrix of a simple graph, defined as the difference between the degree matrix and the adjacency matrix.isPosSemidef_lapMatrix
: The Laplacian matrix is positive semidefinite.rank_ker_lapMatrix_eq_card_ConnectedComponent
: The number of connected components inG
is the dimension of the nullspace of its Laplacian matrix.
The diagonal matrix consisting of the degrees of the vertices in the graph.
Equations
- SimpleGraph.degMatrix R G = Matrix.diagonal fun (x : V) => ↑(G.degree x)
Instances For
The Laplacian matrix lapMatrix G R
of a graph G
is the matrix L = D - A
where D
is the degree and A
the adjacency matrix of G
.
Equations
Instances For
Let $L$ be the graph Laplacian and let $x \in \mathbb{R}$, then $$x^{\top} L x = \sum_{i \sim j} (x_{i}-x_{j})^{2}$$, where $\sim$ denotes the adjacency relation
The Laplacian matrix is positive semidefinite
Given a connected component c
of a graph G
, lapMatrix_ker_basis_aux c
is the map
V → ℝ
which is 1
on the vertices in c
and 0
elsewhere.
The family of these maps indexed by the connected components of G
proves to be a basis
of the kernel of lapMatrix G R
Equations
Instances For
lapMatrix_ker_basis G
is a basis of the nullspace indexed by its connected components,
the basis is made up of the functions V → ℝ
which are 1
on the vertices of the given
connected component and 0
elsewhere.
Instances For
The number of connected components in G
is the dimension of the nullspace its Laplacian.