Parallel Edges and Self Loops

Once it's running
Post Reply [phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275: count(): Parameter must be an array or an object that implements Countable
bgarvey
Posts:1
Joined:10 Mar 2018 21:41
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275: count(): Parameter must be an array or an object that implements Countable
Parallel Edges and Self Loops

Post by bgarvey » 10 Mar 2018 22:26

I am using Gephi toolkit gephi-toolkit-0.9.2-all.jar in a standalone program which adds some attributes and writes the file out.
There are selfLoops and ParallelEdges in the graph. So I tried to set those functions to true last 2 lines in the following:

projectControllerA = Lookup.getDefault().lookup(ProjectController.class);
projectControllerA.newProject();
workspaceA = projectControllerA.getCurrentWorkspace();
importcontrollerA = Lookup.getDefault().lookup(ImportController.class);
graphModelA = Lookup.getDefault().lookup(GraphController.class).getGraphModel(workspaceA);
graphModelA.getNodeTable().addColumn("isPresented", boolean.class);
graphModelA.getEdgeTable().addColumn("isExpanded", boolean.class);
File inFileA = new File(inFileName);
container = importcontrollerA.importFile(inFileA);
container.getLoader().setAllowParallelEdge(true);
container.getLoader().setAllowSelfLoop(true);

The input file follows note there are 9 edges. The output file only has 7 edges no self loops or parallel edges.
Are these methods implemented?
If so, can someone show me what I need to do differently?
I put an attribute of kind="0.." after the target in the edge specification, and I then got all my edges.
It would seem to me that the id distinguishes the edge and to further uniquely identify should not be unnecessary.

<gexf xmlns="http://www.gexf.net/1.2draft" version="1.2">
<meta lastmodifieddate="20180312">
<creator>Bob Garvey</creator>
<description>The graph in the patent. Trying for parallel edges.</description>
</meta>
<graph mode="static" defaultedgetype="directed">
<nodes>
<node id="1" label="N2" />
<node id="0" label="N1" />
<node id="2" label="N3" />
<node id="3" label="N4" />
<node id="4" label="N5" />
<node id="5" label="N6" />
<node id="6" label="N7" />
</nodes>
<edges>
<edge id="0" source="0" target="1" />
<edge id="1" source="0" target="1" />
<edge id="2" source="0" target="2" />
<edge id="3" source="2" target="0" />
<edge id="4" source="1" target="3" />
<edge id="5" source="2" target="3" />
<edge id="6" source="3" target="3" />
<edge id="7" source="4" target="5" />
<edge id="8" source="3" target="3" />
</edges>
</graph>
</gexf>
Changes that then worked:
<edge id="0" source="0" target="1" kind="0"/>
<edge id="1" source="0" target="1" kind="1"/>........

User avatar
eduramiba
Gephi Code Manager
Posts:1064
Joined:22 Mar 2010 15:30
Location:Madrid, Spain
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275: count(): Parameter must be an array or an object that implements Countable

Re: Parallel Edges and Self Loops

Post by eduramiba » 11 Mar 2018 18:32

Hi,

Just like when importing in gephi a file, during import report you choose wether to merge parallel edges or not (merge strategy).
You should configure that in the container in your code too.

Post Reply
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275: count(): Parameter must be an array or an object that implements Countable
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275: count(): Parameter must be an array or an object that implements Countable