it takes the id of the node (cf schema) and gives the position in memory.
For instance the node 3 is after 0, 1 and 2 so f(3) = 1 + 2 + 1 = 4