How to convert an unbalanced tree into a (balanced) spanning tree? Suppose I have a tree (with different (not necessarily distinct) number of children at different nodes). I want to manipulate the tree in such a way that it becomes a k-ary spanning tree.
Various iterations on the tree are allowed. The restriction is that we cannot just collect all the nodes at one place and then make a spanning tree out of them (which would be a trivial way to do). Rather the spanning tree has to be created from the given tree. That is the children can exchange information (e.g. the number of child nodes it has and the ids of the child nodes) with the parent (and the grandparent, if required) and the parent makes decision to move the nodes between its children (in order to balance the tree).
You may have understood that I am trying to do this in a parallel computing environment. Where, all a node knows is the id of its parent, its children and the number of nodes in each subtree with its children as the root.
(Parent and children will change as we try to balance the tree). Any hint on how to approach this problem?
Reply to the comment that why is this problem important/ worth considering - after all the trivial apporach is scalable:
Theoretically it is challenging to develop an algorithm that uses lesser than O(N) space(used in the trivial approach) to build the spanning tree.
It is interesting to think about alternative solution approaches at scale.
As far as numbers are concerned: N=100,000 (which is common in today's supercomputers, N will be 1000,000 in the upcoming BG/Q). In the trivial approach steps invloved are a) all-reduce b) O(N) to construct the spanning tree and c) and finally a one-to-many broadcast.
An alternative distributed approach may not give much improvement but out of curosity it may be is worth trying.