private void assertNoCycles() { // Verify that the graph is acyclic. final CycleDetector<HepRelVertex, DefaultEdge> cycleDetector = new CycleDetector<>(graph); Set<HepRelVertex> cyclicVertices = cycleDetector.findCycles(); if (cyclicVertices.isEmpty()) { return; } throw new AssertionError("Query graph cycle detected in HepPlanner: " + cyclicVertices); }
private void assertNoCycles() { // Verify that the graph is acyclic. final CycleDetector<HepRelVertex, DefaultEdge> cycleDetector = new CycleDetector<>(graph); Set<HepRelVertex> cyclicVertices = cycleDetector.findCycles(); if (cyclicVertices.isEmpty()) { return; } throw new AssertionError("Query graph cycle detected in HepPlanner: " + cyclicVertices); }
assertThat(new CycleDetector<String, DefaultEdge>(graph).findCycles(), CoreMatchers.equalTo(ImmutableSet.of())); assertThat(new CycleDetector<String, DefaultEdge>(graph).findCycles(), CoreMatchers.equalTo( ImmutableSet.of("C", "D", "E", "F"))); assertThat(new CycleDetector<String, DefaultEdge>(graph).findCycles(), CoreMatchers.equalTo( ImmutableSet.of("C", "D", "E", "F"))); assertThat(new CycleDetector<String, DefaultEdge>(graph).findCycles(), CoreMatchers.equalTo( ImmutableSet.of("B", "C", "D"))); assertThat(new CycleDetector<String, DefaultEdge>(graph).findCycles(), CoreMatchers.equalTo( ImmutableSet.of("C", "D"))); assertThat(new CycleDetector<String, DefaultEdge>(graph).findCycles(), CoreMatchers.equalTo(ImmutableSet.of()));
assertThat(new CycleDetector<String, DefaultEdge>(graph).findCycles(), CoreMatchers.equalTo(ImmutableSet.of())); assertThat(new CycleDetector<String, DefaultEdge>(graph).findCycles(), CoreMatchers.equalTo( ImmutableSet.of("C", "D", "E", "F"))); assertThat(new CycleDetector<String, DefaultEdge>(graph).findCycles(), CoreMatchers.equalTo( ImmutableSet.of("C", "D", "E", "F"))); assertThat(new CycleDetector<String, DefaultEdge>(graph).findCycles(), CoreMatchers.equalTo( ImmutableSet.of("B", "C", "D"))); assertThat(new CycleDetector<String, DefaultEdge>(graph).findCycles(), CoreMatchers.equalTo( ImmutableSet.of("C", "D"))); assertThat(new CycleDetector<String, DefaultEdge>(graph).findCycles(), CoreMatchers.equalTo(ImmutableSet.of()));
final Set<TableRef> cycles = new CycleDetector<>(g).findCycles(); if (!cycles.isEmpty()) { return ImmutableList.of();