I have a .shp with a road network that I want to represent in a Graph with NetworkX. I have used it for further analysis such as shortest distance etc. The problem is the function in Networkx converts shapefile to DiGraph only. The Digraphs are not suitable for representing multiple edges to same nodes

Is there any way to create a MultiDiGraph so I don't lose any edges, or a way around it?

1 Answer 1


You could "manually" write your import function, instead of using write_shp() like mentioned in this answer to Counting number of lines connected to point? at "Creation of a Graph".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.