You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hugegraph.apache.org by ji...@apache.org on 2023/10/28 16:05:20 UTC
(incubator-hugegraph-computer) branch master updated: fix(algorithm): record loop is not copied (#276)
This is an automated email from the ASF dual-hosted git repository.
jin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-hugegraph-computer.git
The following commit(s) were added to refs/heads/master by this push:
new 85e63995 fix(algorithm): record loop is not copied (#276)
85e63995 is described below
commit 85e639953b63de00e59a73cda28fdfc183367627
Author: ShouJing <10...@qq.com>
AuthorDate: Sun Oct 29 00:05:10 2023 +0800
fix(algorithm): record loop is not copied (#276)
Co-authored-by: 枫川 <gu...@alibaba-inc.com>
---
.../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;