Hacker News new | ask | show | jobs
by 61u 798 days ago
You could just run bfs from both starting and ending nodes until you find a node reachable from both the starting and ending nodes.
1 comments

https://ideone.com/MGFwdo

I am running BFS from only the starting node because the graph is symmetrical.