Skip to content

Add Bridge Detection Algorithm (Tarjan's Method) in R#198

Merged
siriak merged 2 commits intoTheAlgorithms:masterfrom
iampratik13:bridge_detector.r
Oct 12, 2025
Merged

Add Bridge Detection Algorithm (Tarjan's Method) in R#198
siriak merged 2 commits intoTheAlgorithms:masterfrom
iampratik13:bridge_detector.r

Conversation

@iampratik13
Copy link
Copy Markdown
Contributor

This PR introduces a complete implementation of the Bridge Detection Algorithm (also known as critical edge detection) in R using Tarjan’s algorithm. The algorithm identifies all edges in an undirected graph whose removal increases the number of connected components. These edges are also referred to as bridges.

Algorithm Complexity:
• Time Complexity: O(V + E) — DFS traversal over all vertices and edges
• Space Complexity: O(V) — arrays for visited, discovery, low-link, and parent information

Use Cases:
• Network reliability analysis (finding critical connections)
• Graph connectivity analysis
• Educational demonstrations for graph algorithms in R

File added: bridge_detector.r

@siriak siriak requested a review from Copilot October 12, 2025 09:43
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces a bridge detection algorithm implementation using Tarjan's method to identify critical edges in undirected graphs. The algorithm finds edges whose removal would increase the number of connected components in the graph.

  • Implements Tarjan's bridge detection algorithm with O(V + E) time complexity
  • Provides comprehensive examples demonstrating various graph topologies
  • Includes edge case handling for empty graphs and disconnected components

Comment thread graph_algorithms/bridge_detector.r
Copy link
Copy Markdown
Member

@siriak siriak left a comment

Choose a reason for hiding this comment

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

Looks good, thanks!

@siriak siriak merged commit e6c0b52 into TheAlgorithms:master Oct 12, 2025
2 checks passed
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.

3 participants