src/work/jacint/dijkstra.h
changeset 246 dc95ca4ebc7b
parent 217 fc549fac0dd0
child 372 e6a156fc186d
equal deleted inserted replaced
6:a6f7b8c47335 7:5ac8b86e3a30
    78       reach.set(s, true);
    78       reach.set(s, true);
    79 
    79 
    80       while ( !heap.empty() ) {
    80       while ( !heap.empty() ) {
    81 	
    81 	
    82 	Node v=heap.top(); 
    82 	Node v=heap.top(); 
    83 	T oldvalue=heap[v];
    83 	T oldvalue=heap.get(v);
    84 	heap.pop();
    84 	heap.pop();
    85 	distance.set(v, oldvalue);
    85 	distance.set(v, oldvalue);
    86 	scanned.set(v,true);
    86 	scanned.set(v,true);
    87 
    87 
    88 	OutEdgeIt e;
    88 	OutEdgeIt e;
    92 	  if ( !scanned[w] ) {
    92 	  if ( !scanned[w] ) {
    93 	    if ( !reach[w] ) {
    93 	    if ( !reach[w] ) {
    94 	      reach.set(w,true);
    94 	      reach.set(w,true);
    95 	      heap.push(w,oldvalue+length[e]); 
    95 	      heap.push(w,oldvalue+length[e]); 
    96 	      predecessor.set(w,e);
    96 	      predecessor.set(w,e);
    97 	    } else if ( oldvalue+length[e] < heap[w] ) {
    97 	    } else if ( oldvalue+length[e] < heap.get(w) ) {
    98 	      predecessor.set(w,e);
    98 	      predecessor.set(w,e);
    99 	      heap.decrease(w, oldvalue+length[e]); 
    99 	      heap.decrease(w, oldvalue+length[e]); 
   100 	    }
   100 	    }
   101 	  }
   101 	  }
   102 	}
   102 	}