Skip to content

Conversation

@Amritray01
Copy link


Description of Change

Added a new implementation graph/cycle_check_undirected_dsu.cpp for Cycle Detection in Undirected Graph using Disjoint Set Union (Union–Find) with path compression and union by rank.
This complements the existing directed graph version and efficiently detects cycles in O(E α(V)) time.
The program includes inline tests, handles self-loops and disconnected graphs, and follows C++17 and Doxygen documentation standards.

Checklist

Notes:
Efficient DSU-based cycle detection for undirected graphs — complements cycle_check_directed_graph.cpp.
Expected output during self-test:

Test 1 (triangle): Cycle
Test 2 (chain): No cycle
Test 3 (disconnected): Cycle
Test 4 (self-loop): Cycle

@github-actions
Copy link
Contributor

This pull request has been automatically marked as abandoned because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale Author has not responded to the comments for over 2 weeks label Dec 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stale Author has not responded to the comments for over 2 weeks

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant