# HG changeset patch # User alpar # Date 1080309782 0 # Node ID fefccf1bdc23d9d2fc3b4563b1fd8078eb92071a # Parent dc95ca4ebc7bf38862aa81d764f6de5b02648294 Heap is now a template-template parameter diff -r dc95ca4ebc7b -r fefccf1bdc23 src/work/alpar/dijkstra/dijkstra.cc --- a/src/work/alpar/dijkstra/dijkstra.cc Fri Mar 26 13:59:59 2004 +0000 +++ b/src/work/alpar/dijkstra/dijkstra.cc Fri Mar 26 14:03:02 2004 +0000 @@ -29,10 +29,13 @@ //double pre_time=currTime(); tim.reset(); - Dijkstra , - FibHeap > - > dijkstra_test(G, cap); +// Dijkstra , +// FibHeap > +// > dijkstra_test(G, cap); + + Dijkstra , FibHeap > + dijkstra_test(G, cap); dijkstra_test.run(s); //double post_time=currTime(); @@ -44,10 +47,13 @@ //pre_time=currTime(); tim.reset(); - Dijkstra < SmartGraph, - SmartGraph::EdgeMap, - BinHeap > > - dijkstra_test2(G, cap); +// Dijkstra < SmartGraph, +// SmartGraph::EdgeMap, +// BinHeap > > +// dijkstra_test2(G, cap); + + Dijkstra , BinHeap > + dijkstra_test2(G, cap); dijkstra_test2.run(s); //post_time=currTime(); diff -r dc95ca4ebc7b -r fefccf1bdc23 src/work/alpar/dijkstra/dijkstra.h --- a/src/work/alpar/dijkstra/dijkstra.h Fri Mar 26 13:59:59 2004 +0000 +++ b/src/work/alpar/dijkstra/dijkstra.h Fri Mar 26 14:03:02 2004 +0000 @@ -68,9 +68,10 @@ #else template , - typename Heap=BinHeap > > + template class Heap = BinHeap > +// typename Heap=BinHeap > > #endif class Dijkstra{ public: @@ -104,7 +105,6 @@ Dijkstra(Graph& _G, LengthMap& _length) : G(_G), length(_length), predecessor(_G), pred_node(_G), distance(_G) { } - void run(Node s); ///The distance of a node from the source. @@ -173,7 +173,8 @@ ///shortest path to each node. The algorithm computes ///- The shortest path tree. ///- The distance of each node from the source. - template + template class Heap > void Dijkstra::run(Node s) { NodeIt u; @@ -191,7 +192,8 @@ // //typename Graph::NodeMap scanned(G,false); typename Graph::NodeMap heap_map(G,-1); - Heap heap(heap_map); + //Heap heap(heap_map); + Heap > heap(heap_map); heap.push(s,0); // reach.set(s, true); @@ -207,20 +209,20 @@ Node w=G.head(e); switch(heap.state(w)) { - case Heap::PRE_HEAP: + case heap.PRE_HEAP: // reach.set(w,true); heap.push(w,oldvalue+length[e]); predecessor.set(w,e); pred_node.set(w,v); break; - case Heap::IN_HEAP: + case heap.IN_HEAP: if ( oldvalue+length[e] < heap[w] ) { heap.decrease(w, oldvalue+length[e]); predecessor.set(w,e); pred_node.set(w,v); } break; - case Heap::POST_HEAP: + case heap.POST_HEAP: break; } }