2 color graph problem. Why dfs and not bfs ?

Revision en1, by hackerbaba, 2020-05-07 12:52:18

Hello again. Just understood graphs. in this, the author gave a solution of dfs.

I was wondering, as to couldn't it be solved with Breadth First Search? Marking each level as one colour, and the other level as the second colour?

I gave a solution with BFS, but it's giving a wrong output.

Could you please help me out?

Tags #graph, #graphs, graphs, dfs, bfs

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English hackerbaba 2020-05-07 12:52:18 557 Initial revision (published)