diff --git a/contribution/branches/PhyloMOEA/PhyloMOEA/phylotreeIND.cpp b/contribution/branches/PhyloMOEA/PhyloMOEA/phylotreeIND.cpp index c66c90a54..ff13f093f 100644 --- a/contribution/branches/PhyloMOEA/PhyloMOEA/phylotreeIND.cpp +++ b/contribution/branches/PhyloMOEA/PhyloMOEA/phylotreeIND.cpp @@ -253,7 +253,7 @@ edge phylotreeIND::choose_edge_fromside( int idx, bool side ) const // select and edge from a side of a split // true = inside // false = outside -edge phylotreeIND::choose_edge_fromside_2( struct split_info &info, bool inside ) const +edge phylotreeIND::choose_edge_fromside_2( struct split_info *info, bool inside ) const { edge edgeaux; bool chosen = false; @@ -261,20 +261,21 @@ edge phylotreeIND::choose_edge_fromside_2( struct split_info &info, bool inside { edgeaux = select_edge(); struct split_info *info2 = interior_edge[edgeaux]; + if ( info == NULL ) return edgeaux; if( is_internal(edgeaux) ) { int taxon_map = splitstable[ taxon_id(edgeaux.target()) ].map_to_node; if( inside) - chosen = ( taxon_map >= info.left && taxon_map <= info.right ); + chosen = ( taxon_map >= info->left && taxon_map <= info->right ); else - chosen = ( taxon_map < info.left || taxon_map > info.right ); + chosen = ( taxon_map < info->left || taxon_map > info->right ); } else { if ( inside ) - chosen = ( info.left <= info2->left && info.right >= info2->right ); + chosen = ( info->left <= info2->left && info->right >= info2->right ); else - chosen = ( info.left > info2->right || info.right < info2->left ); + chosen = ( info->left > info2->right || info->right < info2->left ); } } @@ -371,6 +372,13 @@ void phylotreeIND::init() } +bool phylotreeIND::split2(edge edgeaux) +{ + if (is_internal(edgeaux)) return 0; + struct split_info *part_info = interior_edge[edgeaux]; + return (part_info->side == 0); +} + diff --git a/contribution/branches/PhyloMOEA/PhyloMOEA/phylotreeIND.h b/contribution/branches/PhyloMOEA/PhyloMOEA/phylotreeIND.h index 3f9c88aa8..738ff1436 100644 --- a/contribution/branches/PhyloMOEA/PhyloMOEA/phylotreeIND.h +++ b/contribution/branches/PhyloMOEA/PhyloMOEA/phylotreeIND.h @@ -111,7 +111,7 @@ class phylotreeIND void mutate_branch_lenght ( float ); edge select_edge_outsidetree ( edge source_edge ) const; edge choose_edge_fromside ( int id, bool side ) const; - edge choose_edge_fromside_2( struct split_info &info, bool inside ) const; + edge choose_edge_fromside_2( struct split_info *info, bool inside ) const; edge choose_neighboor ( edge, node ) const; @@ -204,6 +204,7 @@ class phylotreeIND inline bool splits_valid() const { return valid_splits; } inline bool split ( edge edgeaux, node nodeaux ) const { return split_bits[ edgeaux.id() * TREE.number_of_nodes() + nodeaux.id() ]; } + bool split2(edge edgeaux); void read_newick ( string newickstring ); void read_newick2 ( string newickstring );