Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Directed edges in sigma.js - a minimal example

Question

What is necessary to produce directed edges in sigma.js? I'm looking for a minimal example that is preferably based off of the minimal example currently on their home page.

Attempts

I tried adapting the minimal graph example from the sigma.js homepage in the following way

  sigma.parsers.json('data.json', {     container: 'container',     settings: {       defaultNodeColor: '#ec5148', +     defaultEdgeArrow: 'source'  // adding this line should add arrows?     }   }); 

Sadly this did not produce different results.

I also tried modifying the edges in the graph itself

"edges": [  {     "id": "e0",     "source": "n0",     "target": "n1", +   "arrow": "source"  },  ...,  ] 

But again this had no effect.

More complex examples

Edge arrow rendering was added in this pull request. This links to a couple of examples here and here

like image 850
MRocklin Avatar asked Feb 18 '14 00:02

MRocklin


People also ask

What is sigma js?

Sigma. js is a modern JavaScript library for rendering and interacting with network graphs in the browser. It works in symbiosis with graphology, a multipurpose graph manipulation library.

Is Sigma js open source?

Sigma. js is an open-source JavaScript library aimed at visualizing graphs of thousands of nodes and edges, mainly developed by @jacomyal and @Yomguithereal.


1 Answers

I've been struggling with this issue myself. It looks like sigma.js underwent a major redesign in the last few months and the code from the examples is from an older version of sigma.js.

They do have the ability to render arrows, but the settings to generate these have changed and some of the options were lost (no longer can you specify target, source, or both; you only can use target):

"edges": [ {     "id": "e0",     "source": "n0",     "target": "n1", +    "type": "arrow", }, ..., ] 

"curvedArrow" is also a valid option for type.

See this issue transcript: https://github.com/jacomyal/sigma.js/pull/219 for more information.

like image 54
Charlotte Avatar answered Sep 24 '22 03:09

Charlotte