The Mathlib Handbook

The volumes of the handbook are not written yet. This site shows the map of Mathlib that they will follow, at Mathlib 4472534b60.

The areas / V30. Combinatorics

Mathlib.Combinatorics.SimpleGraph.AdjMatrix

83 declarations. Mathlib docs · Source

Adjacency Matrices

This module defines the adjacency matrix of a graph, and provides theorems connecting graph properties to computational properties of the matrix.

Main definitions

  • Matrix.IsAdjMatrix: A : Matrix V V α is qualified as an "adjacency matrix" if (1) every entry of A is 0 or 1, (2) A is symmetric, (3) every diagonal entry of A is 0.

  • Matrix.IsAdjMatrix.toGraph: for A : Matrix V V α and h : A.IsAdjMatrix, h.toGraph is the simple graph induced by A.

  • Matrix.compl: for A : Matrix V V α, A.compl is supposed to be the adjacency matrix of the complement graph of the graph induced by A.

  • SimpleGraph.adjMatrix: the adjacency matrix of a SimpleGraph.

  • SimpleGraph.adjMatrix_pow_apply_eq_card_walk: each entry of the nth power of a graph's adjacency matrix counts the number of length-n walks between the corresponding pair of vertices.

theorem SimpleGraph.adjMatrix.congr_simp E1 #

∀ (α : Type u_1) {V : Type u_2} (G G_1 : SimpleGraph V),
  G = G_1 →
    ∀ {inst : DecidableRel G.Adj} [inst_1 : DecidableRel G_1.Adj] [inst_2 : Zero α] [inst_3 : One α] (a a_1 : V),
      a = a_1 → ∀ (a_2 a_3 : V), a_2 = a_3 → SimpleGraph.adjMatrix α G a a_2 = SimpleGraph.adjMatrix α G_1 a_1 a_3

theorem Matrix.compl.congr_simp E1 #

∀ {α : Type u_1} {V : Type u_2} [inst : Zero α] [inst_1 : One α] [inst_2 : DecidableEq α] {inst_3 : DecidableEq V}
  [inst_4 : DecidableEq V] (A A_1 : Matrix V V α),
  A = A_1 → ∀ (a a_1 : V), a = a_1 → ∀ (a_2 a_3 : V), a_2 = a_3 → A.compl a a_2 = A_1.compl a_1 a_3

theorem Matrix.IsAdjMatrix.toGraph.congr_simp E1 #

∀ {α : Type u_1} {V : Type u_2} {A A_1 : Matrix V V α} (e_A : A = A_1) [inst : MulZeroOneClass α]
  [inst_1 : Nontrivial α] (h : A.IsAdjMatrix), h.toGraph = ⋯.toGraph

structure Matrix.IsAdjMatrix E3 #

{α : Type u_1} → {V : Type u_2} → [Zero α] → [One α] → Matrix V V α → Prop

A : Matrix V V α is qualified as an "adjacency matrix" if (1) every entry of A is 0 or 1, (2) A is symmetric, (3) every diagonal entry of A is 0.

ctor Matrix.IsAdjMatrix.mk E0 #

∀ {α : Type u_1} {V : Type u_2} [inst : Zero α] [inst_1 : One α] {A : Matrix V V α},
  autoParam (∀ (i j : V), A i j = 0 ∨ A i j = 1) Matrix.IsAdjMatrix.zero_or_one._autoParam →
    autoParam A.IsSymm Matrix.IsAdjMatrix.symm._autoParam →
      autoParam (∀ (i : V), A i i = 0) Matrix.IsAdjMatrix.apply_diag._autoParam → A.IsAdjMatrix

theorem Matrix.IsAdjMatrix.zero_or_one E1 #

∀ {α : Type u_1} {V : Type u_2} [inst : Zero α] [inst_1 : One α] {A : Matrix V V α},
  A.IsAdjMatrix → ∀ (i j : V), A i j = 0 ∨ A i j = 1

theorem Matrix.IsAdjMatrix.symm E1 #

∀ {α : Type u_1} {V : Type u_2} [inst : Zero α] [inst_1 : One α] {A : Matrix V V α}, A.IsAdjMatrix → A.IsSymm

theorem Matrix.IsAdjMatrix.apply_diag E1 #

