I have many subtrees saved in a file and I want to search them to find many things for each one of these subtrees like : the number of nodes, the number of leafs and the number of levels a subtree consist of...
To be more precise, the difference between a node and a leaf in my work; a node is any vertex in a subtree that could be a parent or a child where as a leaf is only a child vertex i.e every leaf is a node and the opposite is not true.
I am facing many problems in this work, the first one: the file containing the subtrees is not showing the rooted node and is not differentiating between parents and children..
The second problem: I read that for searching a tree programmers usually use a recursive method so I tried to search through the INTERNET for references or algorithms or pseudo-codes but all what I found is dealing with binary tree which is not my case (I am dealing with all configurations of a subtree) !!!
So could anyone kindly help me by giving a reference, an algorithm or an example for searching a tree to find the previous characteristics for such a subtree??
Another question: Is it possible to do this work using R ??
I will use any program to write the code but mainly I am interested in C.
Again,, please my subtree is not a binary one
UPDATE: Each subtree is represented in my file as a set of edges, You can see below an example of a subtree of size 4:
44180 0
44180 18238
44180 13362
69677 44180
UPDATE: Sorry for the new update but Can I use R in my case even if there is a huge number of subtrees like 100000 subtrees each one with 20 edges (100000*20) ??