DependencyGraph implements IPipelineOrderer { public static <V, E> Set<V> removeLayer(Graph<V, E> graph) { Set<V> toRemove = new HashSet<>(); for (V v : graph.getVertices()) { if (graph.inDegree(v) == 0) { toRemove.add(v); } } for (V v : toRemove) graph.removeVertex(v); return toRemove; }  @Override List<AnalysisEngine> orderPipeline(List<AnalysisEngine> analysisEngines); static boolean overlaps(
      Set<Class<? extends Annotation>> s1, Set<Class<? extends Annotation>> s2); static void removeLoops(Graph<V, E> graph); static Set<V> removeLayer(Graph<V, E> graph);  }
@Test public void testRemoveLayer() { Graph<String, String> graph = new SparseMultigraph<>(); graph.addVertex("v1"); graph.addVertex("v2"); graph.addVertex("v3"); graph.addEdge("e1", "v1", "v2", EdgeType.DIRECTED); graph.addEdge("e2", "v2", "v1", EdgeType.DIRECTED); graph.addEdge("e3", "v3", "v2", EdgeType.DIRECTED); DependencyGraph.removeLayer(graph); assertEquals(2, graph.getVertexCount()); assertEquals(2, graph.getEdgeCount()); assertTrue(graph.getVertices().contains("v1")); assertTrue(graph.getVertices().contains("v2")); assertTrue(graph.getEdges().contains("e1")); assertTrue(graph.getEdges().contains("e2")); }