∀ {α : Type u_1} {V : Type u_2} [inst : Zero α] [inst_1 : One α] {A : Matrix V V α},
  A.IsAdjMatrix → ∀ (i : V), A i i = 0

theorem Matrix.IsAdjMatrix.zero E0 #

∀ {α : Type u_1} {V : Type u_2} [inst : Zero α] [inst_1 : One α], Matrix.IsAdjMatrix 0

theorem Matrix.IsAdjMatrix.apply_diag_ne E0 #

∀ {α : Type u_1} {V : Type u_2} {A : Matrix V V α} [inst : MulZeroOneClass α] [Nontrivial α],
  A.IsAdjMatrix → ∀ (i : V), ¬A i i = 1

theorem Matrix.IsAdjMatrix.apply_ne_one_iff E0 #

∀ {α : Type u_1} {V : Type u_2} {A : Matrix V V α} [inst : MulZeroOneClass α] [Nontrivial α],
  A.IsAdjMatrix → ∀ (i j : V), ¬A i j = 1 ↔ A i j = 0

theorem Matrix.IsAdjMatrix.apply_ne_zero_iff E0 #

∀ {α : Type u_1} {V : Type u_2} {A : Matrix V V α} [inst : MulZeroOneClass α] [Nontrivial α],
  A.IsAdjMatrix → ∀ (i j : V), ¬A i j = 0 ↔ A i j = 1

theorem Matrix.IsAdjMatrix.diag_eq_zero E0 #

∀ {α : Type u_1} {V : Type u_2} {A : Matrix V V α} [inst : Zero α] [inst_1 : One α], A.IsAdjMatrix → A.diag = 0

theorem Matrix.IsAdjMatrix.submatrix E1 #

∀ {α : Type u_1} {V : Type u_2} {W : Type u_3} {A : Matrix V V α} [inst : Zero α] [inst_1 : One α],
  A.IsAdjMatrix → ∀ (f : W → V), (A.submatrix f f).IsAdjMatrix

theorem Matrix.isAdjMatrix_submatrix_iff E0 #

∀ {α : Type u_1} {V : Type u_2} {W : Type u_3} {A : Matrix V V α} [inst : Zero α] [inst_1 : One α] {f : W → V},
  Function.Surjective f → ((A.submatrix f f).IsAdjMatrix ↔ A.IsAdjMatrix)

theorem Matrix.IsAdjMatrix.reindex E1 #

∀ {α : Type u_1} {V : Type u_2} {W : Type u_3} {A : Matrix V V α} [inst : Zero α] [inst_1 : One α],
  A.IsAdjMatrix → ∀ (f : V ≃ W), ((Matrix.reindex f f) A).IsAdjMatrix

theorem Matrix.isAdjMatrix_reindex_iff E0 #

∀ {α : Type u_1} {V : Type u_2} {W : Type u_3} {A : Matrix V V α} [inst : Zero α] [inst_1 : One α] {f : V ≃ W},
  ((Matrix.reindex f f) A).IsAdjMatrix ↔ A.IsAdjMatrix

def Matrix.IsAdjMatrix.toGraph E3 #

{α : Type u_1} →
  {V : Type u_2} → {A : Matrix V V α} → [inst : MulZeroOneClass α] → [Nontrivial α] → A.IsAdjMatrix → SimpleGraph V

For A : Matrix V V α and h : IsAdjMatrix A, h.toGraph is the simple graph whose adjacency matrix is A.

theorem Matrix.IsAdjMatrix.toGraph_adj E0 #

∀ {α : Type u_1} {V : Type u_2} {A : Matrix V V α} [inst : MulZeroOneClass α] [inst_1 : Nontrivial α]
  (h : A.IsAdjMatrix) (i j : V), h.toGraph.Adj i j = (A i j = 1)

instance Matrix.IsAdjMatrix.instDecidableRelAdjToGraphOfDecidableEq E0 #

{α : Type u_1} →
  {V : Type u_2} →
    {A : Matrix V V α} →
      [inst : MulZeroOneClass α] →
        [inst_1 : Nontrivial α] → [DecidableEq α] → (h : A.IsAdjMatrix) → DecidableRel h.toGraph.Adj

def Matrix.IsAdjMatrix.toGraphSubmatrixHom E1 #

