Skip to content

Detect edges with control points that Cytoscape.js refuses to show, and manually reduce them to visible straight-line edges #360

@fedarko

Description

@fedarko

As discussed way way way back in cytoscape/cytoscape.js#1451.

It looks like reducing the quality of Graphviz layouts using nslimit / nslimit1 (in order to make layout go faster for tangled graphs) can increase the amount of edges with wacky control points, and thus increase the amount of edges Cytoscape.js rejects for being "invalid." (Case study: setting both of the nslimit parameters to 0.5 on aug1 cc1.) With default settings (nonrecursive dot layout, and default nslimits) this doesn't seem like a problem, but it is good to make this robust.

The following code (cobbled together from cy.js's docs) seems to work to detect and fix these edges after rendering:

cy.edges().forEach(function(e){
  if (e._private.rscratch.badLine) {
    e.removeClass("withctrlpts");
  }
});

Presumably this can just be run as a simple client-side callback immediately after drawing.

This will not be a panacea - moving nodes, or selecting things and causing borders / thicknesses to change (#276), can still cause edges to become invisible. We could ostensibly rerun this callback after each selection operation but that might be overkill and/or too slow for large graphs.

  • on graph draw
  • (ambitious): on selecting / moving things???

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugexternalBugs / issues with other libraries/dependencieslayoutgraph drawing / layoutperformancerefactoringstyleCSS / graph styling

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions