Learn Before
Concept
Adjacency Matrix
An adjacency matrix helps show which particular vertices of a graph are adjacent to another vertex. It is a 2D array that has a height and width of size V where V is number of vertices in the graph. It is thus a V x V binary matrix ( a matrix where each cell can only have one of two values like 1 or 0). To show that there is an edge from vertex a to b, the space M[a][b] for matrix M would have a value of 1. If the graph being represented is weighted, the space M[a][b] would still have a value of 1 to show the relation between vertex a and b. However, the matrix could be modified to instead have the space M[a][b] show the weight value.
0
1
Updated 2021-05-25
Tags
Python Programming Language
Data Science