Fix broken ConnectedNodes.intersectsGraph

It is not optimal right now, but that's better than being wrong.
If the performance turns out to be too bad, we can try to fix the
implementation.