protected Vertex resolveVertex(final Object arg) {
        // arg might already be a Vertex
        if (arg instanceof Vertex)
            return tryAttachVertex((Vertex) arg);

        // otherwise use the arg as a vertex id
        try (CloseableIterator<Vertex> it = CloseableIterator.of(getGraph().vertices(arg))) {
            if (!it.hasNext())
                throw new IllegalArgumentException(
                        String.format("Vertex does not exist for mergeE: %s", arg));
            return it.next();
        }
    }
Translate the Map into search criteria. Default implementation is to translate the Map into a g.E() or
g.V().out/inE() traversal. Graph providers will presumably optimize this traversal to use whatever indices are
present and appropriate for efficiency.

Callers are responsible for closing this iterator when finished.
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/MergeEdgeStep.java