hardGraphsGraphs

Find Critical and Pseudo-Critical Edges in Minimum Spanning Tree

hardTime: O(E^2 * alpha(V))Space: O(V)

Signals to notice

identify edges whose removal increases MST weightcritical vs pseudo-criticalMST edge classification

Brute force first

For each edge, compute MST without it and with it forced in. Two MST computations per edge. That instinct is useful because it follows the prompt literally, but it usually keeps revisiting work the problem is begging you to organize.

The key insight

Compute the base MST weight. For each edge: (1) exclude it and compute MST — if weight increases or MST is disconnected, it's critical. (2) Force-include it and compute MST — if weight equals base, it's pseudo-critical. but with Kruskal's, each MST is fast. The goal is not to be clever for its own sake, but to remember the one relationship that keeps the solution grounded as you move forward.

What must stay true

A critical edge must be in every MST. A pseudo-critical edge appears in at least one MST but not all. Testing exclusion catches critical edges; testing forced inclusion catches pseudo-critical ones. If that remains true after every update, the rest of the reasoning has a stable place to stand.

Easy way to go wrong

Not testing both exclusion AND forced inclusion — an edge could be neither critical nor pseudo-critical. Also, a disconnected graph after exclusion means the edge was a bridge, making it critical. Most mistakes here are not about syntax; they come from losing track of what your state, pointer, or structure is supposed to mean.

Graphs Pattern