gexf4j-core
gexf4j-core copied to clipboard
Save/Write gexf - File
The Example you gave at http://gexf.net/gexf4j/ lead me to the question how do you save the gexf-File. I found StaxGraphWriter and added the following to get the demo saving the file. It might help if you could add such things to the demo to understand more easily.
At the end I added:
String gexfFileName = "C:/temp/graph.gexf";
StaxGraphWriter graphWriter = new StaxGraphWriter();
FileOutputStream out = null;
try {
out = new FileOutputStream(gexfFileName);
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
graphWriter.writeToStream(gexf, out);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
It should be new FileOutputStream(new File(gexfFileName));