aboutsummaryrefslogtreecommitdiff
path: root/include/libbio.h
diff options
context:
space:
mode:
authorNicholas Noll <nbnoll@eml.cc>2020-04-28 11:59:59 -0700
committerNicholas Noll <nbnoll@eml.cc>2020-04-28 11:59:59 -0700
commit4eabf5d72c6b01bbf11180280ef9d28d5fe587bf (patch)
treec113ac3eb4244564c90d8e22fe2da8cc0407949e /include/libbio.h
parent8c8c6a9253ec2876f67217a8f10755b4ad7f3ec1 (diff)
feat: added number of nodes & leafs to tree data structure
Diffstat (limited to 'include/libbio.h')
-rw-r--r--include/libbio.h16
1 files changed, 11 insertions, 5 deletions
diff --git a/include/libbio.h b/include/libbio.h
index 0bda4d7..4b92587 100644
--- a/include/libbio.h
+++ b/include/libbio.h
@@ -12,21 +12,27 @@ typedef struct bio·Node
int nchild;
int ndescendent;
struct bio·Node *parent;
+ // NOTE: Sibiling allows for polytomies
struct bio·Node *child[2];
struct bio·Node *sibling;
} bio·Node;
-error phylo·addchild(bio·Node *parent, bio·Node* child);
-bool phylo·isleaf(bio·Node *node);
-
typedef struct bio·Tree
{
bio·Node *root;
+ int nleaf;
+ int nnode;
} bio·Tree;
+// clade functions
+error phylo·addchild(bio·Node* parent, bio·Node* child);
+
+error phylo·countnodes(bio·Node *node, int *n);
+error phylo·countleafs(bio·Node *node, int *n);
+
/* newick i/o */
-bio·Tree bio·readnewick(io·Peeker stream, void*, mem·Allocator heap, void*);
-error bio·writenewick(bio·Tree tree, io·Putter out, void*);
+error bio·readnewick(io·Peeker stream, void*, mem·Allocator heap, void*, bio·Tree* tree);
+error bio·writenewick(bio·Tree tree, io·Putter out, void*);
// -----------------------------------------------------------------------
// Sequences