예제 #1
0
 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;
     }
 }
예제 #2
0
        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]);
            }
        }
예제 #3
0
 public void TestDirectedEdge()
 {
     DirectedEdge e = new DirectedEdge(12, 34, 5.67d);
     Debug.WriteLine(e);
 }