Graph Search: Adjacency Matrix
Date: 2013-11-25 |
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 / easiest way to support my work is by subscribing for future updates and sharing with your network.