package algorithm.graph;
import java.util.LinkedList;
/**
* The type Separate component.
*/
public class separateComponent {
/**
* Separate components boolean.
*
* @param graph the graph
* @param source the source
* @param destination the destination
* @return the boolean
*/
public static boolean separateComponents(Graph graph,int source,int destination){
graph.getAdj()[source].remove(graph.getAdj()[source].indexOf(destination));
return !isConnected( graph);
}
/**
* Is connected boolean.
*
* @param graph the graph
* @return the boolean
*/
private static boolean isConnected(Graph graph) {
int vertices = graph.getVertices();
boolean[] visited = new boolean[vertices];
graph.dfsTraversal(0,visited);
for(int i=0;i