Faster implementation
authordeba
Fri, 28 Oct 2005 09:01:59 +0000
changeset 1747bccf2379b5dd
parent 1746 874e4bc21435
child 1748 0a75c3e6a91a
Faster implementation
lemon/johnson.h
     1.1 --- a/lemon/johnson.h	Fri Oct 28 08:40:42 2005 +0000
     1.2 +++ b/lemon/johnson.h	Fri Oct 28 09:01:59 2005 +0000
     1.3 @@ -494,14 +494,16 @@
     1.4  
     1.5      void shiftedRun(const BelmannFordType& belmannford) {
     1.6        
     1.7 -      typedef PotentialDifferenceMap<Graph, 
     1.8 -      typename BelmannFordType::DistMap> PotDiffMap;
     1.9 -      PotDiffMap potdiff(*graph, belmannford.distMap());
    1.10 -      typedef SubMap<LengthMap, PotDiffMap> ShiftLengthMap;
    1.11 -      ShiftLengthMap shiftlen(*length, potdiff);
    1.12 -
    1.13 -      typename Dijkstra<Graph, ShiftLengthMap>::
    1.14 -      template DefHeap<Heap, HeapCrossRef>::Create dijkstra(*graph, shiftlen);
    1.15 +      typename Graph::template EdgeMap<Value> shiftlen(*graph);
    1.16 +      for (EdgeIt it(*graph);  it != INVALID; ++it) {
    1.17 +      	shiftlen[it] = (*length)[it] 
    1.18 +	  + belmannford.dist(graph->source(it)) 
    1.19 +	  - belmannford.dist(graph->target(it));
    1.20 +      }
    1.21 +      
    1.22 +      typename Dijkstra<Graph, typename Graph::template EdgeMap<Value> >::
    1.23 +	template DefHeap<Heap, HeapCrossRef>::
    1.24 +	Create dijkstra(*graph, shiftlen);
    1.25  
    1.26        dijkstra.heap(*_heap, *_heap_cross_ref);
    1.27