{α : Type u_1} →
  {V : Type u_2} →
    {W : Type u_3} →
      (A : Matrix V V α) →
        [inst : MulZeroOneClass α] →
          [inst_1 : Nontrivial α] → (h : A.IsAdjMatrix) → (f : W → V) → ⋯.toGraph →g h.toGraph

A homomorphism of the graph of a submatrix of an adjacency matrix to the graph of the adjacency matrix itself

theorem Matrix.IsAdjMatrix.toGraphSubmatrixHom_apply E0 #

∀ {α : Type u_1} {V : Type u_2} {W : Type u_3} (A : Matrix V V α) [inst : MulZeroOneClass α] [inst_1 : Nontrivial α]
  (h : A.IsAdjMatrix) (f : W → V) (a : W), (Matrix.IsAdjMatrix.toGraphSubmatrixHom A h f) a = f a

def Matrix.IsAdjMatrix.toGraphSubmatrixEmbedding E1 #

{α : Type u_1} →
  {V : Type u_2} →
    {W : Type u_3} →
      (A : Matrix V V α) →
        [inst : MulZeroOneClass α] →
          [inst_1 : Nontrivial α] → (h : A.IsAdjMatrix) → (f : W ↪ V) → ⋯.toGraph ↪g h.toGraph

An embedding of the graph of a submatrix of an adjacency matrix to the graph of the adjacency matrix itself, when the submatrix is given by an embedding

theorem Matrix.IsAdjMatrix.toGraphSubmatrixEmbedding_apply E0 #

∀ {α : Type u_1} {V : Type u_2} {W : Type u_3} (A : Matrix V V α) [inst : MulZeroOneClass α] [inst_1 : Nontrivial α]
  (h : A.IsAdjMatrix) (f : W → V) (v : W), (Matrix.IsAdjMatrix.toGraphSubmatrixHom A h f) v = f v

def Matrix.IsAdjMatrix.toGraphReindexIso E1 #

{α : Type u_1} →
  {V : Type u_2} →
    {W : Type u_3} →
      (A : Matrix V V α) →
        [inst : MulZeroOneClass α] →
          [inst_1 : Nontrivial α] → (h : A.IsAdjMatrix) → (f : V ≃ W) → ⋯.toGraph ≃g h.toGraph

An isomorphism of the graph of a reindexing of an adjacency matrix to the graph of the adjacency matrix itself

theorem Matrix.IsAdjMatrix.toGraphReindexIso_symm_apply E0 #

∀ {α : Type u_1} {V : Type u_2} {W : Type u_3} (A : Matrix V V α) [inst : MulZeroOneClass α] [inst_1 : Nontrivial α]
  (h : A.IsAdjMatrix) (f : V ≃ W) (a : V), (RelIso.symm (Matrix.IsAdjMatrix.toGraphReindexIso A h f)) a = f a

theorem Matrix.IsAdjMatrix.toGraphReindexIso_apply E0 #

∀ {α : Type u_1} {V : Type u_2} {W : Type u_3} (A : Matrix V V α) [inst : MulZeroOneClass α] [inst_1 : Nontrivial α]
  (h : A.IsAdjMatrix) (f : V ≃ W) (a : W), (Matrix.IsAdjMatrix.toGraphReindexIso A h f) a = f.symm a

theorem Matrix.IsAdjMatrix.hadamard_self E0 #

∀ {α : Type u_1} {V : Type u_2} [inst : MulZeroOneClass α] {A : Matrix V V α}, A.IsAdjMatrix → A.hadamard A = A

theorem Matrix.isAdjMatrix_iff_hadamard E1 #

∀ {α : Type u_1} {V : Type u_2} [inst : DecidableEq V] [inst_1 : MonoidWithZero α] [IsLeftCancelMulZero α]
  {A : Matrix V V α}, A.IsAdjMatrix ↔ A.hadamard A = A ∧ A.IsSymm ∧ Matrix.hadamard 1 A = 0

def Matrix.compl E3 #

{α : Type u_1} → {V : Type u_2} → [Zero α] → [One α] → [DecidableEq α] → [DecidableEq V] → Matrix V V α → Matrix V V α

For A : Matrix V V α, A.compl is supposed to be the adjacency matrix of the complement graph of the graph induced by A.adjMatrix.

theorem Matrix.compl_apply_diag E0 #

