In Object-Oriented Programming (OOP), the inheritance among classes represent ``is-a'' relationships for abstractions. Graphs and trees are both fundamental for computer science. In fact, a tree is a special case of a graph that is connected as well as acyclic.
In fact, we often implement trees and graphs by similar means in practice. For instance, we tend to store trees and graphs by adjacent matrice or lists. Moreover, we traverse trees and graphs in alike ways.
For simplicity, we only consider basic operations on trees and graphs. You need implement BFS traversal for a graph starting from a given source and returning the distance to all other vertices so that trees could inherit that method. Furthermore, you should find the diameter (the longest distance in a tree that we've encountered several times but solved by DFS then) by BFS traversal.
Please see the instructions in the header. BFS traversal would be called with the source. As for diameter, there's no parameter.
It's guaranteed that the graph is connected and simple, and that the number of vertices of a tree is less than 100000.
For BFS traversal, you should return a vector of n integers indicating the minimum distance from source.
As for the diameter, you should return an integer.