LiveWire algorithm (with Dijkstra).