Same node in two subgraphs

三世轮回 提交于 2020-02-25 04:23:25

问题


I want to draw a border around two subgraphs but I have one node that belongs to both.

digraph {
    subgraph cluster_0 {
            color = red

            A -> D
            A -> C
            C -> D
    }

    subgraph cluster_1 {
            color = blue

            B -> C
            B -> E
            C -> E
    }
}

Now C should be part of both Clusters - instead I get this:


回答1:


There s a difference between tha name / label of a node and its identification. When a node has no name / label ithe identification is taken as name / label.

Not sure if the following is what uou intended (otherwise clarify you question).

digraph {
    subgraph cluster_0 {
            color = red

            A -> D
            A -> C
            C -> D
    }

    subgraph cluster_1 {
            color = blue
            node C2 [label="C"]
            B -> C2
            B -> E
            C2 -> E
    }
}

From the comment of OP (image should be in original question) looks like OP wants something more like:

digraph {
    subgraph cluster_2 {
    color = none;
    node C
    }
    subgraph cluster_0 {
            color = red

            A -> D
            A -> C
            C -> D
    }

    subgraph cluster_1 {
            color = blue

            B -> C
            B -> E
            C -> E
    }
}

this image does not provide the exact picture OP wants but I think a direction and with some ran setting together with some hidden nodes and edges it should give the right picture.



来源:https://stackoverflow.com/questions/58259081/same-node-in-two-subgraphs

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!