@Override
    protected Traverser.Admin<Edge> processNextStart() {
        if (this.first) {
            this.first = false;
            final TraverserGenerator generator = this.getTraversal().getTraverserGenerator();

            // a dead traverser to trigger the traversal
            final Traverser.Admin traverser = generator.generate(1, (Step) this, 1);

            final String edgeLabel = (String) this.parameters.get(traverser, T.label, () -> Edge.DEFAULT_LABEL).get(0);

            // FROM/TO must be set and must be vertices
            final Object theTo = this.parameters.get(traverser, TO, () -> null).get(0);
            if (!(theTo instanceof Vertex))
                throw new IllegalStateException(String.format(
                        "The value given to addE(%s).to() must resolve to a Vertex but %s was specified instead", edgeLabel,
                        null == theTo ? "null" : theTo.getClass().getSimpleName()));

            final Object theFrom = this.parameters.get(traverser, FROM, () -> null).get(0);
            if (!(theFrom instanceof Vertex))
                throw new IllegalStateException(String.format(
                        "The value given to addE(%s).from() must resolve to a Vertex but %s was specified instead", edgeLabel,
                        null == theFrom ? "null" : theFrom.getClass().getSimpleName()));

            Vertex toVertex = (Vertex) theTo;
            Vertex fromVertex = (Vertex) theFrom;

            if (toVertex instanceof Attachable)
                toVertex = ((Attachable<Vertex>) toVertex)
                        .attach(Attachable.Method.get(this.getTraversal().getGraph().orElse(EmptyGraph.instance())));
            if (fromVertex instanceof Attachable)
                fromVertex = ((Attachable<Vertex>) fromVertex)
                        .attach(Attachable.Method.get(this.getTraversal().getGraph().orElse(EmptyGraph.instance())));

            final Edge edge = fromVertex.addEdge(edgeLabel, toVertex, this.parameters.getKeyValues(traverser, TO, FROM, T.label));
            EventUtil.registerEdgeCreation(callbackRegistry, getTraversal(), edge);
            return generator.generate(edge, this, 1L);
        } else
            throw FastNoSuchElementException.instance();


    }
@author Marko A. Rodriguez (http://markorodriguez.com)
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AddEdgeStartStep.java