code: void connectNodes() {
  		setupSearch();
  
  		int indexCornerList = 0;
  		for (int indexNode = 0; indexNode < nodes.size(); indexNode++) {
  			// search all the corners of this node for their neighbors
  			SquareNode n = nodes.get(indexNode);
  
  			for (int indexLocal = 0; indexLocal < n.square.size(); indexLocal++) {
  				if( n.touch.size > 0 && n.touch.get(indexLocal) )
  					continue;
  
  				// find it's neighbors
  				searchResults.reset();
  				search.findNearest(searchPoints.get(indexCornerList++), maxCornerDistance*maxCornerDistance, maxNeighbors + 1, searchResults);
  
  				for (int indexResults = 0; indexResults < searchResults.size(); indexResults++) {
  					NnData<Point2D_F64> neighborData = searchResults.get(indexResults);
  					SquareNode neighborNode = searchSquareList.get(neighborData.index);
  					Point2D_F64 closestCorner = neighborData.point;
  
  					// if the neighbor corner is from the same node skip it
  					if( neighborNode == n )
  						continue;
  
  					int neighborCornerIndex = getCornerIndex(neighborNode,closestCorner.x,closestCorner.y);
  
  					if( candidateIsMuchCloser(n, neighborNode, neighborData.distance))
  						graph.checkConnect(n, indexLocal, neighborNode, neighborCornerIndex, neighborData.distance);
  				}
  			}
  		}
  	}
docs: Goes through each node and uses a nearest-neighbor search to find the closest nodes in its local neighborhood.
  It then checks those to see if it should connect