boolean addNextRow( SquareNode seed , List<List<SquareNode>> grid ) {
		List<SquareNode> row = new ArrayList<>();
		List<SquareNode> tmp = new ArrayList<>();

		int numConnections = numberOfOpenEdges(seed);
		if( numConnections == 0 ) {
			return false;
		} else if( numConnections == 1 ) {
			for (int i = 0; i < seed.square.size(); i++) {
				SquareEdge edge = seed.edges[i];
				if( edge != null ) {
					// see if the edge is one of the open ones
					SquareNode dst = edge.destination(seed);
					if( dst.graph != SquareNode.RESET_GRAPH)
						continue;

					// determine which direction to traverse along
					int corner = edge.destinationSide(seed);
					int l = addOffset(corner,-1,dst.square.size());
					int u = addOffset(corner, 1,dst.square.size());

					// Nodes in the seed's row should all be marked, so any unmarked nodes
					// are ones you don't want to traverse down
					if( isClosedValidEdge(dst,l) ) {
						if( !addToRow(seed,i, 1,false,tmp) ) return false;
						flipAdd(tmp, row);
					} else if( isClosedValidEdge(dst,u) ){
						if( !addToRow(seed,i, -1,false,row) ) return false;
					} else {
						dst.graph = 0;
						row.add(dst);
					}
					break;
				}
			}
		} else if( numConnections == 2 ) {
			int indexLower = lowerEdgeIndex(seed);
			int indexUpper = addOffset(indexLower,1,seed.square.size());

			if( !addToRow(seed,indexUpper, 1,false,tmp) ) return false;
			flipAdd(tmp, row);
			if( !addToRow(seed,indexLower,-1,false,row) ) return false;
		} else {
			return false;
		}
		grid.add(row);
		return true;
	}
boolean addNextRow ( SquareNode seed , List < List < SquareNode > > grid ) { List < SquareNode > row = new ArrayList < > ( ) ; List < SquareNode > tmp = new ArrayList < > ( ) ; int numConnections = numberOfOpenEdges ( seed ) ; if ( numConnections == 0 ) { return false ; } else if ( numConnections == 1 ) { for ( int i = 0 ; i < seed . square . size ( ) ; i ++ ) { SquareEdge edge = seed . edges [ i ] ; if ( edge != null ) { SquareNode dst = edge . destination ( seed ) ; if ( dst . graph != SquareNode . RESET_GRAPH ) continue ; int corner = edge . destinationSide ( seed ) ; int l = addOffset ( corner , - 1 , dst . square . size ( ) ) ; int u = addOffset ( corner , 1 , dst . square . size ( ) ) ; if ( isClosedValidEdge ( dst , l ) ) { if ( ! addToRow ( seed , i , 1 , false , tmp ) ) return false ; flipAdd ( tmp , row ) ; } else if ( isClosedValidEdge ( dst , u ) ) { if ( ! addToRow ( seed , i , - 1 , false , row ) ) return false ; } else { dst . graph = 0 ; row . add ( dst ) ; } break ; } } } else if ( numConnections == 2 ) { int indexLower = lowerEdgeIndex ( seed ) ; int indexUpper = addOffset ( indexLower , 1 , seed . square . size ( ) ) ; if ( ! addToRow ( seed , indexUpper , 1 , false , tmp ) ) return false ; flipAdd ( tmp , row ) ; if ( ! addToRow ( seed , indexLower , - 1 , false , row ) ) return false ; } else { return false ; } grid . add ( row ) ; return true ; }
Given a node, add all the squares in the row directly below it.  They will be ordered from "left" to "right".  The
seed node can be anywhere in the row, e.g. middle, start, end.

@return true if a row was added to grid and false if not