[galib] Tree genome and traversal.

Laurent Steffan galib at laurentsteffan.com
Tue Jul 4 10:08:02 EDT 2006


Hello Dan,

As I told you, I kept looking... :-)

In its present state, I believe, your program keeps visiting the same
node (presumably the root node) ad infinitum (well, as close to forever
as can be achieved with finite memory resources...). Your running out of
memory might explain the segfaults. I have underlined a possible correction.

> string visitPost(GATreeGenome<Node> &t){
> 	stringstream ret;
	if(t.child()) ret << visitPost(t.child()) << " ";
	                                 ^^^^^^^
 	if(t.next()) ret << visitPost(t.next()) << " ";
	                                ^^^^^^
> 
> 	ret << *t.current() << " ";
> 	return ret.str();
> }

Do tell me whether this goes in the right direction.

Best regards,
Laurent
-- 
Laurent Steffan, Dr.-Ing.
Chercheur associé au LAMSADE (Université Paris Dauphine)
Consultant scientifique
+33 (0) 6 85 92 08 51





More information about the galib mailing list