力GraphViz力节点之间的距离 [英] Force GraphViz force distance between nodes

查看:287
本文介绍了力GraphViz力节点之间的距离的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将GraphViz与以下点文件一起使用:

I use GraphViz with the following dot file:

digraph G
{
    rankdir=LR;
    subgraph commits
    {
        "5c071a6b2c" -> "968bda3251" -> "9754d40473" -> "9e59700d33" -> "2a3242efa4";
    }
    subgraph annotations
    {
        "V1.0" [shape=box];
        "br/HEAD" [shape=box];
        "V1.0" -> "9e59700d33" [weight=0];
        "br/HEAD" -> "2a3242efa4" [weight=0];
    }
}

它给了我类似的东西:

It give me something like that:

但是我想要这样的东西:

But I want something like that:

                                        V1.0         br/HEAD
                                          |             |
                                         \/            \/

5c071a6b2c-> 968bda3251-> 9754d40473-> 9e59700d33-> 2a3242efa4

5c071a6b2c -> 968bda3251 -> 9754d40473 -> 9e59700d33 -> 2a3242efa4

我该怎么做?

在您的帮助下, 预先感谢.

For your help, Thanks by advance.

推荐答案

这将使注释与提交对齐:

This will align the annotations with the commits:

digraph G
{
    rankdir=LR;
    subgraph commits
    {
        "5c071a6b2c" -> "968bda3251" -> "9754d40473" -> "9e59700d33" -> "2a3242efa4";
    }
    subgraph annotations1
    {
        rank="same";
        "V1.0" [shape=box];
        "V1.0" -> "9e59700d33" [weight=0];
    }
    subgraph annotations2
    {
        rank="same";
        "br/HEAD" [shape=box];
        "br/HEAD" -> "2a3242efa4" [weight=0];
    }
}

由于rank="same";会影响整个子图,因此我不得不将注释拆分为两个不同的子图.

Since the rank="same"; effects the whole subgraph I had to split the annotations in two different subgraphs.

结果是:

这篇关于力GraphViz力节点之间的距离的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