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 inGis 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 α G = Matrix.diagonal fun (x : V) => ↑(SimpleGraph.degree G x)
Instances For
lapMatrix G R is the matrix L = D - A where Dis 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
- SimpleGraph.lapMatrix_ker_basis_aux G c = { val := fun (i : V) => if SimpleGraph.connectedComponentMk G i = c then 1 else 0, property := ⋯ }
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.
Equations
Instances For
The number of connected components in G is the dimension of the nullspace its Laplacian.