I have been trying to count the number of loops using
count_multiple function for a particular vertex. But, I seem to get an error. The adjacency matrix is correct, so
n_loop for the edges
(0,0) should be 3. But, I get the answer to be 1. See the code below. Not sure what is going on.
Would appreciate comments. Thx, Sid
g = Graph([(0,1)],directed=True) g.add_edges([(0,0)]) g.add_edges([(0,0)]) g.add_edges([(0,0)]) n_loop=g.count_multiple((0,0)) print(g.get_adjacency()) print("n_loop =", n_loop)
[[3, 1] [0, 0]] n_loop = 1