title: NetworkX - How to create MultiDiGraph from Shapefile?
body: <p>I'm just picking up NetworkX and trying to learn how to use it with Shapefiles.</p>
  
  <p>Right now I have a .shp with a road network that I want to represent in a Graph with NetworkX, so that I can find the shortest path between 2 GPS points. I tried using <a href="https://networkx.github.io/documentation/latest/reference/readwrite.nx_shp.html" rel="nofollow noreferrer">this</a>, but the problem is that when I run the write_shp() function I lose edges because DiGraph does not allow more than one edge between the same two nodes. The arrow in the figure below shows an example of an edge I lose by using a DiGraph.</p>
  
  <p><img src="https://i.stack.imgur.com/BpmJt.png" alt="enter image description here"></p>
  
  <p>So I was wondering if there's any way to create a MultiDiGraph so I don't lose any edges, or if there's any way around it that I could use. I was thinking maybe I could write some code to extract the attributes from the Shapefile and create the MultiDiGraph without using NetworkX's read_shp(), but I don't have any experience at all working with graphs, so I'm not exactly sure if it'd be possible.</p>
  
  <p>I'd really appreciate any help or guidance you could give me, or if I've missed any documentation please let me know. Thanks in advance.</p>