I have a file which contains the edges for the matrix. For example, location (1, 2) in the adjacency matrix generated from the file is 2, as the pair 1 2 occurs twice in the graph.
I need to make a adjacency matrix from this using python and I am unsure how to do it.
the file is:
0 1
1 2 1 2 1 3 1 3 1 4
2 3
3 0
4 0 4 2
the output should be:
[[0. 1. 0. 0. 0.]
[0. 0. 2. 2. 1.]
[0. 0. 0. 1. 0.]
[1. 0. 0. 0. 0.]
[1. 0. 1. 0. 0.]]
thank you!!