∀ {α : Type u_1} {V : Type u_2} [inst : DecidableEq α] [inst_1 : DecidableEq V] (A : Matrix V V α) [inst_2 : Zero α]
  [inst_3 : One α] (i : V), A.compl i i = 0

theorem Matrix.compl_apply E0 #

∀ {α : Type u_1} {V : Type u_2} [inst : DecidableEq α] [inst_1 : DecidableEq V] (A : Matrix V V α) [inst_2 : Zero α]
  [inst_3 : One α] (i j : V), A.compl i j = 0 ∨ A.compl i j = 1

theorem Matrix.isSymm_compl E0 #

∀ {α : Type u_1} {V : Type u_2} [inst : DecidableEq α] [inst_1 : DecidableEq V] (A : Matrix V V α) [inst_2 : Zero α]
  [inst_3 : One α], A.IsSymm → A.compl.IsSymm

theorem Matrix.isAdjMatrix_compl E0 #

∀ {α : Type u_1} {V : Type u_2} [inst : DecidableEq α] [inst_1 : DecidableEq V] (A : Matrix V V α) [inst_2 : Zero α]
  [inst_3 : One α], A.IsSymm → A.compl.IsAdjMatrix

theorem Matrix.IsAdjMatrix.compl_inj E1 #

∀ {α : Type u_1} {V : Type u_2} [inst : DecidableEq α] [inst_1 : DecidableEq V] [inst_2 : Zero α] [inst_3 : One α]
  {A B : Matrix V V α}, A.IsAdjMatrix → B.IsAdjMatrix → (A.compl = B.compl ↔ A = B)

theorem Matrix.IsAdjMatrix.compl_compl E0 #

∀ {α : Type u_1} {V : Type u_2} [inst : DecidableEq α] [inst_1 : DecidableEq V] [inst_2 : Zero α] [inst_3 : One α]
  {A : Matrix V V α}, A.IsAdjMatrix → A.compl.compl = A

theorem Matrix.IsAdjMatrix.compl E0 #

∀ {α : Type u_1} {V : Type u_2} [inst : DecidableEq α] [inst_1 : DecidableEq V] {A : Matrix V V α} [inst_2 : Zero α]
  [inst_3 : One α], A.IsAdjMatrix → A.compl.IsAdjMatrix

theorem Matrix.IsAdjMatrix.toGraph_compl_eq E0 #

∀ {α : Type u_1} {V : Type u_2} [inst : DecidableEq α] [inst_1 : DecidableEq V] {A : Matrix V V α}
  [inst_2 : MulZeroOneClass α] [inst_3 : Nontrivial α] (h : A.IsAdjMatrix), ⋯.toGraph = h.toGraphᶜ

def SimpleGraph.adjMatrix E3 #

(α : Type u_1) → {V : Type u_2} → (G : SimpleGraph V) → [DecidableRel G.Adj] → [Zero α] → [One α] → Matrix V V α

adjMatrix G α is the matrix A such that A i j = (1 : α) if i and j are adjacent in the simple graph G, and otherwise A i j = 0.

theorem SimpleGraph.adjMatrix_apply E0 #

∀ {α : Type u_1} {V : Type u_2} (G : SimpleGraph V) [inst : DecidableRel G.Adj] (v w : V) [inst_1 : Zero α]
  [inst_2 : One α], SimpleGraph.adjMatrix α G v w = if G.Adj v w then 1 else 0

theorem SimpleGraph.adjMatrix_bot E0 #

∀ {α : Type u_1} {V : Type u_2} [inst : Zero α] [inst_1 : One α], SimpleGraph.adjMatrix α ⊥ = 0

theorem SimpleGraph.adjMatrix_top E0 #

∀ {α : Type u_1} {V : Type u_2} [inst : DecidableEq V] [inst_1 : Ring α],
  SimpleGraph.adjMatrix α ⊤ = Matrix.of fun i j ↦ if i = j then 0 else 1

theorem SimpleGraph.transpose_adjMatrix E0 #

∀ {α : Type u_1} {V : Type u_2} (G : SimpleGraph V) [inst : DecidableRel G.Adj] [inst_1 : Zero α] [inst_2 : One α],
  (SimpleGraph.adjMatrix α G).transpose = SimpleGraph.adjMatrix α G

theorem SimpleGraph.isSymm_adjMatrix E0 #

