Skip to content

Commit

Permalink
Remove self-closing short loops in removeLoops
Browse files Browse the repository at this point in the history
  • Loading branch information
wipfli committed Nov 7, 2024
1 parent 801e1de commit 091bdb8
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,13 @@ private void removeLoops() {
List<Edge> removedEdges = new ArrayList<>();
for (var node : output) {
for (var edge : List.copyOf(node.getEdges())) {
if (removedEdges.contains(edge) || edge.from == edge.to) {
if (removedEdges.contains(edge)) {
continue;
}
if (edge.from == edge.to && edge.length <= loopMinLength) {
// self-closing short loop
removedEdges.add(edge);
edge.remove();
continue;
}
try {
Expand Down

0 comments on commit 091bdb8

Please sign in to comment.