/*  CSI2114 Lab 10 - lab10.java
 *  
 *  returns all nodes in a directed graph from "start_node" that can be reached using 
 *  no more than "depth" edges.  
 *
 *  Usage: java lab10 <graph_file> <start_node> <depth>
 *  
 *  by Jeff Souza 
 *
 */

import java.util.*;
import java.io.*;

public class lab10 {

	public static LinkedList ModDFS(Graph g, Vertex v, int depth, LinkedList s) {

		// INSERT YOUR CODE HERE	

	}


	public static void main(String[] args) {
		if (args.length == 3) { 
			Graph theGraph = new Graph( );
			try {
				FileReader fin = new FileReader( args[0] );
				BufferedReader graphFile = new BufferedReader( fin );

				// Read the edges and insert
				String line;
				while( ( line = graphFile.readLine( ) ) != null ) {
					StringTokenizer st = new StringTokenizer( line );
					try {
						if( st.countTokens( ) != 2 ) throw new Exception();
							String source  = st.nextToken( );
							String dest    = st.nextToken( );
							theGraph.addEdge( source, dest );
					}
					catch( Exception e ) {
						System.err.println("Incorrect input file at line " + line + ". Exiting." );
						System.exit(0);
					}
				}

				LinkedList s;
				Vertex start = theGraph.getVertex(args[1]);
				s = ModDFS(theGraph, start, Integer.parseInt(args[2]), new LinkedList());
				System.out.println("The nodes " + s.toString() + " can be reached from node " + start.toString() + " using no more than " + args[2] + " edges.");

			} catch( java.io.IOException e ) {
		         	System.err.println( e ); 
				System.exit(0);
			}
		} else { System.err.println("Usage: java lab10 <graph_file> <start_node> <depth>"); }

	}
}
