in cassovary-examples/src/main/scala/MemoryMappedDirectedGraphExample.scala [26:50]
def main(args: Array[String]): Unit = {
var startTime = System.currentTimeMillis()
val graphName = args(1)
if (args(0) == "readAdj") {
val graph = readGraph(graphName)
val testNodeId = graph.head.id
println(s"outneighbors of node $testNodeId: " +
graph.getNodeById(testNodeId).get.outboundNodes())
val loadTime = (System.currentTimeMillis() - startTime) / 1000.0
println(s"Time to read adj graph: $loadTime seconds")
val binaryFileName = graphName.substring(0, graphName.lastIndexOf(".")) + ".dat"
startTime = System.currentTimeMillis()
MemoryMappedDirectedGraph.graphToFile(graph, new File( binaryFileName))
val writeTime = (System.currentTimeMillis() - startTime) / 1000.0
println(s"Time to write binary graph: $writeTime")
} else if (args(0) == "readBin") {
val graph = new MemoryMappedDirectedGraph(new File(graphName))
val testNodeId = graph.head.id
println(s"outneighbors of node $testNodeId: " +
graph.getNodeById(testNodeId).get.outboundNodes())
val loadTime = (System.currentTimeMillis() - startTime) / 1000.0
println(s"Time to read binary graph: $loadTime seconds")
}
}