chinmay awesome breakdown! Which approach do you think scales better for huge datasets—BFS or DFS?
Topological sort
4 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.
🔥 Join developers growing publicly
Share your knowledge, build in public, and grow your developer presence with a global community.
Please log in to comment on this post.
More Posts
- © 2026 Coder Legion
- Feedback / Bug
- Privacy
- About Us
- Contacts
- You Tube
- Tiktok
- Premium Subscription
- Terms of Service
- Early Builders
chevron_left
More From Chinmay
Related Jobs
- Retail Sales Associate Spanish BilingualVerizon · Full time · Germany
- Spanish Bilingual Appointment Setter Work From HomeInsurance Protection Specialists · Full time · Puerto Rico
- Bilingual Retail Sales Associate (Spanish) - VerizonVerizon · Full time · Germany
Commenters (This Week)
YaoshenLuo
2 comments
AIFlipRoom
2 comments
gerwin
1 comment
Contribute meaningful comments to climb the leaderboard and earn badges!