GraphStream Users

Archives de la liste Aide


Re: Create graph with multiple links between two nodes from dot file


Chronologique Discussions 
  • From: Chris Saltmarsh <indy.maturin AT gmail.com>
  • To: graphstream-users AT litislab.fr, Yoann Pigné <yoann.pigne AT gmail.com>
  • Cc: LAVELLE Sylvain <sylvain.lavelle AT akka.eu>
  • Subject: Re: Create graph with multiple links between two nodes from dot file
  • Date: Wed, 23 Feb 2022 17:05:00 +0000
  • Authentication-results: a-mx1.relay.syrhano.net; spf=Pass smtp.mailfrom=indy.maturin AT gmail.com; spf=None smtp.helo=postmaster AT mail-oi1-f169.google.com
  • Ironport-data: A9a23:K+/pwK/P8Re1kpy9bZwCDrUD0X+TJUtcMsCJ2 f8bNWPcYEJGY0x3nDAfD2+Ca6zZYmeje94jO43kpBkD75OHndMxHFY4qnoxF iIbosfsO4+Ufxz6V8+wwmIvb67GA/3z3bAsFehsJpPnjkrrYuiJQUVUj/nSH OKmUrWcYEideCc9IMsfoUM78wIGqtQ16TSJK1vlVeLa+6UzCnf8s9JHGjh8B 5a4lf9alK+aVAX0EbAJTasjUFf2zxH5BX+ETE27ByOQroJ8RoZWSwtfpYxV8 F81/z91Yj+kurPyc0lPRb+LeAbX1CsQVK+ljRxP4Cc1187XNtJGMRYR22jPx o4ujowT5PRcSi9xVkHIsOUbXwgeFihiILdH/pfIJHG+tYqYyEiun37En6o1U hpqYNVwFuFfWDkSr5T0MgslYQqKn+Kt3Ki2Q+wpm98uNtLDOIIDu2pkxDufA +xOfHxpa7GSsIUegyNp05gIReKEMpJfMmoxMgCbNkUJZ0NIXbsguMytolLjV xFYjHOcg5A3x1LT6jZq9oLzFObNXuCQYdEMxhPA4jrSl4jiKhQTNdjazjvct 3z12L6JkiT8V4YfUra/85ZXbJSo7jR7IHUruZGT8JFVS3JSWu6z72QR8ysq6 K8zrQmlF4esGRK/p3GAs1gXXN84/yjWLu2S4vK83upbLjBsov19hBgOu8o/R Dhs3ViM9z8sLSI6q6WbEBpx6Z/NxQ6P1fApEFI/
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FUMmoc7t0TmUGzgi YVE2yFBdBUcJlqGl9S7YQmfZqClS67l0xL01240opKOdrz5XseXdyaFzeenJ OcnrRYbkVt7zMgDtcgNVPdbe6O1ARW37JuBX1cvOgiwiY4LEf1b0YUTESKGR 6qJaeXIvFuB96Q0MvOMbYkS/jDwN6pt4fmmlnI/lVIHGMvhlZIKdHC1GOhnK ESFcDLthNkGC2IDogs5SqTjllSDVTdZY3v6Ubg743k3D4evDIGLQY7I4vTJx CCgAphffXxLEHiJGHbsMoKFArICMXzDZMBmlTMAWP6qTIpgnRCiuQnmyqZ2e +rZ/ipL0PCrnNNx5uDViVQz7WkuV5XbgzzLFj8r2DpWFmx+xq10rE1jx03W2 O19k6UeD9FX7uIPSRYgNZfayKp8BsyhP2CJNtqPVluiRc2rRD8rSddkid4Ib 1c7Hty+kwrC2QKlBrYUk/qAA5l+oce+lzDhYt1wzXrLzvxrl149Xs5GLnGrn IZ6/gnXQonIygCXzvj7M6sb2yHJ+SGIym/E7yQ6GEZgFK7CW34YfE7fq9/0s 1jaQYipD7A2WuOu4cGHI6pOLNbuiAcfLB8CENHXYmb0nGbpQBjRmOLKY43td GEQmi7aDRpc+z0=
  • Ironport-sdr: sZJDhoLeAInlfpzPbWRYtWADCpRUCp32/Lt73/569a5eCRoZp6cOhovyq0bZK/rbPgDiMwlGBV RFRx+XohnUCg769Ux1HQEOM13MwgjpdRE=

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 Saltmarsh


On Wed, 23 Feb 2022 at 11:35, Yoann Pigné <yoann.pigne AT 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 :

*********
DGS004
example 2 2
an a
an b 
ae e1 a > b
ae e2 a > b 
*********


Sincerely,

Yoann 

Le 23 févr. 2022 à 09:23, LAVELLE Sylvain <sylvain.lavelle AT 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.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
****************************
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 AT akka.eu
www.akka-technologies.com




Archives gérées par MHonArc 2.6.16.

Top of page