adjacency matrix
An adjacency matrix is a square grid used to represent a graph, where each row and column corresponds to a vertex. The entries in the matrix indicate whether pairs of vertices are connected by an edge. If there is an edge between two vertices, the corresponding entry is marked with a 1; if not, it is marked with a 0. This method is particularly useful for representing dense graphs.
In a directed graph, the adjacency matrix can show the direction of edges. For example, if there is an edge from vertex A to vertex B, the entry at row A and column B will be 1, while the entry at row B and column A will be 0. This representation allows for efficient algorithms to analyze graph properties.