protected void findClusters ( ) { for ( int i = 0 ; i < nodes . size ( ) ; i ++ ) { SquareNode n = nodes . get ( i ) ; if ( n . graph < 0 ) { n . graph = clusters . size ( ) ; List < SquareNode > graph = clusters . grow ( ) ; graph . add ( n ) ; addToCluster ( n , graph ) ; } } }
Put sets of nodes into the same list if they are some how connected