This is the implementation accompanying my blog post on finding neighbor nodes in quadtrees (visit http://geidav.wordpress.com). The code only implements finding neighbors in the north direction. The other directions (west, east, south, north-west, north-east, south-west, south-east) can be easily derived, because they're symmetric.