You are viewing a single comment's thread. Return to all comments →
You can avoid the seen set by using distance since distance[node] != -1 will mean you already traversed that node.
Seems like cookies are disabled on this browser, please enable them to open this website
BFS: Shortest Reach in a Graph
You are viewing a single comment's thread. Return to all comments →
You can avoid the seen set by using distance since distance[node] != -1 will mean you already traversed that node.