Netkiller Developer 手札
November 15, 2008
版权 © 2008, 2009, 2010, 2011 Netkiller(Neo Chan). All rights reserved.
下面是我多年积累下来的经验总结,整理成文档供大家参考:
to see all available graphviz packages.
$ apt-cache search graphviz |grep ^g
graphviz - rich set of graph drawing tools
graphviz-dev - transitional package for graphviz-dev rename
graphviz-doc - additional documentation for graphviz
$ apt-cache search graphviz |grep Graphviz
dot2tex - Graphviz to LaTeX converter
libgraph-easy-perl - Perl module to convert or render graphs (as ASCII, HTML, SVG or via Graphviz)
python-pydot - Python interface to Graphviz's dot
python-pygraphviz - Python interface to the Graphviz graph layout and visualization package
python-yapgvb - Python bindings for Graphviz, using Boost.Python
xdot - interactive viewer for Graphviz dot files
$ sudo apt-get install graphviz
Test, A "Hello World" example made by giving the command:
echo "digraph G {Hello->World}" | dot -Tpng >hello.png
$ cat erd.gv
digraph g {
graph [
rankdir = "LR"
];
node [
fontsize = "16"
shape = "ellipse"
];
edge [
];
"user" [
label = "User| <id> id|username|password|last|status"
shape = "record"
];
"profile" [
label = "Profile| <id> id | name | sex | age | address | icq | msn"
shape = "record"
];
user:id->profile:id [label="1:1"];
"category" [
label = "Category| <id> id | <pid> pid | name | status"
shape = "record"
];
category:pid->category:id [label="1:n"];
"article" [
label = "Article| <id> id| <user_id> user_id | <cid> category_id | title | content | datetime | status"
shape = "record"
];
article:user_id->user:id [label="1:n"];
article:cid->category:id [label="1:n"];
"feedback" [
label = "Feedback| <id> id| <user_id> user_id | <article_id> article_id | title | content | datetime | status"
shape = "record"
];
feedback:user_id->user:id [label="1:n"];
feedback:article_id->article:id [label="1:n"];
}
$ dot -Tpng erd.gv > erd.png