更新时间:2022-06-30 GMT+08:00
filtered_n_paths算法
您可以使用GES提供的接口执行filtered_n_paths算法。示例代码如下:
public void filteredNPaths(GraphClient graphClient) throws ApiException { FilteredNPathsParameters filteredNPathsParameters = new FilteredNPathsParameters(); filteredNPathsParameters.setSource("Vivian"); filteredNPathsParameters.setTarget("Lethal Weapon"); filteredNPathsParameters.setK(2); filteredNPathsParameters.setN(1); AlgorithmReq algorithmReq = new AlgorithmReq(); algorithmReq.setAlgorithmName(AlgorithmNames.FILTERED_N_PATHS); // 算法名 algorithmReq.setParameters(filteredNPathsParameters); // 算法参数 algorithmReq.addFilter("out", FilterQueryType.EDGE_FILTER, "label_name","labelName", "=", "transfer", 5); // 根据输入参数执行指定算法 AsyncAPIResp asyncAPIResp = graphClient.algorithmQuery(algorithmReq); // 根据算法执行任务id,查询任务执行状态 QueryJobReq queryJobReq = new QueryJobReq(); queryJobReq.setJobId(asyncAPIResp.getJobId()); GesResponse gesResponse = graphClient.queryAsyncTask(queryJobReq); System.out.println(gesResponse); }
父主题: 执行算法