/// <summary>
 /// Executes once at the start of the iteration and before the End() method
 /// Initializes the iterator variable ( realized in the subclasses ) and the
 /// m_currentItem to point to the first element of the item set. If the set is
 /// empty the m_currentItem points to null. After the Begin() method the
 /// End() method executes before going into the loop body. Thus the loop
 /// terminates if the item set is empty before ever running the loop body
 /// The transition logic for finding the first item in the items set is
 /// implemented in the subclasses
 /// </summary>
 /// <returns></returns>
 public override CGraphNode Begin()
 {
     m_it          = 0;
     m_iterations  = 0;
     m_currentItem = null;
     while (m_it < m_graph.M_NumberOfNodes &&                      // while not search all the nodes AND...
            m_graph.Node(m_it).M_NumberOfSuccessors != 0)          // while not discover nodes without successors
     {
         m_it++;
     }
     if (m_it < m_graph.M_NumberOfNodes)
     {
         m_currentItem = m_graph.Node(m_it);
         return(m_currentItem);
     }
     return(m_currentItem);
 }
        /// <summary>
        /// Points to the first valid item if to null if there is no one
        /// </summary>
        /// <returns></returns>
        public override CGraphNode Begin()
        {
            m_it         = 0;
            m_iterations = 0;
            m_lastItem   = false;
            if (m_graph.M_NumberOfNodes > 0)
            {
                m_currentItem = m_graph.Node(m_it);
                if (m_graph.M_NumberOfNodes == 1)
                {
                    m_lastItem = true;
                }
            }
            else
            {
                m_currentItem = null;
            }

            return(m_currentItem);
        }