Consider the following algorithm someAlgo that takes an undirected graph G as input.
someAlgo(G)
1. Let v be any vertex in G. Run BFS on G starting at v. Let u be a vertex in G at maximum distance from v as given by the BFS.
2. Run BFS on G again with u as the starting vertex. Let z be the vertex at maximum distance from u as given by the BFS.
3. Output the distance between u and z in G.The output of someAlgo() for the tree shown in the given figure is ___________. (Answer in integer)
Tap to open full sizeFigure description
An unrooted tree with 14 vertices and 13 edges. Two internal hub vertices P and Q (each degree 4) are joined directly by one edge. P also connects to: a leaf L1; a degree-3 vertex M, which itself connects to two further leaves T1 and R1; and a path P-L2-L3 (L2 degree 2) ending in leaf L3. Q also connects to: two leaves B1 and B2; and a path Q-R2-R3-R4 where R2 is degree 3 (also branching to leaf T2) and R3 is degree 2, ending in leaf R4. No vertex labels are printed in the figure; positions only show dots and connecting line segments.