Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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());
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems don't need to distinct since the rings is a Set

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems don't need to distinct since the rings is a Set

rings is a List.

private void assertResult(Id id, List<String> rings) {
   ...
}

Before fix this bug, it is also a problem that our test can pass.

image

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry


Assert.assertEquals(expect.size(), rings.size());
for (String ring : rings) {
String error = "Expect: '" + ring + "' in " + expect;
Expand Down