(I was not really sure in which "stackexchange" I should put this question. I hope CS is ok.)
Let's say I have the following tree A. Every node has a unique ID, which will be counted up, beginning from 0. The ID counting is taking place in breadth-first order.
Now I want to pick out a part of the graph A. The information of the subtree is given by a node ID in the original tree A.
Example
Let's say the new tree starts with the node ID 3 of the original tree. For this example, the tree depth has an offset of 1 (because 3 is in depth 1 of the original node). The result is the following
You might have noticed that the new tree have the same structure than the old tree. The unique ID of each node in the new tree, will also be counted up in breadth-first order. In the brackets, you can see the link to the original node tree A.
Background
The reason, why I need this node link is the fact that I need to copy some node properties from the original tree node to the new tree node.
Question
What is the mathematical relation between the unique node IDs of the new tree and the node IDs of the original tree? I want to compute the ID's of the old tree, based on the ID's of the new tree.
Thanks for any help.