By adding one more statement in this recipe's code, the same program can be used for creating the adjacency matrix representation of an undirected graph as well.Â
Creating an adjacency matrix representation of an undirected graph
How to do it...
We refer to the same graph that was in the previous recipe; however, this time, there are no edges:
Figure 10.5
Its adjacency matrix representation is as follows:
5,5 1 2 3 4 5
----------------------------------------------------------------------------
1 0 1 1 0 1
2 1 0 0 1 1
3 1...