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

Cycle Detection in a Directed Graph (Using DFS) #1794

Merged
merged 1 commit into from
Nov 10, 2024

Conversation

Ananya-vastare
Copy link
Contributor

@Ananya-vastare Ananya-vastare commented Nov 9, 2024

Cycle detection in a directed graph using Depth-First Search (DFS) works by exploring each node and tracking visited nodes in two ways: a visited set for nodes that have been completely processed, and a recursion stack for nodes currently in the DFS path. Starting from any unvisited node, DFS recursively visits its neighbors. If it encounters a node that is in the recursion stack, a cycle is detected since this indicates a back edge, where a node links back to an ancestor in the DFS path. Once all neighbors are processed, the node is removed from the recursion stack and marked as fully visited.

Issue NO:#1752

@Ananya-vastare
Copy link
Contributor Author

@pankaj-bind please let me know if there are any issues thank you

Copy link
Member

@pankaj-bind pankaj-bind left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{A98CC327-B5FE-4881-8BFE-4853055C8F43}
delete extra files

@Ananya-vastare
Copy link
Contributor Author

@pankaj-bind I have made the changes you can merge it now

@Ananya-vastare
Copy link
Contributor Author

@pankaj-bind please review this the deadline is at 7:00pm

@pankaj-bind pankaj-bind merged commit 6ccac0e into AlgoGenesis:main Nov 10, 2024
2 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants