Adjacency Matrix for Graphs
An adjacency matrix is a square matrix used to represent a finite graph. The elements of the matrix indicate whether pairs of vertices are adjacent or not in the graph. true indicates the presence of an edge, false represents the absence.
0 | 1 | 2 | 3 | 4 | |
---|---|---|---|---|---|
0 | false | true | false | false | true |
1 | true | false | true | true | true |
2 | false | true | false | true | false |
3 | false | true | true | false | true |
4 | true | true | false | true | false |
References
- boot.dev
Next -> adjacency-list-for-graphs
#matrix #computer_science #search #function #structure #boot_dev #hash #graph #adjacency #programming #data #memory