Adjacency Matrices #
THIS FILE IS SYNCHRONIZED WITH MATHLIB4. Any changes to this file require a corresponding PR to mathlib4.
This module defines the adjacency matrix of a graph, and provides theorems connecting graph properties to computational properties of the matrix.
Main definitions #
- 
matrix.is_adj_matrix:A : matrix V V αis qualified as an "adjacency matrix" if (1) every entry ofAis0or1, (2)Ais symmetric, (3) every diagonal entry ofAis0. - 
matrix.is_adj_matrix.to_graph: forA : matrix V V αandh : A.is_adj_matrix,h.to_graphis the simple graph induced byA. - 
matrix.compl: forA : matrix V V α,A.complis supposed to be the adjacency matrix of the complement graph of the graph induced byA. - 
simple_graph.adj_matrix: the adjacency matrix of asimple_graph. - 
simple_graph.adj_matrix_pow_apply_eq_card_walk: each entry of thenth power of a graph's adjacency matrix counts the number of length-nwalks between the corresponding pair of vertices. 
- zero_or_one : (∀ (i j : V), A i j = 0 ∨ A i j = 1) . "obviously"
 - symm : A.is_symm . "obviously"
 - apply_diag : (∀ (i : V), A i i = 0) . "obviously"
 
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.
For A : matrix V V α and h : is_adj_matrix A,
h.to_graph is the simple graph whose adjacency matrix is A.
Equations
- matrix.is_adj_matrix.adj.decidable_rel h = _.mpr (λ (a b : V), _inst_3 (A a b) 1)
 
For A : matrix V V α, A.compl is supposed to be the adjacency matrix of
the complement graph of the graph induced by A.adj_matrix.
adj_matrix 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.
The adjacency matrix of G is an adjacency matrix.
The graph induced by the adjacency matrix of G is G itself.
If A is qualified as an adjacency matrix,
then the adjacency matrix of the graph induced by A is itself.