Directed, acyclic graph in d3.js

后端 未结 2 1363
有刺的猬
有刺的猬 2021-02-03 11:44

Is there a reliable way of drawing directed, acyclic graphs in D3.js today? I\'m trying to visualize prerequisites in a curriculum, similar to this.

I\'ve seen some olde

2条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-03 12:25

    Way late but perhaps relevant to others searching for similar information...

    Elkjs supports layered graph layout and appears to still be actively maintained at this time.

    Some suggested layout options based on the OP's usecase...

    layoutOptions: {
            'org.eclipse.elk.algorithm': 'layered',
            'org.eclipse.elk.direction' : 'DOWN',
            'org.eclipse.elk.edgeRouting': 'SPLINES',
            'org.eclipse.elk.layered.edgeRouting.sloppySplineRouting': false,
            'org.eclipse.elk.layered.layering.strategy': 'INTERACTIVE' }
    

    These options can be pasted into this interactive editor to see how the layout is affected.

提交回复
热议问题