dot 语言
GraphViz一个开源图形可视化工具。
GraphViz 使用 dot语言描述。
官方链接 https://www.graphviz.org/
dot 语言
https://www.graphviz.org/doc/info/lang.html
dot 语法
graph | [ strict ] (graph | digraph) [ ID ] '{' stmt_list '}'
stmt_list | [ stmt [ ';' ] stmt_list ]
stmt | node_stmt | edge_stmt | attr_stmt | ID '=' ID | subgraph
attr_stmt | (graph | node | edge) attr_list
attr_list | '[' [ a_list ] ']' [ attr_list ]
a_list | ID '=' ID [ (';' | ',') ] [ a_list ]
edge_stmt | (node_id | subgraph) edgeRHS [ attr_list ]
edgeRHS | edgeop (node_id | subgraph) [ edgeRHS ]
node_stmt | node_id [ attr_list ]
node_id | ID [ port ]
port | ':' ID [ ':' compass_pt ] | ':' compass_pt
subgraph | [ subgraph [ ID ] ] '{' stmt_list '}'
compass_pt | (n | ne | e | se | s | sw | w | nw | c | _)
dot 示例
digraph {
compound=true
margin="0,0"
ranksep = .75
nodesep = 1
pad = .5
rankdir = LR
node [shape=record, charset = "UTF-8" fontname="", fontsize=14]
edge [style = dashed, charset = "UTF-8" fontname="", fontsize=11]
epoll [shape = plaintext, label = "epoll 相关结构及部分关系"]
eventpoll [
color = cornflowerblue,
label = "<eventpoll> struct \n eventpoll 哈哈|
<lock> spinlock_t lock; |
<mutex> struct mutex mtx; |
<wq> wait_queue_head_t wq; |
<poll_wait> wait_queue_head_t poll_wait; |
<rdllist> struct list_head rdllist; |
<ovflist> struct epitem *ovflist; |
<rbr> struct rb_root_cached rbr; |
<ws> struct wakeup_source *ws; |
<user> struct user_struct *user; |
<file> struct file *file; |
<visited> int visited; |
<visited_list_link> struct list_head visited_list_link;"
]
epitem [
color = sienna,
label = "<epitem> struct \n epitem |
<rb>struct rb_node rbn;\nstruct rcu_head rcu; |
<rdllink> struct list_head rdllink; |
<next> struct epitem *next; |
<ffd> struct epoll_filefd ffd; |
<nwait> int nwait; |
<pwqlist> struct list_head pwqlist; |
<ep> struct eventpoll *ep; |
<fllink> struct list_head fllink; |
<ws> struct wakeup_source __rcu *ws; |
<event> struct epoll_event event;"
]
epitem2 [
color = sienna,
label = "<epitem> struct \n epitem |
<rb>struct rb_node rbn;\nstruct rcu_head rcu; |
<rdllink> struct list_head rdllink; |
<next> struct epitem *next; |
<ep> struct eventpoll *ep; |
··· |
··· "
]
eppoll_entry [
color = darkviolet,
label = "<entry> struct \n eppoll_entry |
<llink> struct list_head llink; |
<base> struct epitem *base; |
<wait> wait_queue_entry_t wait; |
<whead> wait_queue_head_t *whead;"
]
subgraph mu{
Graph
content
content -> Graph
}
epitem:ep -> eventpoll:se [color = red]
epitem2:ep -> eventpoll:se [color = sienna]
eventpoll:ovflist -> epitem:next -> epitem2:next [color = cornflowerblue]
eventpoll:rdllist -> epitem:rdllink -> epitem2:rdllink [dir = both]
eppoll_entry:llink -> epitem:pwqlist [color = darkviolet]
eppoll_entry:base -> epitem:nw [color = darkviolet]
epitem:epoll -> Graph -> content
epitem2:rb:c ->mu
}