Let G = (V, E) be a connected and undirected graph, and u is a chosen vertex in V.
Suppose starting from u, exactly the same tree T is obtained using either breadth first search or depth first search.
Prove that G = T, where T is the BFS or DFS tree.
We know, in a BFS tree T, the level of each node v, is the number of edges in the shortest path from v to u. Especially, if v=u, then the level of u is 0. T is also a DFS tree. We know, for each edge e=(v,w) ...
This solution is comprised of a detailed explanation to prove that G = T, where T is the BFS or DFS tree.