private void Scan(IGraph g, int v) { _marked[v] = true; foreach (var e in g.Neighbours(v)) { var w = e.Target; if (_marked[w]) { continue; } if (e.Weight < _distTo[w]) { _distTo[w] = e.Weight; _edgeTo[w] = e; if (_pq.Contains(w)) { _pq.ChangeKey(w, _distTo[w]); } else { _pq.Insert(w, _distTo[w]); } } } }