Implemented neighbour-pointer calculation with traversal