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

Bug in dfs.py #7

Open
gaurav-patel-git opened this issue Dec 3, 2019 · 1 comment
Open

Bug in dfs.py #7

gaurav-patel-git opened this issue Dec 3, 2019 · 1 comment

Comments

@gaurav-patel-git
Copy link

In line 19 of dfs.py we should add another condition that cur vertex should not be present in stack.
In case of K3 graph the output of your programme is [0, 2, 1, 1].

@alaouiib
Copy link

alaouiib commented Jan 15, 2021

before appending current to the visitedVertex, add this condition

if current not in stack:
     visitedVertex.append(current)

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

No branches or pull requests

2 participants