Beispiel #1
0
 // run Prim's algorithm in graph G, starting from vertex s
 private void prim(EdgeWeightedGraph G, int s)
 {
     distTo[s] = 0.0;
     pq.Insert(s, distTo[s]);
     while (!pq.IsEmpty)
     {
         throw new NotImplementedException();
         //int v = pq.DeleteMin();
         //scan(G, v);
     }
 }
        public override IndexPQBase <TKey> Clone()
        {
            var copy = new IndexMinPQ <TKey>(n + 1);

            for (int i = 1; i <= n; i++)
            {
                copy.Insert(pq[i], keys[pq[i]]);
            }
            return(copy);
        }