∀ {α : Type u_1} {V : Type u_2} (G : SimpleGraph V) [inst : DecidableRel G.Adj] [inst_1 : Zero α] [inst_2 : One α],
  (SimpleGraph.adjMatrix α G).IsSymm

theorem SimpleGraph.isAdjMatrix_adjMatrix E0 #

∀ (α : Type u_1) {V : Type u_2} (G : SimpleGraph V) [inst : DecidableRel G.Adj] [inst_1 : Zero α] [inst_2 : One α],
  (SimpleGraph.adjMatrix α G).IsAdjMatrix

The adjacency matrix of G is an adjacency matrix.

theorem SimpleGraph.diag_adjMatrix E1 #

∀ (α : Type u_1) {V : Type u_2} (G : SimpleGraph V) [inst : DecidableRel G.Adj] [inst_1 : Zero α] [inst_2 : One α],
  (SimpleGraph.adjMatrix α G).diag = 0

theorem SimpleGraph.toGraph_adjMatrix_eq E0 #

∀ (α : Type u_1) {V : Type u_2} (G : SimpleGraph V) [inst : DecidableRel G.Adj] [inst_1 : MulZeroOneClass α]
  [inst_2 : Nontrivial α], ⋯.toGraph = G

The graph induced by the adjacency matrix of G is G itself.

theorem SimpleGraph.compl_adjMatrix_eq_adjMatrix_compl E1 #

∀ (α : Type u_1) {V : Type u_2} (G : SimpleGraph V) [inst : DecidableRel G.Adj] [inst_1 : DecidableEq V]
  [inst_2 : DecidableEq α] [inst_3 : Zero α] [inst_4 : One α],
  (SimpleGraph.adjMatrix α G).compl = SimpleGraph.adjMatrix α Gᶜ

theorem SimpleGraph.Embedding.submatrix_adjMatrix E0 #

∀ (α : Type u_1) {V : Type u_2} {W : Type u_3} {G : SimpleGraph V} [inst : DecidableRel G.Adj] [inst_1 : Zero α]
  [inst_2 : One α] {H : SimpleGraph W} [inst_3 : DecidableRel H.Adj] (f : G ↪g H),
  (SimpleGraph.adjMatrix α H).submatrix ⇑f ⇑f = SimpleGraph.adjMatrix α G

theorem SimpleGraph.Iso.reindex_adjMatrix E1 #

∀ (α : Type u_1) {V : Type u_2} {W : Type u_3} {G : SimpleGraph V} [inst : DecidableRel G.Adj] [inst_1 : Zero α]
  [inst_2 : One α] {H : SimpleGraph W} [inst_3 : DecidableRel H.Adj] (f : G ≃g H),
  (Matrix.reindex ↑f ↑f) (SimpleGraph.adjMatrix α G) = SimpleGraph.adjMatrix α H

theorem SimpleGraph.IsCompl.adjMatrix_add_adjMatrix_eq_adjMatrix_completeGraph E1 #

∀ (α : Type u_1) {V : Type u_2} {G : SimpleGraph V} [inst : DecidableRel G.Adj] [inst_1 : DecidableEq V]
  [inst_2 : AddZeroClass α] [inst_3 : One α] {H : SimpleGraph V} [inst_4 : DecidableRel H.Adj],
  IsCompl G H →
    SimpleGraph.adjMatrix α G + SimpleGraph.adjMatrix α H = SimpleGraph.adjMatrix α (SimpleGraph.completeGraph V)

theorem SimpleGraph.adjMatrix_add_compl_adjMatrix_eq_adjMatrix_completeGraph E0 #

∀ (α : Type u_1) {V : Type u_2} (G : SimpleGraph V) [inst : DecidableRel G.Adj] [inst_1 : DecidableEq V]
  [inst_2 : DecidableEq α] [inst_3 : AddZeroClass α] [inst_4 : One α],
  SimpleGraph.adjMatrix α G + (SimpleGraph.adjMatrix α G).compl = SimpleGraph.adjMatrix α (SimpleGraph.completeGraph V)

theorem SimpleGraph.one_add_adjMatrix_add_compl_adjMatrix_eq_of_one E1 #

∀ (α : Type u_1) {V : Type u_2} (G : SimpleGraph V) [inst : DecidableRel G.Adj] [inst_1 : DecidableEq V]
  [inst_2 : DecidableEq α] [inst_3 : AddMonoid α] [inst_4 : One α],
  1 + SimpleGraph.adjMatrix α G + (SimpleGraph.adjMatrix α G).compl = Matrix.of 1

