shortest path in weighted directed graph