public DirectedGraph<T> findCycleSubgraph(DirectedGraph<T> graph) { DirectedGraph<T> subGraph = new DirectedGraphImpl<>(); for (Edge<T> edge : graph.getEdges()) { if (isPath(graph, edge.getSink(), edge.getSource())) { subGraph.add(edge); } } return subGraph; }
public DirectedGraph<T> findCycleSubgraph(DirectedGraph<T> graph) { DirectedGraph<T> subGraph = new DirectedGraphImpl<>(); for (Edge<T> edge : graph.getEdges()) { if (isPath(graph, edge.getSink(), edge.getSource())) { subGraph.add(edge); } } return subGraph; }
public DirectedGraph<T> findCycleSubgraph(DirectedGraph<T> graph) { DirectedGraph<T> subGraph = new DirectedGraphImpl<T>(); for (Edge<T> edge : graph.getEdges()) { if (isPath(graph, edge.getSink(), edge.getSource())) { subGraph.add(edge); } } return subGraph; }