feat: add Articulation Points and Bridges algorithm#6684
Closed
Pasan11504 wants to merge 2 commits intoTheAlgorithms:masterfrom
Closed
feat: add Articulation Points and Bridges algorithm#6684Pasan11504 wants to merge 2 commits intoTheAlgorithms:masterfrom
Pasan11504 wants to merge 2 commits intoTheAlgorithms:masterfrom
Conversation
Implement DFS-based algorithm to find articulation points (cut vertices) and bridges (cut edges) in undirected graphs. Features: - Find articulation points: vertices whose removal increases connected components - Find bridges: edges whose removal increases connected components - Time complexity: O(V + E) using single DFS traversal - Handles disconnected graphs - Comprehensive test suite with 15 test cases Implementation details: - Uses discovery time and low-link values - Follows Tarjan's approach for graph analysis - Includes convenience methods for finding only points or only bridges - Full Javadoc documentation with examples and applications Test coverage: - Simple graphs with single/multiple articulation points - Graphs with no articulation points (biconnected components) - Star graphs, disconnected graphs, edge cases - Validates edge symmetry and proper error handling Applications: Network reliability, social network analysis, circuit design, transportation networks
Member
|
@Pasan11504 Please fix the failing workflows so I can start the review. |
|
This pull request has been automatically closed because its workflows or checks failed and it has been inactive for more than 14 days. Please fix the workflows and reopen if you'd like to continue. Merging from main/master alone does not count as activity. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📝 Add Articulation Points and Bridges Algorithm
Description
This PR implements an algorithm to find Articulation Points (Cut Vertices) and Bridges (Cut Edges) in undirected graphs using a DFS-based approach with discovery times and low-link values.
Articulation Point: A vertex whose removal increases the number of connected components.
Bridge: An edge whose removal increases the number of connected components.
Features
Algorithm Details
Time Complexity: O(V + E)
Space Complexity: O(V)
Detection Rules:
uis an articulation point if it has a childvwherelow[v] >= discovery[u](u,v)is a bridge iflow[v] > discovery[u]Test Coverage
The test suite covers:
Real-World Applications
Files Changed
src/main/java/com/thealgorithms/datastructures/graphs/ArticulationPointsAndBridges.java- Main implementation (270 lines)src/test/java/com/thealgorithms/datastructures/graphs/ArticulationPointsAndBridgesTest.java- Test suite (371 lines)Checklist
References
Hacktoberfest 2025 🎃
Example Usage