Added ability to test whether a hypothetical edge would create a cycle