title: Shortest path in a street network
body: <p>I'm working with NYC taxi dataset. Street network are obtained using osmnx and red dots are taxi pickup GPS locations.</p>
  <p><a href="https://i.stack.imgur.com/gwCEw.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gwCEw.png" alt="enter image description here" /></a></p>
  <p>I did some map-matching. I projected the GPS locations to its nearest edge, and the projections are treated as nodes and added to the network (graph), its edges were updated accordingly. I get the following network. The yellow dots are the real nodes, and the purple dots are the projections of the GPS locations (also treated as nodes but differentiated by its attribute).</p>
  <p><a href="https://i.stack.imgur.com/3H8QU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3H8QU.png" alt="enter image description here" /></a></p>
  <p>Next I want to find the shortest path between two purple dots. For instance I get the following.</p>
  <p><a href="https://i.stack.imgur.com/Sn6qk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Sn6qk.png" alt="enter image description here" /></a></p>
  <p>The red line is obviously NOT the shortest path. It seems to me that the shortest_path function accounts for the direction of the edges (i.e. for an edge, it always goes from the starting point to the end point). Is there a way that I can get the true shortest path? In fact, I only want the shortest network distance between two points.</p>
  <p>I guess I could duplicate each edge with its starting and end points reversed. But maybe there's a cleaner way to do this?</p>