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

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