stock dijkstra algo works