title: Floyd-Warshall algorithm: get the shortest paths
body: <p>Assume a graph is represented by a <code>n x n</code> dimension adjacency matrix. I know the how to get the shortest path matrix for all pairs. But I wonder is there a way to trace all the shortest paths?
  Blow is the python code implementation.</p>
  
  <pre><code>v = len(graph)
  for k in range(0,v):
      for i in range(0,v):
          for j in range(0,v):
              if graph[i,j] &gt; graph[i,k] + graph[k,j]:
                  graph[i,j] = graph[i,k] + graph[k,j]
  </code></pre>