Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible error in Shortest even length path (Applications of BFS) #1257

Open
VaibhavKumar260702 opened this issue Mar 31, 2024 · 1 comment
Labels

Comments

@VaibhavKumar260702
Copy link

In this article (link), there might a possible error related to path and walk. I think that provided algorithm gives shortest walk of even length. Here is a counter example where algorithm fails to give correct answer.

Consider an undirected, unweighted graph G = (V,E) where V = {1,2,3,4} and E = {(1,2),{2,3},{3,4},{4,2}}.
Take source = 1 and target = 2. The provided algorithm gives result as 4 but there doesn't exist any even length path from 1 to 2 in G.

Please correct me if I am wrong else also suggest how to solve the original problem i.e. Shortest even length path.

@adamant-pwn
Copy link
Member

That's a very interesting observation, thanks! I think it warrants at least changing path to walk in the article. Would you like to make a pull request about it? Unfortunately, I do not know yet if it is possible to solve this problem in the "path" setting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants