Implemented Articulation Point (Bridge Detection) Algorithm in Graph Folder#6828
Closed
Sanskar-Agrawal01 wants to merge 3 commits intoTheAlgorithms:masterfrom
Closed
Implemented Articulation Point (Bridge Detection) Algorithm in Graph Folder#6828Sanskar-Agrawal01 wants to merge 3 commits intoTheAlgorithms:masterfrom
Sanskar-Agrawal01 wants to merge 3 commits intoTheAlgorithms:masterfrom
Conversation
|
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.
📘 Description
This pull request introduces the implementation of the Articulation Point (Bridge Detection) algorithm in the com.thealgorithms.graph package.
The algorithm identifies all the critical connections (edges) in a graph whose removal increases the number of connected components.
This implementation is based on Tarjan’s Algorithm using Depth-First Search (DFS) and maintains discovery and low-link values for each vertex.
🧠 Key Features
Detects articulation points / bridges in an undirected graph.
Uses DFS traversal with time-stamping for discovery and low values.
Efficient O(V + E) time complexity.
Designed with a modular structure and inner Edge class for better readability.
Returns a list of all critical connections in the graph.
📄 File Added
src/main/java/com/thealgorithms/graph/ArticulationPoint.java
🧪 Example Usage
List<List> connections = List.of(
List.of(0, 1),
List.of(1, 2),
List.of(2, 0),
List.of(1, 3)
);
ArticulationPoint ap = new ArticulationPoint();
List<List> result = ap.criticalConnections(4, connections);
// Output: [[1, 3]] — removing edge (1, 3) increases the number of components
✅ Checklist
Code follows the existing project style and conventions.
Added a new algorithm implementation in the correct package.
Verified correctness through example test cases.