The core idea: start BFS from any node and find the farthest node . Then run BFS from to find the farthest node . The distance from to is the diameter.
Why does this work? The farthest node from any starting point must be a diameter endpoint. This is a property of trees that fails for general graphs. The proof involves showing that any path not ending at or cannot be longer than the - path. You do not need to understand the proof to use the technique.