14void TreeIterator::init()
16 vector<const Node*> nodes =
tree_.getNodes();
17 for (
size_t i = 0; i < nodes.size(); ++i)
83 if (lastVisitedBrotherPos == numOfBrothers - 1)
90 size_t nextSiblingPos = lastVisitedBrotherPos + 1;
116 vector<int> leafIds =
tree_.getLeavesId();
127 if (!hasVisitedSons && numOfSons > 0)
143 while (lastVisitedSonPos == numOfSons - 1)
171 size_t lastVisitedSon = 0;
182 else if (
nodeToSonVisited_[node->
getId()] && lastVisitedSon <
static_cast<size_t>(floor(numOfSons / 2) - 1))
184 return node->
getSon(lastVisitedSon + 1);
188 else if (numOfSons > 1 && lastVisitedSon ==
static_cast<size_t>(floor(numOfSons / 2) - 1) && !is_visited)
196 return node->
getSon(lastVisitedSon + 1);
211 vector<int> leafIds =
tree_.getLeavesId();
const Node * doStep(const Node *node)
The phylogenetic node class.
virtual int getId() const
Get the node's id.
virtual const Node * getFather() const
Get the father of this node is there is one.
virtual const Node * getSon(size_t pos) const
virtual bool isLeaf() const
virtual bool hasFather() const
Tell if this node has a father node.
virtual int getFatherId() const
virtual size_t getNumberOfSons() const
const Node * getLeftMostPredecessor(const Node *startNode)
TreeIterator & operator++()
const TreeTemplate< Node > & tree_
map< int, bool > nodeToVisited_
map< int, size_t > nodeToLastVisitedSonIndex_
virtual const Node * next()=0
map< int, bool > nodeToSonVisited_
Defines the basic types of data flow nodes.