The sum of the identity, the adjacency matrix, and its complement is the all-ones matrix.

theorem SimpleGraph.compl_adjMatrix_completeGraph E0 #

∀ (α : Type u_1) (V : Type u_2) [inst : Zero α] [inst_1 : One α] [inst_2 : DecidableEq α] [inst_3 : DecidableEq V],
  (SimpleGraph.adjMatrix α (SimpleGraph.completeGraph V)).compl = 0

theorem Matrix.compl_zero E0 #

∀ (α : Type u_1) (V : Type u_2) [inst : Zero α] [inst_1 : One α] [inst_2 : DecidableEq α] [inst_3 : DecidableEq V],
  Matrix.compl 0 = SimpleGraph.adjMatrix α (SimpleGraph.completeGraph V)

theorem SimpleGraph.adjMatrix_completeGraph_eq_of_one_sub_one E1 #

∀ (α : Type u_1) (V : Type u_2) [inst : AddGroup α] [inst_1 : One α] [inst_2 : DecidableEq V],
  SimpleGraph.adjMatrix α (SimpleGraph.completeGraph V) = Matrix.of 1 - 1

theorem Matrix.compl_zero_eq_of_one_sub_one E1 #

∀ (α : Type u_1) (V : Type u_2) [inst : AddGroup α] [inst_1 : One α] [inst_2 : DecidableEq V] [inst_3 : DecidableEq α],
  Matrix.compl 0 = Matrix.of 1 - 1

theorem Matrix.compl_of_one_sub_one E0 #

∀ (α : Type u_1) (V : Type u_2) [inst : AddGroup α] [inst_1 : One α] [inst_2 : DecidableEq V] [inst_3 : DecidableEq α],
  (Matrix.of 1 - 1).compl = 0

theorem SimpleGraph.adjMatrix_hadamard_self E1 #

∀ (α : Type u_1) {V : Type u_2} (G : SimpleGraph V) [inst : DecidableRel G.Adj] [inst_1 : MulZeroOneClass α],
  (SimpleGraph.adjMatrix α G).hadamard (SimpleGraph.adjMatrix α G) = SimpleGraph.adjMatrix α G

theorem SimpleGraph.adjMatrix_dotProduct E0 #

∀ {α : Type u_1} {V : Type u_2} (G : SimpleGraph V) [inst : DecidableRel G.Adj] [inst_1 : Fintype V]
  [inst_2 : NonAssocSemiring α] (v : V) (vec : V → α),
  SimpleGraph.adjMatrix α G v ⬝ᵥ vec = ∑ u ∈ G.neighborFinset v, vec u

theorem SimpleGraph.dotProduct_adjMatrix E0 #

∀ {α : Type u_1} {V : Type u_2} (G : SimpleGraph V) [inst : DecidableRel G.Adj] [inst_1 : Fintype V]
  [inst_2 : NonAssocSemiring α] (v : V) (vec : V → α),
  vec ⬝ᵥ SimpleGraph.adjMatrix α G v = ∑ u ∈ G.neighborFinset v, vec u

theorem SimpleGraph.adjMatrix_mulVec_apply E0 #

∀ {α : Type u_1} {V : Type u_2} (G : SimpleGraph V) [inst : DecidableRel G.Adj] [inst_1 : Fintype V]
  [inst_2 : NonAssocSemiring α] (v : V) (vec : V → α),
  (SimpleGraph.adjMatrix α G).mulVec vec v = ∑ u ∈ G.neighborFinset v, vec u

theorem SimpleGraph.adjMatrix_vecMul_apply E0 #

∀ {α : Type u_1} {V : Type u_2} (G : SimpleGraph V) [inst : DecidableRel G.Adj] [inst_1 : Fintype V]
  [inst_2 : NonAssocSemiring α] (v : V) (vec : V → α),
  Matrix.vecMul vec (SimpleGraph.adjMatrix α G) v = ∑ u ∈ G.neighborFinset v, vec u

theorem SimpleGraph.adjMatrix_mul_apply E0 #

