import java.util.ArrayList;
import java.util.LinkedList;
import java.util.Queue;
/**
*
* @author miqdad
*/
class Node{
int value;
int index; // represent index of node
boolean isVisited;
ArrayList neighbor;
public Node(int index, int value){
this.index = index;
this.value = value;
this.neighbor = new ArrayList();
this.isVisited = false;
}
public void addNeighbor(Node node){
this.neighbor.add(node);
}
}
class Graph{
int totalNode;
Node[] nodes;
public Graph(int totalNode){
this.totalNode = totalNode;
nodes = new Node[totalNode];
for(int i=0; i