public static int[] analyzeGraphGrid(TupleSet ts){
  int m, n;
  Iterator iter=ts.tuples();
  iter.next();
  for (n=2; iter.hasNext(); n++) {
    Node nd=(Node)iter.next();
    if (nd.getDegree() == 2)     break;
  }
  m=ts.getTupleCount() / n;
  return new int[]{m,n};
}

public static int [ ] analyzeGraphGrid ( TupleSet ts ) { int m , n ; Iterator iter = ts . tuples ( ) ; iter . next ( ) ; for ( n = 2 ; iter . hasNext ( ) ; n ++ ) { Node nd = ( Node ) iter . next ( ) ; if ( nd . getDegree ( ) == 2 ) break ; } m = ts . getTupleCount ( ) / n ; return new int [ ] { m , n } ; }
analyzes a set of nodes to try and determine grid dimensions . currently looks for the edge count on a node to drop to 2 to determine the end of a row .
