Example tree: edges (,), (,), (,), (,).
First BFS from node : distances are {:, :, :, :, :}. Farthest nodes are and (distance ). Pick .
Second BFS from node : distances are {:, :, :, :, :}. Farthest node is (distance ). The diameter is : the path ---.
Notice how starting from an arbitrary node () found an endpoint (), and BFS from there found the true diameter.