@Override
	public Matrix read(String file) throws IOException {
		
		FlexCompColMatrix matrix = null;
		BufferedReader br = null;

		try {
			br = new BufferedReader(new FileReader(file));
			String l = null;
			int i = 0;
			int j = 0;			

			while ((l = br.readLine()) != null) {

				if (i == 0) {
					int length = Integer.parseInt(l);
					matrix = new FlexCompColMatrix(length, length);					
				} else {
					double valuesNumber = getNumberOfValues(l, i);
					while (j < l.length()) {
						int indexColumn = l.indexOf(":", j);
						int indexSpace = l.indexOf(" ", j);
						int position = Integer.parseInt(l.substring(j,
								indexColumn));
						if (position == i - 1) { //check if the link is not inner link
							if (indexSpace == -1) 
								break;
							j = (indexSpace + 1);
							continue;
						}						
						matrix.set(i - 1, position, 1 / valuesNumber); //writing value to matrix position						
						if (indexSpace == -1)
							break;
						j = (indexSpace + 1);
					}
					j = 0;
				}
				i++;
			}

		} finally {
			if (br != null)
				br.close();
		}

		return matrix;
	}