public static Graph readFromInputFile(String fileName) {
		BufferedReader bufferedReader = null;

		Graph userInputGraph;
		try {
			String currLine;

			bufferedReader = new BufferedReader(new FileReader(fileName));
			int lineNumber = 0;
			int vertices   = 0;
			int edges      = 0;
			int vertice1   = 0;
			int vertice2   = 0;
			int userEdges  = 0;
			int cost       = 0;
			userInputGraph = new Graph(9);
			while ((currLine = bufferedReader.readLine()) != null) {
				String[] arr = currLine.split("\\s+");
				if (lineNumber == 0) {
					if(arr.length > 2)
						throw  new IOException("Format Incorrect");
					vertices = Integer.parseInt(arr[0]);
					edges    = Integer.parseInt(arr[1]);
					
				}else {
					if(arr.length > 3)
						throw new IOException("Format incorrect");
					else {
						if(lineNumber == 1)	
							userInputGraph = new Graph(vertices);
						if(userEdges > edges){
							throw new IOException("Exceeded the maximum edges limit");
						}else{
							vertice1 = Integer.parseInt(arr[0]);
							vertice2 = Integer.parseInt(arr[1]);	
							cost     = Integer.parseInt(arr[2]);
							if(((Graph)userInputGraph).getCost(vertice1, vertice2) <= 0)
								userInputGraph.addEdge(vertice1, vertice2, cost);
							else
								throw  new IOException(vertice1 + "," + vertice2 + " is mentioned more than once");
								
						}
						userEdges++;
					}
				}
				lineNumber++;
			}
		return userInputGraph;	
		} catch(IOException e) {
			e.printStackTrace();
		}
		return null;
	}