Adjacency Matrix

The adjacency matrix is used in discrete mathematics to represent the number of ways in which we can walk from one vertex to another within a graph. Any graph can be shown in an adjacency matrix where both the rows and columns are labeled with our graph vertices. We denote each entry as \(\left(i,j\right)\) which counts the number of adjacent edges between the \(i^{th}\) row and \(j^{th}\) column. We also say that \(a_{i,j}\) represents the number in row \(i\), column \(j.\) The adjacency matrix is made up of graph vertices that are either a \(0\) or \(1.\) To decide which entry to write in the matrix, we use a \(0\) if vertex \(i\) is not adjacent to vertex \(j\) and we use a \(1\) if vertex \(i\) is adjacent to vertex \(j.\)
For example, 
Notice, that both vertices \(1\) and \(3\) are each adjacent to vertices \(2\) and \(4.\) Vertices \(2\) and \(4\) are each adjacent to vertices \(1\) and \(3.\) With that being said, we can write out our adjacency matrix as follows: 
Notice that our adjacency matrix is symmetric with \(0\)'s on the diagonal. All adjacency matrices will be adjacent if the given graph in undirected.