@Test public void twoUnconnectedCluster() { graph = new AdjacencyListsGraph<>(vertexes(), of(new TestEdge(A, B, 1), new TestEdge(B, C, 1), new TestEdge(C, D, 1), new TestEdge(D, A, 1), new TestEdge(E, F, 1), new TestEdge(F, G, 1), new TestEdge(G, H, 1), new TestEdge(H, E, 1))); TarjanGraphSearch<TestVertex, TestEdge> gs = new TarjanGraphSearch<>(); SccResult<TestVertex, TestEdge> result = gs.search(graph, null); validate(result, 2); validate(result, 0, 4, 4); validate(result, 1, 4, 4); }
@Override public SccResult<V, E> search(Graph<V, E> graph, EdgeWeight<V, E> weight) { SccResult<V, E> result = new SccResult<>(graph); for (V vertex : graph.getVertexes()) { VertexData data = result.data(vertex); if (data == null) { connect(graph, vertex, weight, result); } } return result.build(); }
TarjanGraphSearch implements GraphSearch<V, E> { @Override public SccResult<V, E> search(Graph<V, E> graph, EdgeWeight<V, E> weight) { SccResult<V, E> result = new SccResult<>(graph); for (V vertex : graph.getVertexes()) { VertexData data = result.data(vertex); if (data == null) { connect(graph, vertex, weight, result); } } return result.build(); } }
TarjanGraphSearch implements GraphSearch<V, E> { @Override public SccResult<V, E> search(Graph<V, E> graph, EdgeWeight<V, E> weight) { SccResult<V, E> result = new SccResult<>(graph); for (V vertex : graph.getVertexes()) { VertexData data = result.data(vertex); if (data == null) { connect(graph, vertex, weight, result); } } return result.build(); }  }
TarjanGraphSearch implements GraphSearch<V, E> { @Override public SccResult<V, E> search(Graph<V, E> graph, EdgeWeight<V, E> weight) { SccResult<V, E> result = new SccResult<>(graph); for (V vertex : graph.getVertexes()) { VertexData data = result.data(vertex); if (data == null) { connect(graph, vertex, weight, result); } } return result.build(); }  @Override SccResult<V, E> search(Graph<V, E> graph, EdgeWeight<V, E> weight); }
TarjanGraphSearch implements GraphSearch<V, E> { @Override public SccResult<V, E> search(Graph<V, E> graph, EdgeWeight<V, E> weight) { SccResult<V, E> result = new SccResult<>(graph); for (V vertex : graph.getVertexes()) { VertexData data = result.data(vertex); if (data == null) { connect(graph, vertex, weight, result); } } return result.build(); }  @Override SccResult<V, E> search(Graph<V, E> graph, EdgeWeight<V, E> weight);  }