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