title: How can I find the distance between 2 nodes given a list of edges (directed) of a graph?
body: <p>Suppose I have the edge set as a list containing the edges as follows:</p>
  
  <p><code>E=[(1, 6), (1, 7), (2, 3), (2, 6), (3, 2), (3, 8), (4, 5), (4, 7), (5, 4), (5, 9), (6, 1), (6, 7), (6, 2), (7, 1), (7, 6), (7, 4), (8, 9), (8, 3), (9, 8), (9, 5)]</code></p>
  
  <p>I will like to find the shortest path between nodes 8 and 4 (and also considering the case where there are 2 shortest paths of equal distance), given the distance matrix:</p>
  
  <p><code>C=[2.5, 5.59, 1.0, 2.0, 1.0, 2.0, 1.0, 2.0, 1.0, 2.0, 2.5, 5.0, 2.0, 5.59, 5.0, 2.0, 5.0, 2.0, 5.0, 2.0]</code></p>
  
  <p>where each element in <code>C</code> (say in the i-th position) corresponds to the distance between the 2 nodes of the corresponding edge in <code>E</code> (at the i-th position).</p>
  
  <p>I have chanced upon somewhat similar posts which encourages the use of Dijkstra's algorithm, but I have not found one that does it in Python 3.5x (maybe there is but I just cannot find it.. :/)</p>
  
  <p>Thus, to add on to my question above, besides finding the minimum distance between nodes 8 and 4, I will also like to generalize it to finding the minimum distance between any 2 nodes given the edge set and distance matrix.</p>