Find the Closest Marked Node
Run Dijkstra from the start vertex and stop at the first marked vertex that settles; its distance is the closest marked cost.
Run Dijkstra from the start vertex and stop at the first marked vertex that settles; its distance is the closest marked cost.