You could use containsEdge(V, V) here instead.