2 ms·
BFS/DFS is astonishingly simple. It’s like 10 lines of code. And it’s almost always done (in practice) with a custom type where you work your way through custom
by foooorsyth 2y ago
BFS/DFS is astonishingly simple. It’s like 10 lines of code. And it’s almost always done (in practice) with a custom type where you work your way through custom fields pointing to the next vertex, so it’s not an algorithm / structure that lends itself well to standard libraries. It’s not like a self-balancing tree (which is actually a bug-prone, large implementation that you should just let the standard lib handle).
If you can’t trust the people sitting next to you implement a simple graph traversal without bugs, then your organization has a professional standards problem.