You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hugegraph.apache.org by gu...@apache.org on 2023/10/25 12:52:53 UTC

[incubator-hugegraph-computer] branch fix-ring-detection-result created (now 35364c21)

This is an automated email from the ASF dual-hosted git repository.

guoshoujing pushed a change to branch fix-ring-detection-result
in repository https://gitbox.apache.org/repos/asf/incubator-hugegraph-computer.git


      at 35364c21 fix(algorithm): record loop is not copied

This branch includes the following new commits:

     new 35364c21 fix(algorithm): record loop is not copied

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[incubator-hugegraph-computer] 01/01: fix(algorithm): record loop is not copied

Posted by gu...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

guoshoujing pushed a commit to branch fix-ring-detection-result
in repository https://gitbox.apache.org/repos/asf/incubator-hugegraph-computer.git

commit 35364c219e2627d70a6d42da328b516cf8c5a5df
Author: 枫川 <gu...@alibaba-inc.com>
AuthorDate: Wed Oct 25 20:52:44 2023 +0800

    fix(algorithm): record loop is not copied
---
 .../hugegraph/computer/algorithm/path/rings/RingsDetection.java      | 2 +-
 .../hugegraph/computer/algorithm/path/rings/RingsDetectionTest.java  | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/path/rings/RingsDetection.java b/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/path/rings/RingsDetection.java
index 956b06cc..1ef92bac 100644
--- a/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/path/rings/RingsDetection.java
+++ b/computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/path/rings/RingsDetection.java
@@ -83,7 +83,7 @@ public class RingsDetection implements Computation<IdList> {
                 if (isMin) {
                     sequence.add(id);
                     IdListList sequences = vertex.value();
-                    sequences.add(sequence);
+                    sequences.add(sequence.copy());
                 }
             } else {
                 boolean contains = false;
diff --git a/computer-test/src/main/java/org/apache/hugegraph/computer/algorithm/path/rings/RingsDetectionTest.java b/computer-test/src/main/java/org/apache/hugegraph/computer/algorithm/path/rings/RingsDetectionTest.java
index 81422320..822a4ec3 100644
--- a/computer-test/src/main/java/org/apache/hugegraph/computer/algorithm/path/rings/RingsDetectionTest.java
+++ b/computer-test/src/main/java/org/apache/hugegraph/computer/algorithm/path/rings/RingsDetectionTest.java
@@ -21,6 +21,7 @@ import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.stream.Collectors;
 
 import org.apache.hugegraph.computer.algorithm.AlgorithmTestBase;
 import org.apache.hugegraph.computer.core.config.ComputerOptions;
@@ -124,6 +125,10 @@ public class RingsDetectionTest extends AlgorithmTestBase {
             Set<String> expect = EXPECT_RINGS.getOrDefault(id.toString(),
                                                            new HashSet<>());
 
+            rings = rings.stream()
+                         .distinct()
+                         .collect(Collectors.toList());
+
             Assert.assertEquals(expect.size(), rings.size());
             for (String ring : rings) {
                 String error = "Expect: '" + ring + "' in " + expect;