∀ {α : Type u_1} {V : Type u_2} {W : Type u_3} (G : SimpleGraph V) [inst : DecidableRel G.Adj] [inst_1 : Fintype V]
  [inst_2 : NonAssocSemiring α] (M : Matrix V W α) (v : V) (w : W),
  (SimpleGraph.adjMatrix α G * M) v w = ∑ u ∈ G.neighborFinset v, M u w

theorem SimpleGraph.mul_adjMatrix_apply E0 #

∀ {α : Type u_1} {V : Type u_2} {W : Type u_3} (G : SimpleGraph V) [inst : DecidableRel G.Adj] [inst_1 : Fintype V]
  [inst_2 : NonAssocSemiring α] (M : Matrix W V α) (v : W) (w : V),
  (M * SimpleGraph.adjMatrix α G) v w = ∑ u ∈ G.neighborFinset w, M v u

theorem SimpleGraph.trace_adjMatrix E0 #

∀ (α : Type u_1) {V : Type u_2} (G : SimpleGraph V) [inst : DecidableRel G.Adj] [inst_1 : Fintype V]
  [inst_2 : AddCommMonoid α] [inst_3 : One α], (SimpleGraph.adjMatrix α G).trace = 0

theorem SimpleGraph.adjMatrix_mul_self_apply_self E1 #

∀ {α : Type u_1} {V : Type u_2} (G : SimpleGraph V) [inst : DecidableRel G.Adj] [inst_1 : Fintype V]
  [inst_2 : NonAssocSemiring α] (i : V), (SimpleGraph.adjMatrix α G * SimpleGraph.adjMatrix α G) i i = ↑(G.degree i)

theorem SimpleGraph.natCast_card_dart_eq_dotProduct E1 #

∀ {α : Type u_1} {V : Type u_2} (G : SimpleGraph V) [inst : DecidableRel G.Adj] [inst_1 : Fintype V]
  [inst_2 : NonAssocSemiring α], ↑(Fintype.card G.Dart) = (SimpleGraph.adjMatrix α G).mulVec 1 ⬝ᵥ 1

The number of all darts in a simple finite graph is equal to the dot product of G.adjMatrix α *ᵥ 1 and 1.

theorem SimpleGraph.adjMatrix_mulVec_const_apply E0 #

∀ {α : Type u_1} {V : Type u_2} {G : SimpleGraph V} [inst : DecidableRel G.Adj] [inst_1 : Fintype V]
  [inst_2 : NonAssocSemiring α] {a : α} {v : V},
  (SimpleGraph.adjMatrix α G).mulVec (Function.const V a) v = ↑(G.degree v) * a

theorem SimpleGraph.adjMatrix_mulVec_const_apply_of_regular E1 #

∀ {α : Type u_1} {V : Type u_2} {G : SimpleGraph V} [inst : DecidableRel G.Adj] [inst_1 : Fintype V]
  [inst_2 : NonAssocSemiring α] {d : ℕ} {a : α},
  G.IsRegularOfDegree d → ∀ {v : V}, (SimpleGraph.adjMatrix α G).mulVec (Function.const V a) v = ↑d * a

theorem SimpleGraph.adjMatrix_pow_apply_eq_card_walk E3 #

∀ {α : Type u_1} {V : Type u_2} {G : SimpleGraph V} [inst : DecidableRel G.Adj] [inst_1 : Fintype V]
  [inst_2 : DecidableEq V] [inst_3 : Semiring α] (n : ℕ) (u v : V),
  (SimpleGraph.adjMatrix α G ^ n) u v = ↑(Fintype.card ↑{p | p.length = n})

theorem SimpleGraph.dotProduct_mulVec_adjMatrix E1 #

∀ {α : Type u_1} {V : Type u_2} {G : SimpleGraph V} [inst : DecidableRel G.Adj] [inst_1 : Fintype V]
  [inst_2 : NonAssocSemiring α] (x y : V → α),
  x ⬝ᵥ (SimpleGraph.adjMatrix α G).mulVec y = ∑ i, ∑ j, if G.Adj i j then x i * y j else 0

theorem SimpleGraph.adjMatrix_hadamard_diagonal E0 #

∀ (α : Type u_1) {V : Type u_2} (G : SimpleGraph V) [inst : DecidableRel G.Adj] [inst_1 : DecidableEq V]
  [inst_2 : MulZeroOneClass α] (d : V → α), (SimpleGraph.adjMatrix α G).hadamard (Matrix.diagonal d) = 0

