I have a tree
NOT nodes (Min-Span-Tree of a graph), and what I'm going to do is calculate for each node VI, the number of nodes accessible from each of its edges (VI, Vj). So, after running the algorithm, each degree node
re will have
re the values each on a single edge indicate the number of accessible nodes using that specific edge.
Here is an example of a toy:
A simple algorithm to perform this task is to choose a random node, treat it as a root, and make it a hierarchical tree. Leave leaves and send the number of nodes accessible to parents. Thus, the leaves will transmit 1 to their parents and to each interlacing node that receive information from all their parents, add the numbers and 1 (for themselves), and transmit the number to their parents. Recursively, we will reach the root and we can then pass the information in the other direction (from parents to children). I thought that the name of this algorithm is the message passing. But I found many other concepts of message transmission, but this one appeared during my research on the Web.
So, what I'm looking for exactly is the name of the algorithm, the complexity and, if possible, a python package for that.
For the complexity, I think it must be the same as the number of edges
E, which is the number of
N-1 so this should be