Open LancelotHolmes opened 6 years ago
Hey have you found the solution for csv export . Thanks in adavance
Here is what I came up with to start with. In my case I wanted to dump PageRank. I probably need to clean this up.
ExportController ec = Lookup.getDefault().lookup(ExportController.class);
ExporterSpreadsheet.ExportTable currentTable = ExporterSpreadsheet.ExportTable.NODES;
for (GraphFileExporterBuilder builder : Lookup.getDefault().lookupAll(GraphFileExporterBuilder.class)) {
if (builder.getName().toLowerCase().startsWith("spreadsheet")) {
GraphExporter exporter = builder.buildExporter();
((ExporterSpreadsheet) exporter).setTableToExport(currentTable);
try {
ec.exportFile(new File("ranking.csv"), exporter);
} catch (IOException ex) {
ex.printStackTrace();
return;
}
}
}
Here is what I came up with to start with. In my case I wanted to dump PageRank. I probably need to clean this up.
ExportController ec = Lookup.getDefault().lookup(ExportController.class); ExporterSpreadsheet.ExportTable currentTable = ExporterSpreadsheet.ExportTable.NODES; for (GraphFileExporterBuilder builder : Lookup.getDefault().lookupAll(GraphFileExporterBuilder.class)) { if (builder.getName().toLowerCase().startsWith("spreadsheet")) { GraphExporter exporter = builder.buildExporter(); ((ExporterSpreadsheet) exporter).setTableToExport(currentTable); try { ec.exportFile(new File("ranking.csv"), exporter); } catch (IOException ex) { ex.printStackTrace(); return; } } }
Thanks Matthew....it works ...you save my day :+1:
recently I'm trying to use gephi-toolkit to do some statistics for several networks,it works fine to import the csv file and do some metrics computation, but if I want to export the csv table like what I do below in the Gephi, I do not find any tutorials and there is not description in the javadoc.
since I want to do the same operations for different networks,I want to use gephi-toolkit to implement the same function,but I've checked the demos and google for it but failed to get the result I want.
To describe my question clearer,I post my current code below, now I've tried two methods, one is using the methods of ExporterCSV which only returned me with the matrix in csv file format while what I want is a node csv file and an edge csv file after computing several metrics like betweenness centrality, closeness centrality and so on for each node of each network. And the other method I've tried is using DataTableControllerImpl but it seems that no files has been created, I want to know if there is something wrong with my code, any help is appreciated.