GraphStream を使用して 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);
}
}
}
これはプロジェクトの階層です:
私は何を間違えましたか?どうすれば修正できますか?
ありがとう!