theorem SimpleGraph.diagonal_hadamard_adjMatrix E0 #

∀ (α : Type u_1) {V : Type u_2} (G : SimpleGraph V) [inst : DecidableRel G.Adj] [inst_1 : DecidableEq V]
  [inst_2 : MulZeroOneClass α] (d : V → α), (Matrix.diagonal d).hadamard (SimpleGraph.adjMatrix α G) = 0

theorem SimpleGraph.adjMatrix_hadamard_natCast E0 #

∀ (α : Type u_1) {V : Type u_2} (G : SimpleGraph V) [inst : DecidableRel G.Adj] [inst_1 : DecidableEq V]
  [inst_2 : MulZeroOneClass α] [inst_3 : NatCast α] (a : ℕ), (SimpleGraph.adjMatrix α G).hadamard ↑a = 0

theorem SimpleGraph.natCast_hadamard_adjMatrix E0 #

∀ (α : Type u_1) {V : Type u_2} (G : SimpleGraph V) [inst : DecidableRel G.Adj] [inst_1 : DecidableEq V]
  [inst_2 : MulZeroOneClass α] [inst_3 : NatCast α] (a : ℕ), (↑a).hadamard (SimpleGraph.adjMatrix α G) = 0

theorem SimpleGraph.adjMatrix_hadamard_ofNat E0 #

∀ (α : Type u_1) {V : Type u_2} (G : SimpleGraph V) [inst : DecidableRel G.Adj] [inst_1 : DecidableEq V]
  [inst_2 : MulZeroOneClass α] [inst_3 : NatCast α] (a : ℕ) [inst_4 : a.AtLeastTwo],
  (SimpleGraph.adjMatrix α G).hadamard (OfNat.ofNat a) = 0

theorem SimpleGraph.ofNat_hadamard_adjMatrix E0 #

∀ (α : Type u_1) {V : Type u_2} (G : SimpleGraph V) [inst : DecidableRel G.Adj] [inst_1 : DecidableEq V]
  [inst_2 : MulZeroOneClass α] [inst_3 : NatCast α] (a : ℕ) [inst_4 : a.AtLeastTwo],
  (OfNat.ofNat a).hadamard (SimpleGraph.adjMatrix α G) = 0

theorem SimpleGraph.adjMatrix_hadamard_intCast E0 #

∀ (α : Type u_1) {V : Type u_2} (G : SimpleGraph V) [inst : DecidableRel G.Adj] [inst_1 : DecidableEq V]
  [inst_2 : MulZeroOneClass α] [inst_3 : IntCast α] (a : ℤ), (SimpleGraph.adjMatrix α G).hadamard ↑a = 0

theorem SimpleGraph.intCast_hadamard_adjMatrix E0 #

∀ (α : Type u_1) {V : Type u_2} (G : SimpleGraph V) [inst : DecidableRel G.Adj] [inst_1 : DecidableEq V]
  [inst_2 : MulZeroOneClass α] [inst_3 : IntCast α] (a : ℤ), (↑a).hadamard (SimpleGraph.adjMatrix α G) = 0

theorem SimpleGraph.adjMatrix_hadamard_one E0 #

∀ (α : Type u_1) {V : Type u_2} (G : SimpleGraph V) [inst : DecidableRel G.Adj] [inst_1 : DecidableEq V]
  [inst_2 : MulZeroOneClass α], (SimpleGraph.adjMatrix α G).hadamard 1 = 0

theorem SimpleGraph.one_hadamard_adjMatrix E0 #

∀ (α : Type u_1) {V : Type u_2} (G : SimpleGraph V) [inst : DecidableRel G.Adj] [inst_1 : DecidableEq V]
  [inst_2 : MulZeroOneClass α], Matrix.hadamard 1 (SimpleGraph.adjMatrix α G) = 0

theorem Matrix.IsAdjMatrix.adjMatrix_toGraph_eq E0 #

∀ {α : Type u_1} {V : Type u_2} [inst : MulZeroOneClass α] [inst_1 : Nontrivial α] {A : Matrix V V α}
  (h : A.IsAdjMatrix) [inst_2 : DecidableEq α], SimpleGraph.adjMatrix α h.toGraph = A

If A is qualified as an adjacency matrix, then the adjacency matrix of the graph induced by A is itself.