How to calculate the hight by number of nodes Imagine that I have something like following structure and I keep adding more to it, so the level 1 has only one node and level 2 has 2 and level n had n node, how can i calculate the n from the total number of tokens (size). 
for example if I want to add j, knowing that the size is 9, how can i mathematically deduce that It has to go to level 4? 
          a
       b    c 
     d    e   f 
   g    h   i


If you want to add the $n^{th}$, node, it has to go on the $\left\lceil\frac{-1+\sqrt{1+8n}}{2}\right\rceil^{th}$ floor.
Proof : The last element of the $n^{th}$ row is the $n^{th}$ triangular number, so $\frac{n(n+1)}{2}$.
Now let's consider the $k^{th}$ node. What should be $k$ to be the last element of the $n^{th}$ row ?
The answer is $k = \frac{n(n+1)}{2}$ as we have just seen. This leads to $n^2+n-2k=0$. The only positive solution is $n=\frac{-1+\sqrt{1+8k}}{2}$.
This only holds when $k$ is the last element of the row. But as we are on the same row as the smallest last element of a row, we just need to ceil the result to generalize the answer.
EDIT : It seems you want the result from the size of the graph. Just replace $n$ by $n+1$ in the formula above if that's the case.
