【问题标题】:Represent array with indices using dot record nodes (Graphviz)使用点记录节点表示具有索引的数组(Graphviz)
【发布时间】:2016-06-23 17:32:25
【问题描述】:

我使用 Graphviz 来表示数组,使用 subgraphsrecord 节点:

subgraph cluster_array
{
    label="my array"
    Array [shape="record", label="A | B | C | D"]
    Array
}

我想为每个数组元素添加外部索引,映射0 -> A1 -> B等等。

我想达到类似的结果:

我在网上搜索并尝试使用xlabel,但找不到为每个记录元素正确添加标签的方法。我也尝试过将索引作为标签的一部分,并使用lp 移动标签,但它似乎对record 节点没有影响。

是否可以使用 GraphViz 将外部元素标签添加到 record 节点?

【问题讨论】:

    标签: graphviz dot


    【解决方案1】:

    不是对您问题的真正答案(我认为这将是“否”),而是一种可能会给您想要的解决方法。我使用了一个“平行”的记录节点,没有边框(确切地说是纸色边框),位置非常靠近并由一条不可见的边缘连接:

    digraph so
    {
        subgraph cluster0
        {
            rank = same{ Array notes }
            color = white;
            Array [ shape = record, label = "{ A | B | C | D }"] ;
            notes [ shape = record, color = white, label = "{ a_1 | b_2 | c_3 | d_4 }" ];
            Array -> notes[ style = invis ];
        }
        nodesep = .0;
        X -> Array -> Z;
    }
    

    产生

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-12-12
      • 1970-01-01
      • 1970-01-01
      • 2016-12-21
      • 1970-01-01
      • 2013-03-28
      • 1970-01-01
      • 2014-08-02
      相关资源
      最近更新 更多