public static Graph<Vertex, Edge<Vertex>> FileToGraph(String dat, boolean directed) {
    int[][] GArray = FileToGraphArray(dat);
    int n = GArray[0][0];
    int m = GArray[0][1];
    Graph<Vertex, Edge<Vertex>> G = new Graph(n);

    // Knoten hinzufuegen
    for (int i = 0; i < n; i++) {
      G.addVertex(new Vertex(i));
    }

    /* Kanten hinzufuegen */
    for (int i = 1; i <= m; i++) {
      int idxa = GArray[i][0];
      int idxb = GArray[i][1];
      Vertex a = G.getVertex(idxa);
      Vertex b = G.getVertex(idxb);
      G.addEdge(new Edge<Vertex>(a, b));
      if (!directed) {
        G.addEdge(new Edge<Vertex>(b, a));
      }
    }
    return G;
  }