def nonisomorphic_trees(order, create='graph'):
 if (order < 2):
  raise ValueError
 layout = (list(range(((order // 2) + 1))) + list(range(1, ((order + 1) // 2))))
 while (layout is not None):
  layout = _next_tree(layout)
  if (layout is not None):
   if (create == 'graph'):
    (yield _layout_to_graph(layout))
   elif (create == 'matrix'):
    (yield _layout_to_matrix(layout))
   layout = _next_rooted_tree(layout)

def nonisomorphic_trees ( order , create = 'graph' ) : if ( order < 2 ) : raise ValueError layout = ( list ( range ( ( ( order // 2 ) + 1 ) ) ) + list ( range ( 1 , ( ( order + 1 ) // 2 ) ) ) ) while ( layout is not None ) : layout = _next_tree ( layout ) if ( layout is not None ) : if ( create == 'graph' ) : ( yield _layout_to_graph ( layout ) ) elif ( create == 'matrix' ) : ( yield _layout_to_matrix ( layout ) ) layout = _next_rooted_tree ( layout )
returns a list of nonisomporphic trees parameters order : int order of the desired tree(s) create : graph or matrix if graph is selected a list of trees will be returned .