0

I moving my project from dagre-d3 to cytoscape.

Cytoscape.js is really more flexible and will allow more powerful control but for now, I just can't have the edge rendering as I want.

Here is the dagre-d3 version:
dagre-d3

Here is the actual cytoscape: cytoscape.js

As you can see, it's almost the same except :

  • cluster are not in the same order (not a big deal).
  • edge can overlap the whole graph.

The last one is my main issue, I just can't find a way to tell cytoscape to make edge as parallel as possible like dagre-d3.

I'll try to use segments edges (that seems the right edge type) but I can find a way to configure it. Also try taxi one but label are unreadable.

Here is a full example : https://jsfiddle.net/uqtahcfs/

{
    "elements": {
        "nodes": ...,
        "edges": ...,
    },
    "style": ...,
    layout: {
        name: "dagre",
        rankDir:  "LR",
        animate: false,
        fit: true,
        padding: 50,
        spacingFactor: 1.2,
    },
    pixelRatio: 1,
    minZoom: 0.2,
    maxZoom: 2
}

Any way to have segment that look like parallel ?

tchiot.ludo
  • 915
  • 1
  • 9
  • 20
  • Does this answer your question? [Avoid edge-node overlapping in cytoscape.js](https://stackoverflow.com/questions/28540158/avoid-edge-node-overlapping-in-cytoscape-js) – Stephan T. Dec 30 '20 at 14:15
  • Not really, I use dagre layout to avoid overlap that works mostly well, just the layout are just about placement of node as I understand, not the edge. I almost sure it's possible to tune the edge but I don't know how ... – tchiot.ludo Dec 30 '20 at 16:10
  • The author of cytoscape.js states (in the question i mentioned), that overlap calculation for edges is a non-trivial research problem in graph theory, where your options are limited to using a different layout, creating a better layout for your usecase or develop a function to prevent edge overlap. – Stephan T. Dec 31 '20 at 14:19
  • You could create your graph as a preset layout and render that. This only works if you have static data though – Stephan T. Dec 31 '20 at 14:20

0 Answers0