1.1 --- a/src/work/alpar/dijkstra/dijkstra.cc Fri Mar 26 13:59:59 2004 +0000
1.2 +++ b/src/work/alpar/dijkstra/dijkstra.cc Fri Mar 26 14:03:02 2004 +0000
1.3 @@ -29,10 +29,13 @@
1.4
1.5 //double pre_time=currTime();
1.6 tim.reset();
1.7 - Dijkstra <SmartGraph,
1.8 - SmartGraph::EdgeMap<int>,
1.9 - FibHeap<SmartGraph::Node, int, SmartGraph::NodeMap<int> >
1.10 - > dijkstra_test(G, cap);
1.11 +// Dijkstra <SmartGraph,
1.12 +// SmartGraph::EdgeMap<int>,
1.13 +// FibHeap<SmartGraph::Node, int, SmartGraph::NodeMap<int> >
1.14 +// > dijkstra_test(G, cap);
1.15 +
1.16 + Dijkstra <SmartGraph, SmartGraph::EdgeMap<int>, FibHeap >
1.17 + dijkstra_test(G, cap);
1.18
1.19 dijkstra_test.run(s);
1.20 //double post_time=currTime();
1.21 @@ -44,10 +47,13 @@
1.22
1.23 //pre_time=currTime();
1.24 tim.reset();
1.25 - Dijkstra < SmartGraph,
1.26 - SmartGraph::EdgeMap<int>,
1.27 - BinHeap<SmartGraph::Node, int, SmartGraph::NodeMap<int> > >
1.28 - dijkstra_test2(G, cap);
1.29 +// Dijkstra < SmartGraph,
1.30 +// SmartGraph::EdgeMap<int>,
1.31 +// BinHeap<SmartGraph::Node, int, SmartGraph::NodeMap<int> > >
1.32 +// dijkstra_test2(G, cap);
1.33 +
1.34 + Dijkstra <SmartGraph, SmartGraph::EdgeMap<int>, BinHeap >
1.35 + dijkstra_test2(G, cap);
1.36
1.37 dijkstra_test2.run(s);
1.38 //post_time=currTime();
2.1 --- a/src/work/alpar/dijkstra/dijkstra.h Fri Mar 26 13:59:59 2004 +0000
2.2 +++ b/src/work/alpar/dijkstra/dijkstra.h Fri Mar 26 14:03:02 2004 +0000
2.3 @@ -68,9 +68,10 @@
2.4 #else
2.5 template <typename Graph,
2.6 typename LengthMap=typename Graph::EdgeMap<int>,
2.7 - typename Heap=BinHeap <typename Graph::Node,
2.8 - typename LengthMap::ValueType,
2.9 - typename Graph::NodeMap<int> > >
2.10 + template <class,class,class> class Heap = BinHeap >
2.11 +// typename Heap=BinHeap <typename Graph::Node,
2.12 +// typename LengthMap::ValueType,
2.13 +// typename Graph::NodeMap<int> > >
2.14 #endif
2.15 class Dijkstra{
2.16 public:
2.17 @@ -104,7 +105,6 @@
2.18 Dijkstra(Graph& _G, LengthMap& _length) :
2.19 G(_G), length(_length), predecessor(_G), pred_node(_G), distance(_G) { }
2.20
2.21 -
2.22 void run(Node s);
2.23
2.24 ///The distance of a node from the source.
2.25 @@ -173,7 +173,8 @@
2.26 ///shortest path to each node. The algorithm computes
2.27 ///- The shortest path tree.
2.28 ///- The distance of each node from the source.
2.29 - template <typename Graph, typename LengthMap, typename Heap >
2.30 + template <typename Graph, typename LengthMap,
2.31 + template<class,class,class> class Heap >
2.32 void Dijkstra<Graph,LengthMap,Heap>::run(Node s) {
2.33
2.34 NodeIt u;
2.35 @@ -191,7 +192,8 @@
2.36 // //typename Graph::NodeMap<int> scanned(G,false);
2.37 typename Graph::NodeMap<int> heap_map(G,-1);
2.38
2.39 - Heap heap(heap_map);
2.40 + //Heap heap(heap_map);
2.41 + Heap<Node,ValueType,typename Graph::NodeMap<int> > heap(heap_map);
2.42
2.43 heap.push(s,0);
2.44 // reach.set(s, true);
2.45 @@ -207,20 +209,20 @@
2.46 Node w=G.head(e);
2.47
2.48 switch(heap.state(w)) {
2.49 - case Heap::PRE_HEAP:
2.50 + case heap.PRE_HEAP:
2.51 // reach.set(w,true);
2.52 heap.push(w,oldvalue+length[e]);
2.53 predecessor.set(w,e);
2.54 pred_node.set(w,v);
2.55 break;
2.56 - case Heap::IN_HEAP:
2.57 + case heap.IN_HEAP:
2.58 if ( oldvalue+length[e] < heap[w] ) {
2.59 heap.decrease(w, oldvalue+length[e]);
2.60 predecessor.set(w,e);
2.61 pred_node.set(w,v);
2.62 }
2.63 break;
2.64 - case Heap::POST_HEAP:
2.65 + case heap.POST_HEAP:
2.66 break;
2.67 }
2.68 }