First perform DFS to find a vertex "on the edge", say v. Then perform DFS again starting from this vertex v. The farthest vertex from v, say w gives us the diameter (the distance from v to w)
Hold the tree up at node c. It's going to fall by gravity and arrange as shown below. This is the same as performing a DFS.
Pick one of the lowest nodes (we pick g). Now hold the entire tree from this lowest node, and once again allow gravity to act.
This will give us new lowest nodes such as b. This node b is going to be diameter, "because" it's the distance from a lowest node to another lowest node.