We have a connected graph $G = (V, E)$, and a specific vertex $u \in V$. Suppose we compute a depth-first search tree rooted at $u$ and obtain a tree $T$ that includes all nodes of $G$. Suppose we then compute a breadth-first search tree rooted at $u$, and obtain the same tree $T$. Prove that $G=T$.
I approached this problem by trying to show that all nodes and edges in $G$ are in $T$ and all nodes and edges in $T$ are in $G$.
Since $T$ is a subtree of $G$, all nodes and edges of $T$ are in $G$.
It is also given that all nodes in $G$ are in $T$.
Therefore, we just need to prove that all edges in $G$ are in $T$.
I tried to prove this by contradiction.
Assume there exists edge $e$ where $e$ is in $G$ but not in $T$
Since $e$ does not appear in the breadth first search, it means that it connects two vertices that have the same minimum distance from root vertex $u$. (Since the edge connects two vertices in the same layer of the breadth first search)
This is where I got to in my proof. Could I get some hints on how to complete it?