我如何从上到下排列带有多个标签的子图?

时间:2018-09-09 09:41:18

标签: graphviz graph-visualization

我想要这样: enter image description here

我明白了: redis data structure

我使用以下代码:

digraph redis_all_struct { 
node [shape=record];
//rankdir="LR";

// level 1
// redisDb
redisDb [shape=record,label="{ <f1> dict *dict | dict *expires | dict *blocking_keys | dict *ready_keys | dict *watched_keys| int id | long long avg_ttl}"]
subgraph cluster_redisDb_struct {
    label = "struct redisDb";
    fontcolor = "purple";
    color = "white";
    labeljust="l";
    redisDb;
}

// struct dict
dict [shape=record,label="{<f1> dictType *type | void *privdata | <dictht> dictht ht[2] | long rehashidx | unsigned long iterators}"];
subgraph cluster_dict_struct {
    label = "struct dict";
    fontcolor = "blue";
    color = "white";
    labeljust="l";
    dict;
}

// struct dictht
dictht [shape=record,label="{ <f1> dictEntry **table | unsigned long size | unsigned long sizemask | unsigned long used}"];
subgraph cluster_dictht_struct {
    label = "struct dictht";
    fontcolor = "blue";
    color = "white";
    labeljust="l";
    dictht;
}


// struct dictEntry array
dictEntry_array [shape=record,label="{<f1>pointer| <f2>pointer| <f3>pointer | <f4>pointer |pointer |pointer |pointer ||||||}"];
subgraph cluster_dictEntry_array_struct {
    label = "struct dictEntry *";
    fontcolor = "blue";
    color = "white";
    dictEntry_array;
}


// struct dictEntry
dictEntry [shape=record,label="{void *key | void *val | struct dictEntry *next}"];
subgraph cluster_dictEntry_struct {
    label = "struct dictEntry";
    fontcolor = "blue";
    color = "white";
    dictEntry;
}

// struct dictEntry
dictEntry2 [shape=record,label="{void *key | void *val | struct dictEntry *next}"];
subgraph cluster_dictEntry2_struct {
    label = "struct dictEntry";
    fontcolor = "blue";
    color = "white";
    dictEntry;
}


// struct dictEntry
dictEntry3 [shape=record,label="{void *key | void *val | struct dictEntry *next}"];
subgraph cluster_dictEntry3_struct {
    label = "struct dictEntry";
    fontcolor = "blue";
    color = "white";
    dictEntry;
}

// struct dictEntry
dictEntry4 [shape=record,label="{void *key | void *val | struct dictEntry *next}"];
subgraph cluster_dictEntry4_struct {
    label = "struct dictEntry";
    fontcolor = "blue";
    color = "white";
    dictEntry;
}


// connect
// section 1
redisDb:f1 -> dict [color="red"]
dict:f1 ->  dictht [color="red"]
dictht:f1 ->  dictEntry_array [color="red"]
dictEntry_array:f1 ->  dictEntry [ color="red"]
dictEntry_array:f2 ->  dictEntry2 [ color="red"]
dictEntry_array:f3 ->  dictEntry3 [ color="red"]
dictEntry_array:f4 ->  dictEntry4 [ color="red"]

{rank=same; redisDb dict dictht}

}

我遇到了一些错误:

    Warning: flat edge between adjacent nodes one of which has a record shape - replace records with HTML-like labels
  Edge redisDb -> dict
Error: lost redisDb dict edge
Error: lost dict dictht edge

我该如何解决。

0 个答案:

没有答案