Graphs can also be defined in the form of matrices. To perform the calculation of paths and cycles in the graphs, matrix representation is used. It is calculated using matrix operations.

The **adjacency matrix**, also called as the **connection matrix**, is a matrix containing rows and columns which is used to represent a simple labelled graph, with 0 or 1 in the position of (V_{i }, V_{j}) according to the condition whether V_{i} and V_{j} are adjacent or not. It is a compact way to represent the finite graph containing n vertices of a m x m matrix M. Sometimes adjacency matrix is also called as vertex matrix and it is defined in the general form as

\(\left\{\begin{matrix} 1 & if \;P_{i}\rightarrow P_{j}\\ 0& otherwise \end{matrix}\right \}\)

If the simple graph has no self-loops, Then the vertex matrix should have 0s in the diagonal. It is symmetric for the undirected graph. The connection matrix is considered as a square array where each row represents the out-nodes of a graph and each column represents the in-nodes of a graph. Entry 1 represents that there is an edge between two nodes.

If a graph G with n vertices, then the vertex matrix n x n is given by

\(A=\begin{bmatrix} a_{11} &a_{12} & \cdots &a_{1n} \\ a_{21} &a_{22} &\cdots &a_{2n} \\ \vdots & \vdots &\ddots & \vdots \\ a_{n1}& a_{n2} & \cdots & a_{nn} \end{bmatrix}\)

Where, the value a_{ij} equals the number of edges from the vertex i to j. For an undirected graph, the value a_{ij} = a_{ji} for all i, j , so that the adjacency matrix becomes symmetric matrix.

From the given directed graph, the it is written as

The adjacency matrix = \(\begin{bmatrix} 0 & 1 & 0 & 1 & 1 \\ 1 & 0 & 1 & 1 & 0\\ 0 & 0 & 0 & 1 & 1\\ 1 & 0 & 1 & 0 & 1\\ 0 & 0 & 0 & 0 & 0 \end{bmatrix}\)

The vertex matrix is an array of numbers which is used to represent the information about the graph. Some of the properties of the graph correspond to the properties of the adjacency matrix, and vice versa. The properties are given as follows:

**Powers**

The most well-known approach to get information about the given graph from operations on this matrix is through its powers. The entries of the powers of the matrix give information about paths in the given graph. The theorem is given below to represent the powers of the adjacency matrix.

**Theorem: **Let us take, A be the connection matrix of a given graph. Then the entries i, j of A^{n} counts n-steps walks from vertex i to j.

**Spectrum**

The study of the eigenvalues of the connection matrix of a graph is clearly defined in spectral graph theory. Assume that, A be the connection matrix of a k-regular graph and v be the all-ones column vector in R^{n}. Then the i-th entry of Av is equal to the sum of the entries in the i^{th} row of A. This represents the number of edges proceeds from vertex i, which is exactly k. So

\(A\begin{bmatrix} 1\\ 1\\ \vdots \\ 1\end{bmatrix}=\begin{bmatrix} k\\ k\\ \vdots \\ k\end{bmatrix}=k\begin{bmatrix} 1\\ 1\\ \vdots \\ 1\end{bmatrix}\)

Where V is an eigenvector of the matrix A containing the eigenvalue k

**Isomorphisms**

The given two graphs are said to be isomorphic if one graph can be obtained from the other by relabeling vertices of another graph. It is noted that the isomorphic graphs need not have the same adjacency matrix. Because this matrix depends on the labelling of the vertices. But the adjacency matrices of the given isomorphic graphs are closely related.

**Theorem: **Assume that, G and H be the graphs having n vertices with the adjacency matrices A and B. Then G and H are said to be isomorphic if and only if there is an occurrence of permutation matrix P such that B=PAP^{-1}.

**Question:**

Write down the adjacency matrix for the given undirected weighted graph

**Solution:**

The weights on the edges of the graph are represented in the entries of the adjacency matrix as follows:

A = \(\begin{bmatrix} 0 & 3 & 0 & 0 & 0 & 12 & 0\\ 3 & 0 & 5 & 0 & 0 & 0 & 4\\ 0 & 5 & 0 & 6 & 0 & 0 & 3\\ 0 & 0 & 6 & 0 & 1 & 0 & 0\\ 0 & 0 & 0 & 1 & 0 & 10 & 7\\ 12 &0 & 0 & 0 & 10 & 0 & 2\\ 0 & 4 & 3 & 0 & 7 & 2 & 0 \end{bmatrix}\)