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.isSymm_degMatrix {V : Type u_1} {α : Type u_2} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] [AddMonoidWithOne α] :
      (SimpleGraph.degMatrix α G).IsSymm
      theorem SimpleGraph.isSymm_lapMatrix {V : Type u_1} {α : Type u_2} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] [AddGroupWithOne α] :
      (SimpleGraph.lapMatrix α G).IsSymm
      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α) :
      (SimpleGraph.degMatrix α G).mulVec vec v = (G.degree 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α) :
      (SimpleGraph.lapMatrix α G).mulVec vec v = (G.degree v) * vec v - (G.neighborFinset v).sum 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 α] :
      ((SimpleGraph.lapMatrix α G).mulVec 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 ((SimpleGraph.degMatrix α G).mulVec x) = Finset.univ.sum fun (i : V) => (G.degree 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) :
      (G.degree i) = Finset.univ.sum 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.univ.sum fun (i : V) => Finset.univ.sum 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

      theorem SimpleGraph.posSemidef_lapMatrix {V : Type u_1} (α : Type u_2) [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] [LinearOrderedField α] [StarRing α] [StarOrderedRing α] [TrivialStar α] :
      (SimpleGraph.lapMatrix α G).PosSemidef

      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), G.Reachable 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), G.Reachable i jx i = x j
      theorem SimpleGraph.mem_ker_toLin'_lapMatrix_of_connectedComponent {V : Type u_1} [Fintype V] [DecidableEq V] {G : SimpleGraph V} [DecidableRel G.Adj] [DecidableEq G.ConnectedComponent] (c : G.ConnectedComponent) :
      (fun (i : V) => if G.connectedComponentMk i = c then 1 else 0) LinearMap.ker (Matrix.toLin' (SimpleGraph.lapMatrix G))
      def SimpleGraph.lapMatrix_ker_basis_aux {V : Type u_1} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] [DecidableEq G.ConnectedComponent] (c : G.ConnectedComponent) :
      (LinearMap.ker (Matrix.toLin' (SimpleGraph.lapMatrix G)))

      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
      • G.lapMatrix_ker_basis_aux c = fun (i : V) => if G.connectedComponentMk i = c then 1 else 0,
      Instances For
        theorem SimpleGraph.linearIndependent_lapMatrix_ker_basis_aux {V : Type u_1} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] [DecidableEq G.ConnectedComponent] :
        LinearIndependent G.lapMatrix_ker_basis_aux
        theorem SimpleGraph.top_le_span_range_lapMatrix_ker_basis_aux {V : Type u_1} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] [DecidableEq G.ConnectedComponent] :
        Submodule.span (Set.range G.lapMatrix_ker_basis_aux)
        noncomputable def SimpleGraph.lapMatrix_ker_basis {V : Type u_1} [Fintype V] [DecidableEq V] (G : SimpleGraph V) [DecidableRel G.Adj] [DecidableEq G.ConnectedComponent] :
        Basis G.ConnectedComponent (LinearMap.ker (Matrix.toLin' (SimpleGraph.lapMatrix G)))

        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.