Drawing Directed Acyclic Graphs: Minimizing edge crossing?

前端 未结 2 1409
醉酒成梦
醉酒成梦 2020-12-25 15:12

Laying out the verticies in a DAG in a tree form (i.e. verticies with no in-edges on top, verticies dependent only on those on the next level, etc.) is rather simple without

2条回答
  •  执念已碎
    2020-12-25 15:49

    You could try using Topological Sorting. In a first step you can determine the levels (top to bottom) of the layout by performing a topological sort and always grouping independent nodes in a single layer. This will always succeed for directed acyclic graphs.

    Then you could maybe try to perform a topological sort of each layer (left to right) taking the location of the input and output ports and probably adjacent layers into account. My image of this step is bit blurry but I can imagine that it is doable for graphs like your example.

提交回复
热议问题