let A = graph.cotargets[y] ?? [] let B = graph.targets[x] ?? [] for a in A where a != x { for b in B where b != y { if graph.targets[a]?.contains(b) ?? false { graph.disconnect(a, b) } else { graph.connect(a, b) } } }
こういう風に A, B を外に出すのも試してみたけど変わりません…