import java.util.*; // An Algorithm for Identifying Strongly Connected Components // Programmed by Sung public class SCComponent { Stack stk; int c; public SCComponent() { stk =new Stack(); c=1; } //compares a and b and returns smaller item int min(int a, int b) { if(a e,g,b V[1].setOuts(V[5]); V[1].setOuts(V[7]); V[1].setOuts(V[2]); //b->g V[2].setOuts(V[7]); //c->b,i,j,d V[3].setOuts(V[2]); V[3].setOuts(V[9]); V[3].setOuts(V[10]); V[3].setOuts(V[4]); //d->j V[4].setOuts(V[10]); //e->f V[5].setOuts(V[6]); //f->e,a V[6].setOuts(V[5]); V[6].setOuts(V[1]); //g->f,c V[7].setOuts(V[6]); V[7].setOuts(V[3]); //h->c,g V[8].setOuts(V[3]); V[8].setOuts(V[7]); //i->h,j V[9].setOuts(V[8]); V[9].setOuts(V[10]); //j-> Nothing ///////////////////////////////////////////////// // GRAPH LOADING END ///////////////////////////////////////////////// //Check if the graph is correctly loaded for (int i=1;i<=numVertex;i++) { System.out.print(V[i].getName()+"=>"); for (int j=1;j<=V[i].getOutsNum();j++) { System.out.print(V[i].getOuts(j).getName()+","); } System.out.println(); } // First Vertex to visit is "c" Vertex v=V[3]; //mark all v unvisitied //It's already done by creating an object sc of class SCComponent //while there is an "unvisited" v do CONNECT(v); sc.connect(v); int i=0; while(i