2

如果我在这个有向图上运行 graphviz:

digraph G {
    subgraph cluster_0 {
        style=filled;
        color=lightgrey;
        node [style=filled,color=white];
        a0; a1;  a2;  a3;
        label = "sources";
    }

    subgraph cluster_1 {
        style=filled;
        color=lightgrey;
        node [style=filled,color=white];
        b0; b1; b2; b3;
        label = "intermediaries";
    }
        a0 -> b0; a1 -> b0;
        a0 -> b1; a1 -> b1;
        a2 -> b2; b0 -> b2;
        b1 -> b2; a3 -> b3;
        b0 -> b3; b1 -> b3;
}

我明白了

在此处输入图像描述

许多边与“中介”标签相交。如何让 graphviz 使边缘避免标签?

4

1 回答 1

2

作为一种解决方法:

digraph G {
    subgraph cluster_0 {
        style=filled;
        color=lightgrey;
        node [style=filled,color=white];
        a0; a1;  a2;  a3;
        label = "sources";
    }

    subgraph cluster_1 {
        style=filled;
        color=lightgrey;
        node [style=filled,color=white];
        nodelabel [label="intermediaries"; style=filled; color=lightgrey]
        nodelabel -> b1 [style=invis];
        nodelabel -> b0 [style=invis];
        b0; b1; b2; b3;
    }
        a0 -> b0; a1 -> b0;
        a0 -> b1; a1 -> b1;
        a2 -> b2; b0 -> b2;
        b1 -> b2; a3 -> b3;
        b0 -> b3; b1 -> b3;
}

生产:

输出

于 2016-08-25T14:44:48.457 回答