Пример #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);
 }