I’ve read that the BFS algorithm is better suited to parallel implementation than DFS. I’m having trouble grasping the intuition of why this should be true. Can anyone explain?
Thanks
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
BFS is a procedure of propagating frontiers. ‘Propagate’ means push all their unvisited adjacent vertices into a queue, and they can be processing independently.
in DFS, the vertices are visited one by one along a direction such as A->B->C. Visiting B must occur before visiting C. It’s a sequential procedure which can not be parallelized easily.
But the truth is both BFS and DFS are hard to parallelize because all the processing nodes have to know the global information. Accessing global variables always requires synchronizations and communications between nodes.