public void parseInput(String file, int threads, int limit)
      throws FileNotFoundException, InterruptedException {
    // long startParseTime = System.currentTimeMillis();
    m_jgAdapter = new JGraphModelAdapter<Position, DefaultEdge>(graph);
    jgraph = new JGraph(m_jgAdapter);
    this.threads = threads;

    Scanner input = new Scanner(new File(file));
    try {
      for (int r = 0; input.hasNextLine() && r < limit; r++) {
        Scanner line = new Scanner(input.nextLine());
        try {

          ArrayList<Position> row = new ArrayList<Position>();
          grid.add(row);

          System.out.println("Row " + r);

          for (int c = 0; line.hasNextInt() && c < limit; c++) {
            Position position = new Position(r, c, line.nextInt());
            row.add(position);
            graph.addVertex(position);
            positionVertexAt(position, position.column * 5, position.row * 5);
          }
        } finally {
          line.close();
        }
      }
    } finally {
      input.close();
    }

    graphGrid(grid);

    // ArrayList<ArrayList<Position>> grid2 = transpose(grid);
    // outputGrid(grid2);

  }