Functions to query the next node/edge to be processed.
authoralpar
Tue, 30 Aug 2005 14:55:11 +0000
changeset 1665fdeb961110ac
parent 1664 72f1f24b73c9
child 1666 30d7e673781f
Functions to query the next node/edge to be processed.
lemon/bfs.h
lemon/dfs.h
lemon/dijkstra.h
     1.1 --- a/lemon/bfs.h	Tue Aug 30 13:48:40 2005 +0000
     1.2 +++ b/lemon/bfs.h	Tue Aug 30 14:55:11 2005 +0000
     1.3 @@ -543,6 +543,17 @@
     1.4        return n;
     1.5      }
     1.6        
     1.7 +    ///Next node to be processed.
     1.8 +
     1.9 +    ///Next node to be processed.
    1.10 +    ///
    1.11 +    ///\return The next node to be processed or INVALID if the queue is
    1.12 +    /// empty.
    1.13 +    Node NextNode()
    1.14 +    { 
    1.15 +      return _queue_tail<_queue_head?_queue[_queue_tail]:INVALID;
    1.16 +    }
    1.17 + 
    1.18      ///\brief Returns \c false if there are nodes
    1.19      ///to be processed in the queue
    1.20      ///
     2.1 --- a/lemon/dfs.h	Tue Aug 30 13:48:40 2005 +0000
     2.2 +++ b/lemon/dfs.h	Tue Aug 30 14:55:11 2005 +0000
     2.3 @@ -552,17 +552,30 @@
     2.4        }
     2.5        return e;
     2.6      }
     2.7 +    ///Next edge to be processed.
     2.8 +
     2.9 +    ///Next edge to be processed.
    2.10 +    ///
    2.11 +    ///\return The next edge to be processed or INVALID if the stack is
    2.12 +    /// empty.
    2.13 +    OutEdgeIt NextEdge()
    2.14 +    { 
    2.15 +      return _stack_head>=0?_stack[_stack_head]:INVALID;
    2.16 +    }
    2.17        
    2.18      ///\brief Returns \c false if there are nodes
    2.19      ///to be processed in the queue
    2.20      ///
    2.21      ///Returns \c false if there are nodes
    2.22      ///to be processed in the queue
    2.23 +    ///
    2.24 +    ///\todo This should be called emptyStack() or some "neutral" name.
    2.25      bool emptyQueue() { return _stack_head<0; }
    2.26      ///Returns the number of the nodes to be processed.
    2.27      
    2.28      ///Returns the number of the nodes to be processed in the queue.
    2.29      ///
    2.30 +    ///\todo This should be called stackSize() or some "neutral" name.
    2.31      int queueSize() { return _stack_head+1; }
    2.32      
    2.33      ///Executes the algorithm.
     3.1 --- a/lemon/dijkstra.h	Tue Aug 30 13:48:40 2005 +0000
     3.2 +++ b/lemon/dijkstra.h	Tue Aug 30 14:55:11 2005 +0000
     3.3 @@ -546,6 +546,17 @@
     3.4        return v;
     3.5      }
     3.6  
     3.7 +    ///Next node to be processed.
     3.8 +    
     3.9 +    ///Next node to be processed.
    3.10 +    ///
    3.11 +    ///\return The next node to be processed or INVALID if the priority heap
    3.12 +    /// is empty.
    3.13 +    Node NextNode()
    3.14 +    { 
    3.15 +      return _heap.empty()?_heap.top():INVALID;
    3.16 +    }
    3.17 + 
    3.18      ///\brief Returns \c false if there are nodes
    3.19      ///to be processed in the priority heap
    3.20      ///