GraphStream Users

Archives de la liste Aide


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


Chronologique Discussions 
  • From: Yoann Pigné <yoann.pigne AT gmail.com>
  • To: "graphstream-users AT litislab.fr" <graphstream-users AT litislab.fr>, 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 12:35:20 +0100
  • Authentication-results: a-mx1.relay.syrhano.net; spf=Pass smtp.mailfrom=yoann.pigne AT gmail.com; spf=None smtp.helo=postmaster AT mail-wm1-f41.google.com
  • Ironport-data: A9a23:vNFnFqDdAArVEhVW/2/iw5YqxClBgxIJ4kV8j S/XYbTApGx21jwCxzEWCm6HbvjcZ2X8ctFxOdy08EgD7J+Ey4JrTANkpHpgZ kwRpJueD7x1DKtf0wB+jyH7ofUOA/w2MrEsF+hpCC+MzvuRGuK59yMkj/vTH uOU5NPsY0ideyc1EE/Ntjo5xobVsqYw6TSIK1vlVeHa+qUzC3f/s9JACV/43 orYwP9ZUFsejxtD1rA2TagjUFYzDBD5BrpHTU26ByOQroW5goeHq+j/ILGRp gs1/j8oA9Kh16n+KwgEHueUMg+JhX5bHaOlh3CupARoivd9ZKdaMB0HzWnQ9 zxy4I0lWZiYWAAgOKuKgOUSVRRwHCR3PKkA87jCSZS6mZDMlBGXIiG3qxlpJ BhuYddwFvxMKW5U/OQYMywXYxmGwv+tzaigYu1tmsU4KMDheo0F0kyMZxnNV aN8B8/XGvCSo4dMhmJowJofTK/KPJ9BL2d7M0HpfTlkP3M7CLYflcGTg3XDa RlmqXeB/PJiuyyL2GSdy5DoOdvRP8OPHIBbwh/eqWXB8GD0RBodMbSiJfO+2 irErofycenTAer+1YFU98KGRHWWz20XTQITDB61/aD/hUm5VNZSbUcT/0LCa ET0GFODFrHAs9+Q+BZofSLwn/JfFuQ77EeGza+8D8OxGD0fVjAYADA5nJZee AHGDmO0ou4=
  • Ironport-hdrordr: A9a23:+fKOKKnTfqbimnv0Re1a8Axd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BzCVBdBQdP0vZx4nxZwOUeKG+Xar52g781m8snq+jXPWpA42RfCKazvG8L fAkuhQakE1qnJhe/84GUOhfZqioCwmq7pqASUZoexq9x+KtYDlk/qUZX2/HQ qbcNbOL90WF4us+ZfKdfo8cvjG7LfU5tbboijcilFkRcLPMv9NfYW2kHvlgP 0SSYGb9ytYHH2AQuwMiTevswFScWD9Xbny2Uuoy/DY+QI6hCI7CQMiqjtnjl G+jGYZKY2ldFl2WOXLhdoHBRPJVLSzOe4lulTsLUbXnQIgklFmvuAL817t7P 7/U9ykf5veBnJB+4+zekw139CQhVZzMlTHQCTguziVUHmx+xq10rE1jx03W2 O19k6UeD9FX7uIPSRYgNZfayKp8BsyhP2CJNtqPVluiRc2rRD8rSddkic4Ja kB7Xc2jgRbO9yWvCr4R0beMAdZnl8CUl2i0PMt7x3vcgeM5iEI6R8JUKWC8r qt29gyWGIuQ1kvFzuClcqMT2COL/2CGhznr3gkQQEt7VqPLWmoab03doIHi/ k31SLmqGNzP0yNEwM+Gb7RPM5jn0QwAS/DkN9DTJWm2njXobf5n7ryJZYvuP W4a2XeEYHU=
  • Ironport-sdr: 3ykrVrxywYHVI+5/NOC/fCLIacFQDM8sns+gC1UpBSnqvvTq9Z51RLKe+e4r+O8RIwAwg3irvJ /VxhPL/1cTfBHXWsNWRvyNh6zfET9NXyY=

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