Skip to content

Commit

Permalink
fix(algorithm): record loop is not copied (#276)
Browse files Browse the repository at this point in the history
Co-authored-by: 枫川 <[email protected]>
  • Loading branch information
corgiboygsj and 枫川 authored Oct 28, 2023
1 parent d55680c commit 85e6399
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public void compute(ComputationContext context, Vertex vertex,
if (isMin) {
sequence.add(id);
IdListList sequences = vertex.value();
sequences.add(sequence);
sequences.add(sequence.copy());
}
} else {
boolean contains = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
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;
Expand Down Expand Up @@ -124,6 +125,10 @@ private void assertResult(Id id, List<String> rings) {
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;
Expand Down

0 comments on commit 85e6399

Please sign in to comment.