gpt4 book ai didi

graph - 如何使用 Dot 和 Graphviz 循环布局完整的图形?

转载 作者:行者123 更新时间:2023-12-05 01:44:25 24 4
gpt4 key购买 nike

如何在图中“循环”布置节点,类似于下图中的图:

enter image description here

最佳答案

Graphviz 提供 circo layout engine用于圆形布局。

circo draws graphs using a circular layout (see Six and Tollis, GD ’99 and ALENEX ’99, and Kaufmann and Wiese, GD ’02.) The tool identifies biconnected components and draws the nodes of the component on a circle. The block-cutpoint tree is then laid out using a recursive radial algorithm. Edge crossings within a circle are minimized by placing as many edges on the circle’s perimeter as possible. In particular, if the component is outerplanar, the component will have a planar layout. If a node belongs to multiple non-trivial biconnected components, the layout puts the node in one of them. By default, this is the first non-trivial component found in the search from the root component.

K3 的一个简单示例是:

graph K3 {
layout=circo;
node[shape=point, color=red];
a--b--c--a;
}

但是,大多数图表的方向与您的图片不同。 K3 示例会产生这样的结果:

K3

要在线测试其他布局引擎,您可以使用 GraphvizOnline .

关于graph - 如何使用 Dot 和 Graphviz 循环布局完整的图形?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46317240/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com