public void createGraph(){
        Scanner console = new Scanner(System.in);

        String fileName;

        if (gSize != 0)
            clearGraph();

        Scanner infile = null;

        try{
            System.out.print("Enter input file name: ");
            fileName = console.nextLine();
            System.out.println();

            infile = new Scanner(new FileReader(fileName));
        }
        catch (FileNotFoundException fnfe){
            System.out.println(fnfe.toString());
            System.exit(0);
        }

        gSize = infile.nextInt(); //get the number of vertices

        for (int index = 0; index < gSize; index++){
            int vertex = infile.nextInt();
            int adjacentVertex = infile.nextInt();

            while (adjacentVertex != -999){
                graph[vertex].insertLast(adjacentVertex);
                adjacentVertex = infile.nextInt();
            }
        } 
    }