graphdb/src/main/java/com/orientechnologies/orient/graph/batch/OGraphBatchInsert.java
public void createEdge(final Long from, final Long to, Map<String, Object> properties) {
    if (settingProperties) {
      throw new IllegalStateException("Cannot create new edges when already set properties on vertices");
    }
    if (from < 0) {
      throw new IllegalArgumentException(" Invalid vertex id: " + from);
    }
    if (to < 0) {
      throw new IllegalArgumentException(" Invalid vertex id: " + to);
    }
    if (useLightWeigthEdges && (properties == null || properties.size() == 0)) {
      last = last < from ? from : last;
      last = last < to ? to : last;
      putInList(from, out, to);
      putInList(to, in, from);
    } else {
      ODocument edgeDoc = new ODocument(edgeClass);

      edgeDoc.fromMap(properties);
      edgeDoc.field("out", new ORecordId(getClusterId(from), getClusterPosition(from)));
      edgeDoc.field("in", new ORecordId(getClusterId(to), getClusterPosition(to)));
      db.save(edgeDoc);
      ORecordId rid = (ORecordId) edgeDoc.getIdentity();
      putInList(from, out, rid);
      putInList(to, in, rid);
    }
  }
public void createEdge(final Long from, final Long to, Map<String, Object> properties) {
    if (settingProperties) {
      throw new IllegalStateException("Cannot create new edges when already set properties on vertices");
    }
    if (from < 0) {
      throw new IllegalArgumentException(" Invalid vertex id: " + from);
    }
    if (to < 0) {
      throw new IllegalArgumentException(" Invalid vertex id: " + to);
    }
    if (useLightWeigthEdges && (properties == null || properties.size() == 0)) {
      last = last < from ? from : last;
      last = last < to ? to : last;
      putInList(from, out, to);
      putInList(to, in, from);
    } else {
      ODocument edgeDoc = new ODocument(edgeClass);

      edgeDoc.fromMap(properties);
      edgeDoc.field("out", new ORecordId(getClusterId(from), getClusterPosition(from)));
      edgeDoc.field("in", new ORecordId(getClusterId(to), getClusterPosition(to)));
      db.save(edgeDoc);
      ORecordId rid = (ORecordId) edgeDoc.getIdentity();
      putInList(from, out, rid);
      putInList(to, in, rid);
    }
  }
public void createEdge ( final Long from , final Long to , Map < String , Object > properties ) { if ( settingProperties ) { throw new IllegalStateException ( "Cannot create new edges when already set properties on vertices" ) ; } if ( from < 0 ) { throw new IllegalArgumentException ( " Invalid vertex id: " + from ) ; } if ( to < 0 ) { throw new IllegalArgumentException ( " Invalid vertex id: " + to ) ; } if ( useLightWeigthEdges && ( properties == null || properties . size ( ) == 0 ) ) { last = last < from ? from : last ; last = last < to ? to : last ; putInList ( from , out , to ) ; putInList ( to , in , from ) ; } else { ODocument edgeDoc = new ODocument ( edgeClass ) ; edgeDoc . fromMap ( properties ) ; edgeDoc . field ( "out" , new ORecordId ( getClusterId ( from ) , getClusterPosition ( from ) ) ) ; edgeDoc . field ( "in" , new ORecordId ( getClusterId ( to ) , getClusterPosition ( to ) ) ) ; db . save ( edgeDoc ) ; ORecordId rid = ( ORecordId ) edgeDoc . getIdentity ( ) ; putInList ( from , out , rid ) ; putInList ( to , in , rid ) ; } }
Creates a new edge between two vertices. If vertices do not exist, they will be created

@param from
id of the vertex that is starting point of the edge
@param to
id of the vertex that is end point of the edge
Creates a new edge between two vertices . If vertices do not exist they will be created