How can I get off this mailing list?On Feb 23, 2022, at 12:05 PM, Chris Saltmarsh <indy.maturin@gmail.com> wrote:I had a similar thing - translating from a sort of xml which describes PetriNet graphs and thence to a more compressed json equivalent.<xmlIsNotReallyForHumanBeingsAsItsTooVerbose>true</xmlIsNotReallyForHumanBeingsAsItsTooVerbose>I did the json parser in java, anyway, so went direct to GraphStream rather than through DGS. Works a treat.Chris SaltmarshOn Wed, 23 Feb 2022 at 11:35, Yoann Pigné <yoann.pigne@gmail.com> wrote:Hi,Short answer : the DOT reader in GraphStream kind of only supports single graphs.There is no simple solution to the problem other than a rework of the DOT parser in GS.Can I suggest you use a file format where GS can safely handle multigraphs like the DGS :*********DGS004example 2 2an aan bae e1 a > bae e2 a > b*********Sincerely,Yoann
Le 23 févr. 2022 à 09:23, LAVELLE Sylvain <sylvain.lavelle@akka.eu> a écrit :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.0gs-core-2.0.jarHere 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****************************There is nothing special in the code, it is almost what is shown in the tutorial (https://graphstream-project.org/doc/Tutorials/Reading-files-using-FileSource/)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,Sylvain LAVELLE
Engineer
<image001.png>
7, boulevard Henri Ziegler — 31700 Blagnac — France
sylvain.lavelle@akka.eu
www.akka-technologies.com
Archives gérées par MHonArc 2.6.16.