Made disjkstra only calculate paths for active dimension.