Skip to content

DFS code in Java was not working#15

Open
CharuchithRanjit wants to merge 1 commit intostriver79:mainfrom
CharuchithRanjit:dfsfix
Open

DFS code in Java was not working#15
CharuchithRanjit wants to merge 1 commit intostriver79:mainfrom
CharuchithRanjit:dfsfix

Conversation

@CharuchithRanjit
Copy link

The way the input was taken was for a graph which started from 0, put the way the graph was being traversed with dfs was with the fact that the graph starts from 1. To fix, I have changed the way the where to where the iterator runs, so that the graph works as a 0 node starting graph. It works properly now.

Sample Input/Output after fix:

1
7 6
0 1
1 3
1 6
6 5
3 5
2 4
0 1 3 5 6 2 4 

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

Successfully merging this pull request may close these issues.

1 participant