Graph Search: Adjacency Matrix
Date: 2013-11-25 |
DISCLOSURE: If you buy through affiliate links, I may earn a small commission. (disclosures)
For each coordinate in the matrix, place a 1 if the nodes are connected and a 0 if they aren’t. In the case of a weighted graph, replace the one with the respective weight.
Adjacency Matrix
Node | 1 | 2 | 3 | 4 | 5 | 6 |
1 | 1 | 1 | 0 | 0 | 1 | 0 |
2 | 1 | 0 | 1 | 0 | 1 | 0 |
3 | 0 | 1 | 0 | 1 | 0 | 0 |
4 | 0 | 0 | 1 | 0 | 1 | 1 |
5 | 1 | 1 | 0 | 1 | 0 | 0 |
6 | 0 | 0 | 0 | 1 | 0 | 0 |
Want more like this?
The best way to support my work is to like / comment / share for the algorithm and subscribe for future updates.