예제 #1
0
void cluster_collect_summaries_recursive(struct cluster *c, struct list *accum)
{
	if( !c->right && !c->left)
		list_push_head(accum, c->centroid);

	if( c->left )
		cluster_collect_summaries_recursive(c->left, accum);

	if( c->right )
		cluster_collect_summaries_recursive(c->right, accum);
}
예제 #2
0
파일: cluster.c 프로젝트: LyonsLab/cctools
struct list *cluster_collect_summaries(struct cluster *c)
{
	struct list *summaries = list_create(0);

	cluster_collect_summaries_recursive(c, summaries);

	summaries = list_sort(summaries, summary_cmp_rule);

	return summaries;
}