Graph tool I got 2 same edges

22 views Asked by At

I am trying to construct, undirected graph using graph_tool. And I got this problem,

import graph_tool.all as gt
graph = gt.Graph(directed=False)
graph.add_edge(17)
eweight = graph.new_ep("double")
edge_list = [(0, 1), (2, 7), (2, 12), (3, 8), (3, 13), (4, 9), (4, 14), (5, 10), (5, 15), (6, 11), (6, 16), (7, 12), (8, 13), (9, 14), (10, 15), (11, 16)]```

I am expecting to get the result as adgency matrix:

```  (1, 0) 1.0
  (2, 7)    1.0
  (2, 12)   1.0
  (3, 8)    1.0
  (3, 13)   1.0
     ...
     ...
  (16, 6)   1.0
  (16, 11)  1.0

but I got this result.

  (0, 1)    1.0
  (1, 0)    1.0
  (2, 7)    1.0
      ...
      ...
      ...

with 2 edge between node 1 and 0

I tried to use remove_parallel_edges to solve this problem but the result was the same.I want to know is someone knows the solution?

0

There are 0 answers