如何在点图中设置固定深度级别

发布于 2024-09-10 20:54:47 字数 717 浏览 3 评论 0原文

我正在从树状数据结构创建点图可视化,但在根据数据类型设置固定级别深度时遇到困难。例如,如果树中有 4 个节点,A 表示特定数据类型,B 表示另一个数据类型,那么它会像 Graph_1 一样:

<预置><代码> 根 /\ A[0] B[1] / 乙[0]

与 Graph_2 相反:

<预置><代码> 根 /\ 一个[0] \ /\ 乙[0] 乙[1]

Graph_2 是我想要的最终结果。

固定级别正是我正在寻找的。我怎样才能实现这个目标?我可以轻松识别要添加到图表中的数据类型,但在如何标记节点以实现此目的方面遇到困难。这可以使用子图来完成吗?

仅供参考,这是我第一次玩 DOT。

I'm creating a DOT graph visualization from a tree-like data structure but am having difficulties setting fixed level depths based upon data type. For example, if I had 4 nodes in a tree and A denotes a specific data type and B represents another it would like Graph_1:

                                      ROOT   
                                     /    \  
                                   A[0]    B[1]
                                   /        
                                 B[0]    

as opposed to Graph_2:

                                      ROOT   
                                     /    \  
                                   A[0]    \
                                   /        \
                                 B[0]       B[1]   

Graph_2 is what I would like to end up with.

The fixed levels are what I'm looking for. How can I achieve this? I can easily identify what data type I'm adding to the graph, but am having trouble on how to tag nodes to achieve this. Can this be done using subgraphs?

FYI, this is my first time playing with DOT.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

流年里的时光 2024-09-17 20:54:47

是的,子图可以工作。

digraph {
  subgraph { rank = same; A0 };
  subgraph { rank = same; B0; B1 };
  root -> A0;
  A0 -> B0;
  root -> B1;
}

结果为

替代文本
(来源:brool.com

Yes, subgraphs will work.

digraph {
  subgraph { rank = same; A0 };
  subgraph { rank = same; B0; B1 };
  root -> A0;
  A0 -> B0;
  root -> B1;
}

results in

alt text
(source: brool.com)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文