Skip to content

Commit

Permalink
Partial selection: add all affected ways to TestError
Browse files Browse the repository at this point in the history
  • Loading branch information
gabortim committed Jan 15, 2024
1 parent b8d68da commit 41c3e42
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ public void endTest() {
Tarjan tarjan = new Tarjan(nodeGraph);
Collection<List<Node>> 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<Node> possibleCycle : scc) {
// there is a cycle in the graph if a strongly connected component has more than one node
if (possibleCycle.size() > 1) {
Expand All @@ -93,8 +98,7 @@ public void endTest() {
// find ways within this bbox
List<Way> waysWithinErrorBbox = quadBuckets.search(bBox);
List<Way> 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<Node, List<Node>> graphMap = tarjan.getGraphMap();
Expand Down

0 comments on commit 41c3e42

Please sign in to comment.