*/
@Override public Graph<Edge> readUndirectedFromWeighted(
File f, Indexer<String> vertexIndexer, double minWeight) throws IOException {
BufferedReader br = new BufferedReader(new FileReader(f));
Graph<Edge> g = new SparseUndirectedGraph();
int lineNo = 0;
for (String line = null; (line = br.readLine()) != null; ) {
++lineNo;
line = line.trim();
if (line.startsWith("#"))
continue;
else if (line.length() == 0)
continue;
String[] arr = line.split("\\s+");
if (arr.length < 2)
throw new IOException("Missing vertex on line " + lineNo);
if (arr.length < 3)
throw new IOException("Missing edge weight on line " + lineNo);
int v1 = vertexIndexer.index(arr[0]);
int v2 = vertexIndexer.index(arr[1]);
double weight = Double.parseDouble(arr[2]);
if (weight >= minWeight)
g.add(new SimpleEdge(v1, v2));
if (lineNo % 100000 == 0)
veryVerbose(LOGGER, "Read %d lines from %s", lineNo, f);
}
verbose(LOGGER, "Read directed graph with %d vertices and %d edges",
g.order(), g.size());
return g;
}