/diameter-of-tree-bfs

Diameter of a tree using breadth first search

Primary LanguageJava

diameter-of-tree-bfs

Implement the algorithm to find the diameter of a tree using the algorithm discussed in class, that runs BFS twice. Code this algorithm without modifying Graph.java and BFSOO.java, using them from package rbk.

int diameter(Graph g) { ... } // assume that g is an acyclic, connected graph (tree).