Since it is a tree, choose any arbitrary node as root. Apply BFS at the root.Alternatively color the nodes at each level with red and black color.
Max edges=No.of red nodes $\times$ No. of black nodes - no.of edges in the tree.
You can do it in $O(n)$. Since it is a tree , there will be n-1 edges, if there are n vertices.