Modified getNeighbours API method to recursively iterate through children.