/** * Print network and network statistics to file. * * @param outputDir location to write files to * @param summary whether to print network statistics as well as the network itself */ public void printNetwork(String outputDir, boolean summary) { try { PrintWriter pw = new PrintWriter(outputDir + "/network.txt"); pw.print(this); pw.close(); if (summary) { pw = new PrintWriter(outputDir + "/transitivity.txt"); pw.print(getTransitivity()); pw.close(); Arrays.printToFile(getGeodesicDistances(), outputDir + "/geodesic-distances.txt"); Arrays.printToFile(getVertexInwardConnectedness(), outputDir + "/inward-connectedness.txt"); Arrays.printToFile( getVertexOutwardConnectedness(), outputDir + "/outward-connectedness.txt"); Arrays.printToFile(getVertexInDegrees(), outputDir + "/in-degree.txt"); Arrays.printToFile(getVertexOutDegrees(), outputDir + "/out-degree.txt"); } } catch (IOException e) { e.printStackTrace(); System.exit(-1); } }