code: public static Graph<String, Double> loadWeightedEdgeListFile(String path, int numVertices, String delim,
                      boolean directed, boolean allowMultipleEdges, String... ignoreLinesStartingWith)
                      throws IOException {
          Graph<String, Double> graph = new Graph<>(numVertices, allowMultipleEdges, new StringVertexFactory());
          EdgeLineProcessor<Double> lineProcessor =
                          new WeightedEdgeLineProcessor(delim, directed, ignoreLinesStartingWith);
  
          try (BufferedReader br = new BufferedReader(new FileReader(new File(path)))) {
              String line;
              while ((line = br.readLine()) != null) {
                  Edge<Double> edge = lineProcessor.processLine(line);
                  if (edge != null) {
                      graph.addEdge(edge);
                  }
              }
          }
          return graph;
      }
docs: Method for loading a weighted graph from an edge list file, where each edge (inc. weight) is represented by a
  single line. Graph may be directed or undirected<br>
  This method assumes that edges are of the format: {@code fromIndex<delim>toIndex<delim>edgeWeight} where {@code <delim>}
  is the delimiter.
  @param path Path to the edge list file
  @param numVertices The number of vertices in the graph
  @param delim The delimiter used in the file (typically: "," or " " etc)
  @param directed whether the edges should be treated as directed (true) or undirected (false)
  @param allowMultipleEdges If set to false, the graph will not allow multiple edges between any two vertices to exist. However,
  checking for duplicates during graph loading can be costly, so use allowMultipleEdges=true when
  possible.
  @param ignoreLinesStartingWith Starting characters for comment lines. May be null. For example: "//" or "#"
  @return The graph
  @throws IOException