chinmay awesome breakdown! Which approach do you think scales better for huge datasets—BFS or DFS?
Topological sort
Chinmay
posted
2 min read
0 Comments
Chinmay
•
Depends on the problem we are trying to solve, but in general BFS will scale well since it relies on queue based iteration and process the node in layers and this could be implemented as an parallel operation for really large graphs
One more fun part about BFS is that it will visit each node only once, whereas in DFS it might happen that a node is "revisited" but since we are tracking if a node is visited or not, it does not re-run a recursion again, but there are a bunch of extra function calls that happen...
One more fun part about BFS is that it will visit each node only once, whereas in DFS it might happen that a node is "revisited" but since we are tracking if a node is visited or not, it does not re-run a recursion again, but there are a bunch of extra function calls that happen...
Please log in to add a comment.
Please log in to comment on this post.
More Posts
- © 2026 Coder Legion
- Feedback / Bug
- Privacy
- About Us
- Contacts
- Premium Subscription
- Terms of Service
- Refund
- Early Builders
chevron_left
More From Chinmay
Related Jobs
- Full Stack Java/Go Developer (Bilingual English/Spanish)Dev Technology · Full time · Arlington, VA
- Language Data Annotator ( Spanish)Innova software Services Inc · Full time · Canada
- Language Data Annotator ( Spanish)Innova software Services Inc · Full time · Canada
Commenters (This Week)
Ahmer Arain
1 comment
alxsabo
1 comment
CHris
1 comment
Contribute meaningful comments to climb the leaderboard and earn badges!