public void read(Scanner input) {
        emptyGraph();
        checking = true;
        try {
            String line = input.nextLine();
            if (!line.equals(version)) {
                throw new ParseException(line, -1);
            }
            GraphType loadedType = GraphType.valueOf(input.nextLine());
            int n = Integer.parseInt(input.next()), m = Integer.parseInt(input.next());
            for (int i = 0; i < n; i++) {
                double x = Double.parseDouble(input.next()), y = Double.parseDouble(input.next());
                int ID = Integer.parseInt(input.next());
                vertices.add(new Vertex(x, y, ID));
            }
            for (int i = 0; i < m; i++) {
                int f = Integer.parseInt(input.next()), t = Integer.parseInt(input.next());
                createEdge(vertices.get(f), vertices.get(t));
            }
            type = loadedType;
        } catch (Exception e) {
            System.err.println("Exception while loading graph");
            e.printStackTrace();
            emptyGraph();
        }
        checking = false;
        edited();
        fitToScreen();
        GUI.gRepaint();
    }