Interpreting your question that you want to find the shortest paths in order of increasing length, then a nested Dijkstra algorithm may solve your problem also in case of directed graphs. I assume you are familiar with the Dijkstra algorithm, so I shorten the explanation to the essential: - create the $n\times n$ distance table and set its diagonal elements to $0$ and the off-diagonal elements to $+\infty$ - create for every vertex $v_i$ a priority queue $q_i$ just as in the ordinary Dijksta algorithm and push $v_i$ into $q_i$ - create a second "meta" priority queue $Q$ and push all $q_i$ into it; $Q$ is ordered according to the length of the shortest path from $v_i$ to $q_i$'s top element. - while $Q$ isn't empty, **perform a "Dijkstra step"** (i.e. popping of the top element and possibly relaxing the shortest path length from its root to the popped element) **for $Q$'s top element**, if that is w.l.o.g $q_i$, then $q_i$'s top element (w.l.o.g. $v_j$) is popped and possibly the length of the shortest path from $v_i$ to that element is relaxed (i.e. distance $d_{ij}$ is updated). If $q_i$ isn't empty, reinsert it into $Q$