Assume we have Graphs $G$ and $H$ and $V(G) = V(H)$, where $V$ is a set of vertices. What would be the algorithm to find out if these graphs are identical? The time boundary for this task is $\mathcal{O}(m+n)$ ($m$ and $n$ are not specified but I assume $m$ is $|E(H)|$ and $n$ is $|V(H)|$ where $E$ is a set of edges).
Graphs are not directed nor edge-weighted.
In my opinion the time boundary says us that the algorithm should be based on $DFS$ or $BFS$. In my solution I use $DFS$ to count vertex degree and check if vertex degree in graph $G$ is the same as this vertex degree in $H$. I'm not sure if this is the correct way of solving the problem, thus I am asking you - is it?
EDIT: Ok, so there seems to be a lot of confusion as what 'identical' graph means... So I was not entirely sure at the time I asked the question, but now I know that I need to just check if the sets of edges of these graphs are equal. I still don't know how to do that in $\mathcal{O}(m+n)$ time though (assuming that graphs are stored as adjacency lists).