[英]Graph Hierarchical Layout Algorithm
There are many tools and SDKs which layout a graph. 有许多工具和SDK可以布局图形。 ogdf, GraphViz, mxGraph, yEd...
ogdf,GraphViz,mxGraph,yEd ......
One of useful layouts is "Hierarchical Layout". 有用的布局之一是“分层布局”。 But there is no pure algorithm or pseudo code to describe it.
但是没有纯算法或伪代码来描述它。 Even, There is not a clear definition of this type of layout.
甚至,这种布局没有明确的定义。 Is anyone know about the algorithm?
有人知道算法吗?
(source: yworks.com ) (来源: yworks.com )
Simple hierarchical layout algorithm is visualisation of the ASAP sheduling algorithm (check this lecture [link] ), so it'd be better to read it, on my view. 简单的分层布局算法是ASAP调度算法的可视化(查看本讲座[链接] ),因此在我的观点上阅读它会更好。
BTW your picture is not fully correct - the proposed visualisation is only one of the possible ones. BTW你的图片不完全正确 - 建议的可视化只是其中一个可能的。
Imagine, that you have list of node and you know dependence between them. 想象一下,你有节点列表,你知道它们之间的依赖关系。
Node list 节点列表
node4
node2
node5
node1
node3
node6
Dependency list 依赖列表
node1 -> node2
node2 -> node4
node3 -> node5
node1 -> node3
node3 -> node6
And the same thing for the layer#2 and etc. Finally, you'll get: 对于#2等层也是如此。最后,你会得到:
node1 / \\ node2 node3 / / \\ node4 node5 node6
This will work only for non-cyclic directed graphs. 这仅适用于非循环有向图。 For the undirected ones you should modify the algorithm a bit (take random node as root), but the main idea, I think, is understandable.
对于无向的算法,你应该稍微修改算法(以随机节点为根),但我认为主要的想法是可以理解的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.