An adjacency matrix is a square matrix that represents a finite graph. Each cell in the matrix represents the relationship between two vertices of the graph. If vertex i is adjacent to vertex j, the cell (i,j) and (j,i) will have a value of 1, otherwise, the value will be 0.

This type of matrix is commonly used in graph theory and can be useful to determine the properties of a graph, such as its connectivity, whether it contains cycles or not, or whether it is weighted or unweighted. Furthermore, the adjacency matrix allows us to perform operations on graphs, such as matrix multiplication, which can help us to find the shortest path between two vertices or to perform transformations on the graph.

**Uses of Adjacency Matrix**

In this way, the use of the adjacency matrix is widespread in computer science and mathematics. It is important to note that the adjacency matrix can become unwieldy for large graphs as it grows quadratically with the number of vertices. Additionally, if the graph is sparse, meaning that there are relatively few edges compared to the number of vertices, the adjacency matrix can be unnecessarily large and inefficient. In this case, an alternative representation such as the adjacency list may be more appropriate.

**Matrix**

A matrix is a rectangular array of numbers. The numbers in each row are called the elements of the row, and the numbers in each column are called the elements of the column. The element at the intersection of row i and column j is called the entry or cell (i,j). The adjacency matrix, also known as a connection matrix, represents a graph as a matrix of 0’s and 1’s.

**Adjacency Matrix For a Graph**

The Adjacency Matrix for a graph is a square matrix that has as many rows as there are vertices in the graph and as many columns as there are edges in the graph. The entry (i,j) in the Adjacency Matrix contains the weight of the edge between vertex i and vertex j. A matrix with elements, x ij , is used to indicate the connections in a directed graph. If node i relates to node j, x ij = 1, otherwise x ij = 0. For a simple graph with no self-loops, the adjacency matrix must have zeros on the diagonal.

An adjacency matrix is a type of graph in which each node is connected to its nearest neighbours. The adjacency matrix for a graph is a two-dimensional matrix, where the elements in each row represent the edges between the vertices in that row, and the elements in each column represent the edges between the vertices in that column. A 5000-word adjacency matrix would have 5000 rows and 5000 columns, with one entry for each possible pair of words. The entry in the matrix would be 1 if the two words occurred within 5000 words of each other, or 0 if they did not. The adjacency matrix of a graph is known to be symmetric, that is, if there is an edge from vertex i to vertex j, then there is also an edge from vertex j to vertex i.