23 int leaf_count = names.
size();
25 for (
int i=0; i< leaf_count; i++) {
47 specSpace(specSpace_),
60 const PART *DeconstructedTree::part_with_origin(
const TreeNode *
node)
const {
63 for (
size_t i = 0; i<parts; ++i) {
72 const PART *found = part_with_origin(node);
80 int best_dist = INT_MAX;
84 for (
size_t p = 0; p<parts; ++p) {
114 return "tree contains duplicated species";
118 if (provideProgress) {
123 bool contains_all_species = wholeTree->
equals(allSpecies);
126 if (contains_all_species || handle_partial_as_full) {
127 deconstruct_full_rootnode(tree, weight, insertProgress);
130 deconstruct_partial_rootnode(tree, weight, wholeTree, insertProgress);
134 if (provideProgress) {
137 delete insertProgress;
138 insertProgress =
NULp;
169 #if defined(DUMP_PART_INSERTION)
170 PART::start_pretty_printing(
get_names());
174 while (p && !progress.
aborted()) {
176 progress.
inc_by(++inserted);
180 #if defined(DUMP_PART_INSERTION)
181 PART::stop_pretty_printing();
185 SizeAwareTree *result_tree =
NULp;
193 #if defined(NTREE_DEBUG_FUNCTIONS)
197 result_tree = rb_gettree(n);
199 progress.
inc_by(++inserted);
201 result_tree->get_tree_root()->find_innermost_edge().set_root();
204 progress.
inc_by(++inserted);
225 size_t maxnamelen = 0;
232 remark.
nprintf(maxnamelen,
"%-*s",
int(maxnamelen), tree.
name());
const PART * peek_part(int idx) const
size_t GBT_count_leafs(const TreeNode *tree)
SizeAwareTree * get_consensus_tree(GB_ERROR &error)
long GBS_write_hash(GB_HASH *hs, const char *key, long val)
const char * name() const
const NT_NODE * ntree_get()
ConsensusTree(const CharPtrArray &names_)
char * get_tree_remark() const
size_t get_species_count() const
int ntree_count_sons(const NT_NODE *tree)
const PART * find_innermost_part() const
size_t species_count() const
size_t get_tree_count() const
void GBS_free_hash(GB_HASH *hs)
void cat(const char *from)
void start_sorted_retrieval()
CONSTEXPR_INLINE long triangular_number(const long N)
DeconstructedTree(const SpeciesSpace &specSpace_)
GB_ERROR error_if_aborted()
CONSTEXPR_INLINE int leafs_2_nodes(int leafs, TreeModel model)
const PART * peek_part(int idx) const
static int weight[maxsites+1]
const TreeInfo & get_tree_info(int idx) const
__ATTR__USERESULT GB_ERROR insert_tree_weighted(const TreeNode *tree, int leafs, double weight, bool provideProgress)
bool is_son_of_root() const
void ntree_init(const PartitionSize *registry)
SpeciesSpace(const CharPtrArray &names_)
const PART * find_part(const TreeNode *node) const
void build_sorted_list(double overall_weight)
static void error(const char *msg)
const CharPtrArray & get_names() const
PART * create_root() const
__ATTR__USERESULT GB_ERROR deconstruct_weighted(const TreeNode *tree, const PART *wholeTree, int leafs, double weight, bool provideProgress, const PART *allSpecies, DeconstructionMode mode)
const PART * get_allSpecies() const
size_t get_part_count() const
bool equals(const PART *other) const
char * GBS_log_action_to(const char *comment, const char *action, bool stamp)
void nprintf(size_t maxlen, const char *templat,...) __ATTR__FORMAT_MEMBER(2)
const TreeNode * get_origin() const
void insert_ntree(PART *&part)
int distance_to_tree_center() const
PART * create_tree_PART(const TreeNode *tree, const double &weight) const
const PartitionSize * get_PartitionSize() const
char * GBS_global_string_copy(const char *templat,...)
GB_HASH * GBS_create_hash(long estimated_elements, GB_CASE case_sens)