Capstone: Meridian's Network Model
In short: one sorted union-find pass answers two questions — how many pieces the network falls into, and what the cheapest backbone linking each piece costs — because Kruskal's algorithm is that pass, just with the roads sorted first. One low-link DFS over the same roads then answers two more: every critical road (a bridge) and every critical junction (an articulation point). Four numbers, one sort, one union-find pass and one DFS.

Meridian's planners want one page about the road network before anything gets routed over it. Is the city one piece, or are there parts no van can reach? What would the cheapest backbone cost, the fibre that keeps every depot talking? And where are the weak points, the roads and junctions whose closure would split the city?
Every answer is something you've already built in this section. The capstone puts
them together into one function, network_report, and shows that one union-find
pass and one depth-first search are enough for all four numbers.
Part 1: pieces and the backbone, in one pass
A road network can be in several pieces: a new estate whose access road isn't finished, or an island reached only by ferry. Counting pieces is union-find: start with one piece per junction, and every road that joins two different groups leaves one fewer.
junctions = ["a", "b", "c", "d", "e", "f"]
roads = [("a", "b"), ("c", "d"), ("d", "e"), ("e", "c")]
parent = {j: j for j in junctions}
def find(x):
while parent[x] != x:
x = parent[x]
return x
pieces = len(junctions)
for a, b in roads:
ra, rb = find(a), find(b)
if ra != rb:
parent[ra] = rb
pieces -= 1
print(pieces)Now look at what that loop is doing. It's Kruskal's algorithm without the sort. Sort the roads by cost first and the same unions build the cheapest backbone. On a network in several pieces, Kruskal's never finds a road between them and simply returns one tree per piece, a minimum spanning forest. So one pass gives two answers: pieces is junctions minus successful unions, and the backbone cost is the sum of their costs.
The backbone isn't always the cheap roads, though:
roads = [("a", "b", 1), ("b", "c", 2), ("c", "a", 3), ("c", "d", 100)]
parent = {j: j for j in "abcd"}
def find(x):
while parent[x] != x:
x = parent[x]
return x
total = 0
for a, b, cost in sorted(roads, key=lambda r: r[2]):
ra, rb = find(a), find(b)
if ra != rb:
parent[ra] = rb
total += cost
print(total)That road to d is a critical road, and the second prediction is no accident.