Unifies outlinks and inlinks to edges, inspired by
https://code.google.com/codejam/contest/3214486/scoreboard#vf=1 (Rank 1,
Prowindy, Problem C, 19pt, code)