Delete a leaf from any tree, and the result will be a tree. Run through this process backwards, and you can see that any tree can be built by adding leaves to existing trees.
Start with one vertex. There's nothing to be done: it is a tree all by itself, and the graph cannot have any edges.
Add a leaf. The only possible leaf is another vertex connected to the first vertex by a single edge.
Add a leaf. Now there are two possible vertices you might connect to, but it's easy to see that the resulting trees are isomorphic, so there is only one tree of three vertices up to isomorphism.
Add a leaf. Now things get interesting: your new leaf can either be at the end of the chain or in the middle, and this leads to non-isomorphic results. So there are two trees with four vertices, up to isomorphism.
In the first case, you can add a final leaf to get to either a path of 5 vertices, or a path of 4 vertices with another leaf on one of the interior vertices. These are the only two choices, up to isomorphism.
In the second case, you can either add a leaf to the central vertex, or to one of the leaf vertices. Again, these are the only two truly distinct choices.
This sounds like four total trees, but in fact one of the first cases is isomorphic to one of the second. So there are a total of three distinct trees with five vertices. You can double-check the remaining options are pairwise non-isomorphic by e.g. considering that one has a vertex of degree 4, one has a vertex of degree 3, and one has all vertices of degree at most 2.
15 Million Students Helped!
Sign up to view the full answer