Skip to content
  • Dashboard
  • Review
  • Go: plan & chat
  • Roadmap
  • Patterns & lessons49
  • Sheets
  • Problems1.5k
  • Ascend
  • Toolkit
  • Core CS + SQL
  • System Design
  • Machine Coding
  • Interview hub
  • Mock interview
  • Companies & OA
  • Leaderboard
  • Battles
  • College Cup
  • People

Keep your progress

Sync across devices with a free account.

Sign upSign in
Patterns & lessons
Sign inSign up
Patterns/Graphs/Bridges & Articulation Points (low-link)

Technique · CP 2400+

Block-Cut Tree / Bridge Tree

Compress the graph into a tree of biconnected blocks and articulation points (or of 2-edge-connected components joined by bridges). Questions like 'must every u-v path pass through c' become tree-path and LCA queries.

Learn firstBridges & Articulation Points (low-link)Binary Lifting & LCA
0%
mastery
0/4 solved
Practise nextForbidden Cities
IdeaPracticePitfalls

Recognise it

The signal

queries: can you go from a to b while avoiding city c (or edge e)

  1. 1Brute force

    Delete c and BFS for every query.

  2. 2The observation

    Per-query traversal.

  3. 3Why it works

    Every u-v path passes through articulation point c iff c lies on the tree path between the blocks of u and v.

Reach for it when

  • +orient edges so the graph becomes strongly connected
  • +vertices that lie on all paths between two vertices of an undirected graph

Not when

  • ×you only need the list of bridges/cut vertices (bridges-artic)

Practice

Next

Forbidden Cities

0/4 solved
  • Network RenovationCSESMedium
  • Forbidden CitiesCSESHard
  • TouristsCodeforces3200
  • We Need More BossesCodeforces2100

Pitfalls

Misconceptions

  • !mixing up vertex biconnectivity (blocks) and edge biconnectivity (bridge tree)
Go deeper1 combinations · resources

Combinations

  • Block-Cut Tree / Bridge Tree+Binary Lifting & LCA

    queries: can a reach b without visiting c (undirected)

    Block-Cut Tree / Bridge Tree:
    turns 'must pass through c' into a tree-path membership test
    Binary Lifting & LCA:
    LCA / ancestor checks for the path test

    Forbidden Cities

Resources

  • Graph Theory playlistWilliam Fiset · video
  • Graph TraversalUSACO Guide · course
  • Disjoint Set Unioncp-algorithms · article
  • Dijkstracp-algorithms · article
  • Topological sortingcp-algorithms · article
  • Shortest paths visualizerVisuAlgo · tool
  • Graph cheatsheetTech Interview Handbook · article
TodayReviewPatternsProblems