user8110728
user8110728

Reputation:

Set operations with networkx

I am working with networkx and I need to do set operations. Particularly I want to do an intersection between to set of edges.

The operations I need involve EdgeView type and set type. The problem is that with the set type the couples within it are ordered, but the graph is undirected, there is no order.

How could I solve in a clean and efficient way?

Example of the issue; suppose an undirected graph G with an edge (0,1):

print((1,0) in G.edges)
print((1,0) in G.edges & {(0,1)})

The code above prints True followed by False. It would be reasonable that set operations keep that consistance - i.e. True twice.

Upvotes: 0

Views: 98

Answers (0)

Related Questions