Graph Theory37 sections · 1633 units
Open in Course

School Dance - Edge Cases

(Unbalanced sides, no edges)

Edge cases:

1.1. No preferences: max flow is 00, output 00 pairs.

2.2. More boys than girls (or vice versa): max flow is limited by the smaller set.

3.3. One boy likes all girls: he gets paired with one, others remain.

4.4. Disconnected preferences: some boys or girls remain unpaired.

Always check if k=0k = 0 (no preferences). Return 00 immediately. Also handle n=0n = 0 or m=0m = 0. These cases should not crash your program.