COIN-OR::LEMON - Graph Library

Changeset 1155:fe0fcdb5687b in lemon-0.x


Ignore:
Timestamp:
02/18/05 15:46:04 (15 years ago)
Author:
Alpar Juttner
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1556
Message:
  • Better addSource()
  • More docs
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/lemon/dijkstra.h

    r1151 r1155  
    484484    ///Adds a new source node.
    485485
    486     ///Adds a new source node the the priority heap.
    487     ///It checks if the node has already been added to the heap.
     486    ///Adds a new source node to the priority heap.
    488487    ///
    489488    ///The optional second parameter is the initial distance of the node.
    490489    ///
    491     ///\todo Do we really want to check it?
     490    ///It checks if the node has already been added to the heap and
     491    ///It is pushed to the heap only if either it was not in the heap
     492    ///or the shortest path found till then is longer then \c dst.
    492493    void addSource(Node s,Value dst=0)
    493494    {
    494495      source = s;
    495496      if(_heap.state(s) != Heap::IN_HEAP) _heap.push(s,dst);
    496     }
    497    
     497      else if(_heap[s]<dst) {
     498        _heap.push(s,dst);
     499        _pred->set(s,INVALID);
     500      }
     501    }
     502   
     503    ///Processes the next node in the priority heap
     504
     505    ///Processes the next node in the priority heap.
     506    ///
     507    ///\warning The priority heap must not be empty!
    498508    void processNextNode()
    499509    {
     
    524534    }
    525535
     536    ///Returns \c false if there are nodes to be processed in the priority heap
     537
     538    ///Returns \c false if there are nodes to be processed in the priority heap
     539    ///
     540    bool emptyHeap() { return heap.empty(); }
     541    ///Returns the number of the nodes to be processed in the priority heap
     542
     543    ///Returns the number of the nodes to be processed in the priority heap
     544    ///
     545    int heapSize() { return heap.size(); }
     546   
    526547    ///Executes the algorithm.
    527548
Note: See TracChangeset for help on using the changeset viewer.