private void relax(DirectedEdge e) { int v = e.From(), w = e.To(); if (this.DistTo[w] > this.DistTo[v] + e.Weight()) { this.DistTo[w] = this.DistTo[v] + e.Weight(); this._edgeTo[w] = e; } }
private void relax(DirectedEdge e) { int v = e.From(), w = e.To(); if (this.DistTo[w] > this.DistTo[v] + e.Weight()) { this.DistTo[w] = this.DistTo[v] + e.Weight(); this._edgeTo[w] = e; if (this._pq.Contains(w)) this._pq.DecreaseKey(w, this.DistTo[w]); else this._pq.Insert(w, this.DistTo[w]); } }
public void TestDirectedEdge() { DirectedEdge e = new DirectedEdge(12, 34, 5.67d); Debug.WriteLine(e); }