Skip to content

Conversation

@Sanskar-Agrawal01
Copy link

📘 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.

Copy link
Author

@Sanskar-Agrawal01 Sanskar-Agrawal01 left a comment

Choose a reason for hiding this comment

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

Changes done!

@github-actions
Copy link

github-actions bot commented Nov 3, 2025

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.

@github-actions github-actions bot closed this Nov 3, 2025
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