44 std::vector<PhyloFactor>
const& factors,
48 max_factor = std::min( max_factor, factors.size() );
49 std::vector<size_t> result;
50 for(
size_t i = 0; i < max_factor; ++i ) {
51 result.push_back( factors[i].edge_index );
62 std::vector<PhyloFactor>
const& factors,
66 if( factor_index >= factors.size() ) {
67 throw std::invalid_argument(
"Invalid index for a phylo factor." );
69 auto const& factor = factors[ factor_index ];
76 auto set_color_ = [&](
size_t index,
utils::Color color ){
77 if( index >= edge_cols.size() ) {
78 throw std::runtime_error(
"Invalid edge index in a phylo factor." );
81 edge_cols[ index ] = color;
83 throw std::runtime_error(
84 "Edge at index " +
std::to_string( index ) +
" is in multiple edge sets of the "
91 set_color_( factor.edge_index, colors.
factor_edge );
92 for(
auto const e : factor.edge_indices_primary ) {
95 for(
auto const e : factor.edge_indices_secondary ) {
101 for(
auto const e : prev_factors ) {
114 std::vector<PhyloFactor>
const& factors,
119 if( num_factors > factors.size() ) {
120 throw std::invalid_argument(
"Invalid number of factors requested." );
122 if( num_factors == 0 ) {
123 num_factors = factors.size();
126 throw std::invalid_argument(
127 "Not enough clade colors provided for the requested number of factors."
135 auto set_color_ = [&](
size_t index,
utils::Color color ){
136 if( index >= edge_cols.size() ) {
137 throw std::runtime_error(
"Invalid edge index in a phylo factor." );
139 edge_cols[ index ] = color;
143 for(
size_t i = 0; i < num_factors; ++i ) {
144 assert( i < factors.size() );
147 auto const& factor = factors[i];
151 for(
auto const e : factor.edge_indices_secondary ) {
152 set_color_( e, clade_col );