public static void main(String args[]){
		BufferedReader br = null;
		try{
			String cLine[];
			br = new BufferedReader(new FileReader("graph.txt"));
			int nodeNum = Integer.parseInt(br.readLine());
			int edgeNum = Integer.parseInt(br.readLine());
			//Initialize the vertices
			for(int i = 0;i < nodeNum;i++){
				edges.add(new ArrayList<Integer>());
				reversedEdges.add(new ArrayList<Integer>());
			}
			//Verify our amounts are correct
			System.out.println("We have " + nodeNum + " vertices and " + edgeNum + " edges");
			//Read in the edges and put them into the array
			for(int i = 0;i < edgeNum;i++){
				String line = br.readLine();
				//line = line.substring(1);
				//System.out.println(line);
				cLine = line.split("\\s+");
				int n1 = Integer.parseInt(cLine[0]);
				int n2 = Integer.parseInt(cLine[1]);
				//Add the newly created edge to edges and reversedEdges
				edges.get(n1).add(n2);
				reversedEdges.get(n2).add(n1);
				//System.out.println("Reading in line "+i);
			}
			//Run Depth First Order in numerical order on the reversed digraph
			for(int i = 0;i < nodeNum;i++){
				depthFirstOrder(i);
			}
			//Reverse the node ordering ArrayList Obtained
			Collections.reverse(nodeOrdering);
			//for(int i:nodeOrdering){System.out.print(i+" ");}
			System.out.println("");
			//Clear visited since it will be used again for DFS
			visitedNodes.clear();
			int count = 1;
			//Now we can DFS based on the Reverse Post Order of the Reversed Di-Graph
			for(int i:nodeOrdering){
				//Don't want to redo a kernel that we've already visited so we need to make sure that
				//anything already visited won't be visited again
				if(!visitedNodes.contains(i)){
					//Call DFS from the next unchecked node in the reverse Post Order node list
					depthFirstSearch(i);
					System.out.print("Kernel #"+count+" contains nodes: ");
					for(int j:kernel){System.out.print(j+" ");}
					System.out.print("\n");
					count++;
					//Clear the kernel so we can build it again in the next iteration
					kernel.clear();
				}
			}
		}catch (IOException e){
			System.out.println("IO ERROR: Check Input and Program");
		}
	}