「GRAPHVIZ」- 概念术语

DOT 语言

Wikipedia/DOT
Graphviz/The Dot Language

以下是定义 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 | _)

关键字node, edge, graph, digraph, subgraph, strict是大小写无关的。还要注意,允许的 compass_pt 的值不是关键字,所以这些字符串可以在其他地方用作普通标识符,相反,解析器实际上会接受任何标识符;

Layout

About / Graph Visualization / Layout

dot,hierarchical or layered drawings of directed graphs.

neato,”spring model” layouts.

fdp,stands for Force-Directed Placement.

sfdp,stands for Scalable Force-Directed Placement.

circo,circular layout.

twopi,radial layout.

nop,Pretty-print DOT graph file. Equivalent to nop1.

nop2,Pretty-print DOT graph file, assuming positions already known.

osage,draws clustered graphs.

patchwork,draws map of clustered graph using a squarified treemap layout.

Writing Layout Plugins,How to write a custom layout engine.