diff --git a/src/org/openstreetmap/josm/data/validation/tests/CycleDetector.java b/src/org/openstreetmap/josm/data/validation/tests/CycleDetector.java index 450a3be5f6c..e22590e8952 100644 --- a/src/org/openstreetmap/josm/data/validation/tests/CycleDetector.java +++ b/src/org/openstreetmap/josm/data/validation/tests/CycleDetector.java @@ -84,6 +84,11 @@ public void endTest() { Tarjan tarjan = new Tarjan(nodeGraph); Collection> scc = tarjan.getSCC(); + // for partial selection, we need to manually add the rest of graph members to the lookup object + if (partialSelection) { + quadBuckets.addAll(graph); + } + for (List possibleCycle : scc) { // there is a cycle in the graph if a strongly connected component has more than one node if (possibleCycle.size() > 1) { @@ -93,8 +98,7 @@ public void endTest() { // find ways within this bbox List waysWithinErrorBbox = quadBuckets.search(bBox); List toReport = waysWithinErrorBbox.stream() - .filter(w -> possibleCycle.stream() - .anyMatch(w.getNodes()::contains)) + .filter(w -> possibleCycle.stream().filter(w.getNodes()::contains).count() > 1) .collect(Collectors.toList()); Map> graphMap = tarjan.getGraphMap();