From c0a7b53baf2a6e7bf9bc1fbec7ac05e43ac59154 Mon Sep 17 00:00:00 2001 From: Nicholas Noll Date: Wed, 8 Sep 2021 15:51:40 -0700 Subject: checkin --- sys/libbio/phylo.c | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) (limited to 'sys/libbio/phylo.c') diff --git a/sys/libbio/phylo.c b/sys/libbio/phylo.c index 1bb5bc7..920102b 100644 --- a/sys/libbio/phylo.c +++ b/sys/libbio/phylo.c @@ -107,7 +107,7 @@ phylo·postorder(bio·Node *clade, void *(*op)(bio·Node*, void*), void *ctx) { bio·Node *it; - for (it = clade->child; it != nil; it = it->sibling) { + for(it = clade->child; it != nil; it = it->sibling) { ctx = phylo·postorder(it, op, ctx); } @@ -120,13 +120,26 @@ phylo·preorder(bio·Node *clade, void *(*op)(bio·Node*, void*), void *ctx) bio·Node *it; ctx = op(clade, ctx); - for (it = clade->child; it != nil; it = it->sibling) { + for(it = clade->child; it != nil; it = it->sibling) { ctx = phylo·preorder(it, op, ctx); } return ctx; } +int +phylo·collectpostorder(bio·Node *clade, bio·Node **list) +{ + bio·Node *it; + int n; + + for(n = 0, it = clade->child; it != nil; it = it->sibling) { + n += phylo·collectpostorder(it, list+n); + } + + return n; +} + static inline void* @@ -412,18 +425,3 @@ phylo·reroot(bio·Tree *tree, bio·Node *node, double d) return 0; } #undef PREC - -// ----------------------------------------------------------------------- -// ancestral inference - -struct phylo·InferOpts -{ - int nstates; - double *Q; -}; - -error -phylo·inferancestral(bio·Tree *tree, struct phylo·InferOpts opts) -{ - return 0; -} -- cgit v1.2.1