Documentation

Mathlib.Combinatorics.SimpleGraph.LapMatrix

Laplacian Matrix #

This module defines the Laplacian matrix of a graph, and proves some of its elementary properties.

Main definitions & Results #

def SimpleGraph.degMatrix {V : Type u_1} (α : Type u_2) [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] [AddMonoidWithOne α] :
Matrix V V α

The diagonal matrix consisting of the degrees of the vertices in the graph.

Equations
Instances For
    def SimpleGraph.lapMatrix {V : Type u_1} (α : Type u_2) [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] [AddGroupWithOne α] :
    Matrix V V α

    lapMatrix G R is the matrix L = D - A where Dis the degree and A the adjacency matrix of G.

    Equations
    Instances For
      theorem SimpleGraph.degMatrix_mulVec_apply {V : Type u_1} {α : Type u_2} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] [NonAssocSemiring α] (v : V) (vec : Vα) :
      theorem SimpleGraph.lapMatrix_mulVec_apply {V : Type u_1} {α : Type u_2} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] [NonAssocRing α] (v : V) (vec : Vα) :
      Matrix.mulVec (SimpleGraph.lapMatrix α G) vec v = (SimpleGraph.degree G v) * vec v - Finset.sum (SimpleGraph.neighborFinset G v) fun (u : V) => vec u
      theorem SimpleGraph.lapMatrix_mulVec_const_eq_zero {V : Type u_1} {α : Type u_2} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] [Ring α] :
      (Matrix.mulVec (SimpleGraph.lapMatrix α G) fun (x : V) => 1) = 0
      theorem SimpleGraph.dotProduct_mulVec_degMatrix {V : Type u_1} {α : Type u_2} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] [CommRing α] (x : Vα) :
      Matrix.dotProduct x (Matrix.mulVec (SimpleGraph.degMatrix α G) x) = Finset.sum Finset.univ fun (i : V) => (SimpleGraph.degree G i) * x i * x i
      theorem SimpleGraph.degree_eq_sum_if_adj {V : Type u_1} (α : Type u_2) [Fintype V] (G : SimpleGraph V) [DecidableRel G.Adj] [AddCommMonoidWithOne α] (i : V) :
      (SimpleGraph.degree G i) = Finset.sum Finset.univ fun (j : V) => if G.Adj i j then 1 else 0
      theorem SimpleGraph.lapMatrix_toLinearMap₂' {V : Type u_1} (α : Type u_2) [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] [Field α] [CharZero α] (x : Vα) :
      ((Matrix.toLinearMap₂' (SimpleGraph.lapMatrix α G)) x) x = (Finset.sum Finset.univ fun (i : V) => Finset.sum Finset.univ fun (j : V) => if G.Adj i j then (x i - x j) ^ 2 else 0) / 2

      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

      theorem SimpleGraph.lapMatrix_toLinearMap₂'_apply'_eq_zero_iff_forall_adj {V : Type u_1} (α : Type u_2) [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] [LinearOrderedField α] (x : Vα) :
      ((Matrix.toLinearMap₂' (SimpleGraph.lapMatrix α G)) x) x = 0 ∀ (i j : V), G.Adj i jx i = x j
      theorem SimpleGraph.lapMatrix_toLin'_apply_eq_zero_iff_forall_adj {V : Type u_1} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] (x : V) :
      (Matrix.toLin' (SimpleGraph.lapMatrix G)) x = 0 ∀ (i j : V), G.Adj i jx i = x j
      theorem SimpleGraph.lapMatrix_toLinearMap₂'_apply'_eq_zero_iff_forall_reachable {V : Type u_1} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] (x : V) :
      ((Matrix.toLinearMap₂' (SimpleGraph.lapMatrix G)) x) x = 0 ∀ (i j : V), SimpleGraph.Reachable G i jx i = x j
      theorem SimpleGraph.lapMatrix_toLin'_apply_eq_zero_iff_forall_reachable {V : Type u_1} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] (x : V) :
      (Matrix.toLin' (SimpleGraph.lapMatrix G)) x = 0 ∀ (i j : V), SimpleGraph.Reachable G i jx i = x j

      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.

        Equations
        Instances For

          The number of connected components in G is the dimension of the nullspace its Laplacian.