Updated on 2022-04-24 GMT+08:00

Deleting Edges in Batches

You can use a specific API provided by GES to delete edges in batches. The sample code is as follows:
public static void deleteBatchEdges(GraphClient graphClient) throws ApiException 
{
     // Construct the information of a single edge.
    DeleteEdgeReq edge = new DeleteEdgeReq();
    edge.setSource("46");
    edge.setTarget("39");

    DeleteEdgeReq edgeWithIndex = new DeleteEdgeReq();
    edgeWithIndex.setSource("46");
    edgeWithIndex.setTarget("38");
    edgeWithIndex.setIndex("8");

    // Form the list of edges to be deleted.
    List<DeleteEdgeReq> edges = new ArrayList<>();
    edges.add(edge);
    edges.add(edgeWithIndex);

    // Construct a request for deleting edges in batches.
    DeleteBatchEdgeReq deleteBatchEdgeReq = new DeleteBatchEdgeReq();
    deleteBatchEdgeReq.setEdges(edges);

    // CExecute the request for deleting edges in batches.
    Map<String, Object> result = graphClient.deleteBatchEdge(deleteBatchEdgeReq);    
}