class UndirectedGraphImpl implements UndirectedGraph<V, E> {

    @Override
    public boolean vertexExists(int v) {
        if (v < 0) {
            throw new PowsyblException("Invalid vertex " + v);
        }
        return v < vertices.size() && vertices.get(v) != null;
    }

}