javeme commented on code in PR #2016: URL: https://github.com/apache/incubator-hugegraph/pull/2016#discussion_r1021420039
########## hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/AdamicAdarAPI.java: ########## @@ -80,9 +80,10 @@ public String get(@Context GraphManager manager, Directions dir = Directions.convert(EdgeAPI.parseDirection(direction)); HugeGraph g = graph(manager, graph); - PredictionTraverser traverser = new PredictionTraverser(g); - double score = traverser.adamicAdar(sourceId, targetId, dir, - edgeLabel, maxDegree, limit); - return JsonUtil.toJson(ImmutableMap.of("adamic_adar", score)); + try (PredictionTraverser traverser = new PredictionTraverser(g)) { + double score = traverser.adamicAdar(sourceId, targetId, dir, + edgeLabel, maxDegree, limit); Review Comment: prefer to keep the origin alignment ########## hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/ResourceAllocationAPI.java: ########## @@ -80,10 +80,11 @@ public String create(@Context GraphManager manager, Directions dir = Directions.convert(EdgeAPI.parseDirection(direction)); HugeGraph g = graph(manager, graph); - PredictionTraverser traverser = new PredictionTraverser(g); - double score = traverser.resourceAllocation(sourceId, targetId, dir, - edgeLabel, maxDegree, - limit); - return JsonUtil.toJson(ImmutableMap.of("resource_allocation", score)); + try(PredictionTraverser traverser = new PredictionTraverser(g)) { + double score = traverser.resourceAllocation(sourceId, targetId, dir, + edgeLabel, maxDegree, Review Comment: prefer to keep the origin alignment -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@hugegraph.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org