tree ordering in sage
I am using the following code to generate the isomorphism class of trees of order $n$.
sage: from sage.graphs.trees import TreeIterator
sage: def check_trees(n):
....: trees = []
....: for t in TreeIterator(n):
....: if not t.is_tree():
....: return False
....: if t.num_verts() != n:
....: return False
....: if t.num_edges() != n - 1:
....: return False
....: for tree in trees:
....: if tree.is_isomorphic(t):
....: return False
....: trees.append(t)
....: return True
Then when I print the trees in TreeIterator using loops it is giving the trees in a particular order.
Can anyone explain to me what is this predefined order on trees of order $n$ on sage?
For n = 6, we have the following order.
As a side-comment, when pasting code in your question please mark it as pre-formatted code (there's a button on the WYSIWYG toolbar, but you can also select the code and press Ctrl-K to indent it all at once, which causes it to be treated as pre-formatted text. I have gone ahead and fixed it for you in this case.
That's a good question though. I looked at the code, and even the code does not include any commentary explaining how it works. Yes, one can read the code and figure it out, but I don't think it's at all "obvious".
Sorry, I shall paste it like this in future. Thanks for your comment.