DefinitionsBridge – an edge of a graph whose deletion increases the number of connected components. Cut vertex – a vertex whose deletion increases the number of connected components.
children = 0; // Number of children for (size_t i = 0; iint to = g[v][i]; if (to == p) continue; // Parent edge if (used[to]) // Back edge fup[v] = min(fup[v], tin[to]); else { // Tree edge dfs(to, v); fup[v] = min(fup[v], fup[to]); if (fup[to] >= tin[v] && p != -1) IS_CUTPOINT(v); ++children; } } if (p == -1 && children > 1) // If root IS_CUTPOINT(v); }