DanGuge commented on code in PR #2262:
URL: 
https://github.com/apache/incubator-hugegraph/pull/2262#discussion_r1292235065


##########
hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/ShortestPathTraverser.java:
##########
@@ -126,27 +135,36 @@ public PathSet allShortestPaths(Id sourceV, Id targetV, 
Directions dir,
             checkCapacity(traverser.capacity, traverser.accessed(),
                           "shortest path");
         }
+
+        this.vertexIterCounter.addAndGet(traverser.vertexCount);
+        this.edgeIterCounter.addAndGet(traverser.record.accessed());
+
+        paths.setEdges(traverser.edgeRecord.getEdges(paths));
         return paths;
     }
 
     private class Traverser {
 
         private final ShortestPathRecords record;
+        private final EdgeRecord edgeRecord;

Review Comment:
   fixed



##########
hugegraph-core/src/main/java/org/apache/hugegraph/traversal/algorithm/CustomizePathsTraverser.java:
##########
@@ -133,36 +171,13 @@ public List<Path> customizedPaths(Iterator<Vertex> 
vertices,
         return paths;
     }
 
-    public static List<Path> topNPath(List<Path> paths,
-                                      boolean incr, long limit) {
-        paths.sort((p1, p2) -> {
-            WeightPath wp1 = (WeightPath) p1;
-            WeightPath wp2 = (WeightPath) p2;
-            int result = Double.compare(wp1.totalWeight(), wp2.totalWeight());
-            return incr ? result : -result;
-        });
-
-        if (limit == NO_LIMIT || paths.size() <= limit) {
-            return paths;
-        }
-        return paths.subList(0, (int) limit);
-    }
-
-    private static List<Node> sample(List<Node> nodes, long sample) {
-        if (nodes.size() <= sample) {
-            return nodes;
-        }
-        List<Node> result = newList((int) sample);
-        int size = nodes.size();
-        for (int random : CollectionUtil.randomSet(0, size, (int) sample)) {
-            result.add(nodes.get(random));
-        }
-        return result;
+    public EdgeRecord getEdgeRecord() {

Review Comment:
   fixed



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to