更新时间:2022-06-30 GMT+08:00

批量删除边

您可以使用GES提供的接口批量删除边。示例代码如下:
public static void deleteBatchEdges(GraphClient graphClient) throws ApiException 
{
    // 构造单条边信息
    DeleteEdgeReq edge = new DeleteEdgeReq();
    edge.setSource("46");
    edge.setTarget("39");

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

    // 组成待删除边列表
    List<DeleteEdgeReq> edges = new ArrayList<>();
    edges.add(edge);
    edges.add(edgeWithIndex);

    // 构造删除批量边请求
    DeleteBatchEdgeReq deleteBatchEdgeReq = new DeleteBatchEdgeReq();
    deleteBatchEdgeReq.setEdges(edges);

    // 执行删除批量边请求
    Map<String, Object> result = graphClient.deleteBatchEdge(deleteBatchEdgeReq);    
}