Let
- $D(V, A)$ be a $k$-partite DAG;
- $P = \{ p_k : 1 \leqslant k \leqslant |P| \}$ such that $p_k \cap p_l = \emptyset$, $\forall k,l : k \neq l$, and $\bigcup_{1 \leqslant k \leqslant |P|} p_k = V$ be the set of partitions;
- $A = \{ (i, j) : \forall_{1 \leqslant k \leqslant |P| - 1} (i \in p_k \wedge j \in p_{k + 1}) \}$ be the set of arcs; And
- $d_{ij}$ be the distance of arc $(i, j) \in A$.
For instance, consider the following DAG example.
We aim to calculate the shortest paths length $l_{ij}$, $\forall i, j \in V$. For this purpose, straightforwardly, we could take the Floyd & Warshall algorithm, consuming $\mathcal{O}(|V|^3)$. But, I am looking for better ways of doing this, since the general Floyd & Warshall simply does not consider the specificities of the input graph.
Thanks and regards.