doing dijkstra on full graph