hi,

in cormen's book while traversing bfs we are given a source node from which we start traversing. but for dfs we do the traversal for each node iteratively. why is this done so? i mean the difference between both traversals should be on the way it is done (the order of traversing nodes) and the goal should be the same ie reaching all nodes.

Moreover, it says for dfs we get forest while for dfs we get tree. but this is kind of strange because for the same graph if we traverse bfs for each node we get also different trees which have different roots ie forests. If the configuration is the same we get the same thing.