Hello graphstream users,
I have a question for the community. Here is my issue:
I need to create a directed graph object from a dot file. This works, but when there are two edges from one node to the same node, only one edge is created in the graph.
I am not sure if I am using the graphstream library correctly, or if the dot file is incorrect.
Graphstream version: 2.0
gs-core-2.0.jar
Here is an example of dot file:
*************
digraph G {
1->2;
1->2;
}
***********
From what I read of dot specification, this is valid (and some visualization tools like graphviz will draw two nodes with to edges from 1 to 2)
To create the graph, I use the following java code:
import org.graphstream.graph.Edge;
import org.graphstream.graph.implementations.MultiGraph;
import org.graphstream.stream.file.FileSource;
import org.graphstream.stream.file.FileSourceFactory;
/* …. */
MultiGraph g = new MultiGraph("g",false, true); // graph id, strictChecking, autoCreate
FileSource fs = FileSourceFactory.sourceFor(filePath);
fs.addSink(g);
try {
fs.readAll(filePath);
} catch( IOException e) {
e.printStackTrace();
} finally {
fs.removeSink(g);
}
//check how many connections:
System.out.println("number of edges: "+g.edges().count());
// print out: number of edges: 1
****************************
Can someone tell me what I should modify? Is it the graph creation? Using another type of graph or other parameters?
Should I modify the dot file?
Have a nice day,