public static void BuildMapFile (LinkedList<Node> nList, char[][] map, int n) throws Exception {

		System.out.println ("Enter the input file name for graph with " + n + " nodes -");
		Scanner sIn = new Scanner (System.in);
		String filename = sIn.nextLine ();
		
		BufferedReader bIn = null;
	    int row = -1;
	    
        try {

        	bIn = new BufferedReader (new FileReader (filename));
            String line = bIn.readLine();
            
            while (line != null) {
            	row++;
            	String [] tokens = line.split(" ");
                for (int j = 0; j < tokens.length; j++)
                    map[row][j] = tokens[j].charAt(0);
            }
            
            if (row != n) {
            	System.out.println ("Incorrect matrix in file");
            	bIn.close();
            	return;
            }
        }
        catch (Exception ex) {
            System.out.println ("Error while reading from file");
        } 
        finally {
            if (bIn != null)
            	bIn.close();
        }
        
		for (int i = 0; i < n; i++ )
		{
			Node cNode = nList.get(i);
			Node[] pred = new Node[100];
			Node[] succ = new Node[100];
			int k = 0;
			
			for (int j = 0; j < n; j++ )
				switch(map[i][j])
				{
					case 'p': pred[k++] = nList.get(j);		
					case 's': succ[k++] = nList.get(j);
				}
			cNode.BuildPSList (pred, succ);
		}
    }