I am trying to reproduce this example of reading a GEXF file using GraphStream, but it gave me this error message :
Exception in thread "main" java.io.IOException: not a regular file 'sources\small-world-1.gexf'
at org.graphstream.stream.file.FileSourceFactory.sourceFor(FileSourceFactory.java:83)
at pack.age.Main.main(Main.java:15)
This is my code :
public class Main {
public static void main(String[] args) throws IOException {
String filePath = "sources\\small-world-1.gexf";
Graph g = new SingleGraph("g");
FileSource fs = FileSourceFactory.sourceFor(filePath);
fs.addSink(g);
try {
fs.begin(filePath);
while (fs.nextEvents()) {
// Optionally some code here ...
}
} catch( IOException e) {
e.printStackTrace();
}
try {
fs.end();
} catch( IOException e) {
e.printStackTrace();
} finally {
fs.removeSink(g);
}
}
}
This is the project's hierarchy :
What did I do wrong ? And how can I fix it ?
Thanks!