[galib] GATreeGenome Node Traversing

Cem DEMiRKIR cdemirkir at gmail.com
Sun Jul 8 05:36:23 EDT 2007

Hello everyone,
    I'd like to know How I can traverse through the nodes of GATreeGenome.
As far as I understood it is not possible break the loop if we use the
next() member function to jump to the next child node since the youngest
child node always linked to the eldest child node or itself in the case of
single child node. if we use the following traversing function 
string visitPost(GATreeGenome<NodeType> &t)
     stringstream ret
     if(t.child()) ret << visitPost(t.child()) << " ";
     if(t.next()) ret << visitPost(t.next()) << " ";
     cout << *t.current() << " ";
     return ret.str();
How can the recursive loop be broken though the t.next() function which
doesn't return a NULL pointer in any case ? Also I'd like to know How I can
access the node pointers of the Tree structure not the contents of the nodes
    Cem DEMiRKIR 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.mit.edu/pipermail/galib/attachments/20070708/ae606487/attachment.htm

More information about the galib mailing list