Rare
 0/11

BCCs and 2CCs

Author: Benjamin Qi

2-Edge-Connected Components

StatusSourceProblem NameDifficultyTags
YSEasy
Show Tags2CC

C++

#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 3e5;
int timer; // Time of entry in node
int scc; // Number of strongly connected components
int id[MAX_N];
int low[MAX_N]; // Lowest ID in node's subtree in DFS tree
vector<int> neighbors[MAX_N];

This section is not complete.

Any help would be appreciated! Just submit a Pull Request on Github.

(implementation)

With DSU

StatusSourceProblem NameDifficultyTags
PlatNormal
Show TagsMerging

The analysis for the above problem mentions an O(mα(n))\mathcal{O}(m\alpha(n)) solution. Although this is not a two-connected component problem, we can in fact use DSU to generate two-connected components.

This section is not complete.

Any help would be appreciated! Just submit a Pull Request on Github.

(explanation?)

The DSU operations take O(logn)\mathcal{O}(\log n) rather than O(α(n))\mathcal{O}(\alpha(n)) because the DSU does not use union by size, but it's easy to change this.

struct TwoEdgeCC {
struct {
vi e;
void init(int n) { e = vi(n, -1); }
int get(int x) { return e[x] < 0 ? x : e[x] = get(e[x]); }
bool unite(int x, int y) { // set par[y] = x
x = get(x), y = get(y);
if (x == y) return 0;
e[x] += e[y];
e[y] = x;

Problems

StatusSourceProblem NameDifficultyTags
CEOIEasy
Show TagsBCC
  • SRM 787 1000

Biconnected Components

StatusSourceProblem NameDifficultyTags
CSESNormal
Show TagsBCC

note that BCCs contain EDGES not VERTICES

Related topics include

  • Articulation Points
  • Bridges
  • Block-Cut Tree

Tutorial

Resources
GFG

maybe not completely correct

(implementation)

Problems

StatusSourceProblem NameDifficultyTags
CSESEasy
Show TagsBCC
POINormal
Show TagsBCC
APIONormal
Show TagsBCC
POINormal
Show TagsBCC
DMOJHard
Show TagsBCC
CEOIHard
Show TagsBCC
PlatVery Hard
Show TagsBCC

Module Progress:

Join the USACO Forum!

Stuck on a problem, or don't understand a module? Join the USACO Forum and get help from other competitive programmers!