src1
on the original graph to get the shortest paths to all nodes.src2
on the original graph to get the shortest paths to all nodes.dest
on the reversed graph to get the shortest paths from all nodes to dest
.i
, calculate the sum of distances from src1
to i
, from src2
to i
, and from i
to dest
.