Definition:Adjacency Matrix

Definition
An adjacency matrix is a matrix which describes a graph by representing which vertices are adjacent to which other vertices.

If $$G$$ is a graph of order $n$, then its adjacency matrix is an $n \times n$ square matrix, where each row and column corresponds to a vertex of $$G$$.

The element $$a_{i j}$$ of such a matrix specifies the number of edges from vertex $$i$$ to vertex $$j$$.

An adjacency matrix for an undirected graph is symmetrical about the main diagonal.

This is because if vertex $$i$$ is adjacent to vertex $$j$$, then $$j$$ is adjacent to $$i$$.

An adjacency matrix for a weighted graph or network contains the weights of the edges.

Simple Graph
The elements of an adjacency matrix of a simple graph are $$0$$ and $$1$$, and the diagonal elements are all zero:


 * SimpleGraph.png $$\qquad \begin{pmatrix}

0 & 1 & 0 & 0 & 1 & 0 & 0 \\ 1 & 0 & 0 & 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 & 1 & 1 & 0 \\ 0 & 0 & 1 & 0 & 1 & 1 & 0 \\ 1 & 1 & 1 & 1 & 0 & 0 & 0 \\ 0 & 0 & 1 & 1 & 0 & 0 & 1 \\ 0 & 0 & 0 & 0 & 0 & 1 & 0 \\ \end{pmatrix}$$

Multigraph
The elements of an adjacency matrix of a multigraph are integers, and the diagonal elements are all zero:

$$\qquad \begin{pmatrix} 0 & 1 & 0 & 0 & 0 & 0 \\ 1 & 0 & 2 & 1 & 0 & 0 \\ 0 & 2 & 0 & 1 & 0 & 0 \\ 0 & 1 & 1 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 & 0 & 3 \\ 0 & 0 & 0 & 0 & 3 & 0 \\ \end{pmatrix}$$

Digraph
An adjacency matrix for a directed graph is no longer symmetrical about the main diagonal:

$$\qquad \begin{pmatrix} 0 & 1 & 0 & 1 \\ 0 & 0 & 0 & 1 \\ 0 & 0 & 0 & 0 \\ 1 & 0 & 1 & 0 \\ \end{pmatrix}$$

Pseudograph
The elements on the main diagonal of an adjacency matrix for a pseudograph (or loop-graph) are not all non-zero:

$$\qquad \begin{pmatrix} 0 & 1 & 0 & 0 & 1 & 0 & 0 \\ 1 & 0 & 0 & 0 & 1 & 0 & 0 \\ 0 & 0 & 2 & 1 & 1 & 1 & 0 \\ 0 & 0 & 1 & 2 & 1 & 1 & 0 \\ 1 & 1 & 1 & 1 & 0 & 0 & 0 \\ 0 & 0 & 1 & 1 & 0 & 0 & 1 \\ 0 & 0 & 0 & 0 & 0 & 1 & 0 \\ \end{pmatrix}$$

Note that some other treatments of this subject require that a loop contributes a value of $$1$$ to the vertex to which it is incident.

Loop-Multigraph
The elements of the adjacency matrix of a loop-multigraph are integers, and this time some of the diagonal elements are non-zero:

$$\qquad \begin{pmatrix} 0 & 2 & 0 & 0 & 0 & 0 \\ 2 & 0 & 1 & 1 & 0 & 0 \\ 0 & 1 & 2 & 1 & 0 & 0 \\ 0 & 1 & 1 & 2 & 0 & 1 \\ 0 & 0 & 0 & 0 & 0 & 3 \\ 0 & 0 & 0 & 1 & 3 & 0 \\ \end{pmatrix}$$

Loop-Digraph
An adjacency matrix for a loop-digraph is not only not symmetrical about the main diagonal, it also has entries on that main diagonal:

$$\qquad \begin{pmatrix} 1 & 1 & 0 & 1 \\ 0 & 0 & 0 & 1 \\ 0 & 0 & 0 & 0 \\ 1 & 0 & 1 & 0 \\ \end{pmatrix}$$

Network
An adjacency matrix for a general network can have any numbers in any of its elements:

$$\qquad \begin{pmatrix} 0 & 1.2 & 0 & 0.5 \\ 0 & 0 & 0 & 3.4 \\ 0 & 0 & 0 & 0 \\ 4.1 & 0 & 10.1 & 0 \\ \end{pmatrix}$$