Is saving the networkx.MultiDiGraph.edges method saved?

MyNetwork is an instance of networkx.MultiDiGraph. I am wondering if it is guaranteed that several starts of the following code will lead to the same list containing all edges (along with the edge attributes) in MyNetwork:

AllEdges = [(from_node,to_node,edge_key,edge_attributes) for (from_node,to_node,edge_key,edge_attributes) in MyNetwork.edges(keys=True,data=True)] 

Thanks for your kind reply.

+4
source share
1 answer

The list of edges returned from the MultiDiGraph.edges () method is not guaranteed in any order or when called again. You will need to do more processing (such as sorting) or save a separate list or edge symbol table if you need a specific order.

+4
source

Source: https://habr.com/ru/post/1487690/


All Articles