Graph compatible Dijkstra