我正在尝试使用GraphStream重现this example读取GEXF文件,但它给了我这个错误消息:
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)
这是我的代码:
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);
}
}
}
这是项目的层次结构:
我做错了什么?我该如何解决?
谢谢!