I was asked to find an example of two non-isomorphic trees with the same amount of vertices and the same sequence of edges.
I can't seem to understand why it's not isomorphic.
I was asked to find an example of two non-isomorphic trees with the same amount of vertices and the same sequence of edges.
I can't seem to understand why it's not isomorphic.
The most straightforward way is to list all the trees of with a certain number of vertices and go on until one finds two graphs which match the criterion. While tedious it does not take particularly long as there are for example just 2 trees with 4 vertices, 3 trees with 5 vertices, 6 trees with 6 vertices, 11 with 7 vertices, 23 with 8 vertices, and so on. (OEIS A000055) While the number of trees with a fixed number of vertices increases exponentially one encounters pair of examples before it grows out of control.
A more elegant way is using a conceptual idea I outlined in the comments where one considers ways to modify a preexisting tree in such a way that most of the trees structure, number of vertices and degrees of vertices are conserved.
One such operation is that of "cutting off a branch and reattaching it onto another branch". I will assume it to be visually clear what that would mean; a "branch" being a sort of sub-tree of the main tree. Only two vertices will have their degrees change; the vertex where the branch is cut and the vertex at where it is reattached, but the overall shape of the tree can be made to change significantly.
Interesting sub-problems to this problem is to find the smallest number of vertices you need to form two of these trees, or consider whether or not you can have two non isomorphic trees with the same degrees but which cannot be transformed into eachother by rearranging branches (or alternately where one rearrangement isn't enough)
If you're looking for two non-isomorphic trees with the same degree sequence, I think the smallest example must be
O O
| |
O---O---O---O---O and O---O---O---O---O
For orders $n \leq 5$, there are no non-isomorphic trees with the same degree sequence. For $n=6$, Henning Makholm's example is the unique case. For $n=7$, we have the following possibilities (with vertices marked as their vertex degrees):
Degree sequence $(3,3,2,1,1,1,1)$:
Degree sequence $(4,2,2,1,1,1,1)$:
Degree sequence $(3,2,2,2,1,1,1)$:
These were computed using geng which comes packaged with Nauty.