Révision | 83f0c6f28ef388ec498635fcb8409f45d679cde2 |
---|---|
Taille | 2,893 octets |
l'heure | 2016-02-08 21:48:48 |
Auteur | Lorenzo Isella |
Message de Log | I added some comments for an example. |
\documentclass[tikz]{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows}
\usetikzlibrary{graphs}
\usetikzlibrary{graphdrawing,quotes}
\usegdlibrary{layered,trees,circular,force}
% compile this using lualatex and not pdflatex!
% see http://bit.ly/1T88wKl
\begin{document}
\tikz [
nodes={
text height=.7em,
text depth=.2em,
draw=black!20,
thick,
fill=white,
font=\footnotesize
},
>=stealth',
rounded corners,
semithick
]
\graph [
layered layout,
% spring layout,
level distance=1cm,
sibling sep=.5em,
sibling distance=1cm
] {
"5th Edition" -> {"6th Edition", "PWB 1.0" };
"6th Edition" -> {
"LSX" [>child anchor=45], % nothing bad happens if I remove the
% chunk within square brackets
"1 BSD",
"Mini Unix",
"Wollongong",
"Interdata" };
"Interdata" -> {
"Unix/TS 3.0",
"PWB 2.0",
"7th Edition" };
"7th Edition" -> {
"8th Edition",
"32V",
"V7M",
"Ultrix-11",
"Xenix",
"UniPlus+" };
"V7M" -> "Ultrix-11";
"8th Edition" -> "9th Edition";
"1 BSD" -> "2 BSD"
-> "2.8 BSD"
-> { "Ultrix-11", "2.9 BSD" };
"32V" -> "3 BSD"
-> "4 BSD"
-> "4.1 BSD"
-> { "4.2 BSD", "2.8 BSD", "8th Edition" };
"4.2 BSD" -> { "4.3 BSD", "Ultrix-32" };
"PWB 1.0" -> {
"PWB 1.2" -> "PWB 2.0",
"USG 1.0" -> {
"CB Unix 1",
"USG 2.0" }};
"CB Unix 1" -> "CB Unix 2"
-> "CB Unix 3"
-> { "Unix/TS++", "PDP-11 Sys V" };
{
"USG 2.0" -> "USG 3.0",
"PWB 2.0",
"Unix/TS 1.0"
} -> "Unix/TS 3.0";
{
"Unix/TS++",
"CB Unix 3",
"Unix/TS 3.0"
} -> "TS 4.0"
-> "System
V.0" -> "System V.2"
-> "System V.3";
};
\tikz [>=stealth']
\graph [layered layout, components go right top aligned, nodes=draw, edges=rounded corners]
{
first root -> {1 -> {2, 3, 7} -> {4, 5}, 6 }, 4 -- 5;
second root -> x -> {a -> {u,v}, b, c -> d -> {w,z} };
third root -> child -> grandchild -> youngster -> third root;
};
\tikz [grow'=up, binary tree layout, nodes={circle,draw}]
\node {1}
child { node {2}
child { node {3} }
child { node {4}
child { node {5} }
child { node {6} }
}
}
child { node {7}
child { node {8}
child[missing]
child { node {9} }
}
};
\tikz \graph [binary tree layout, level distance=5mm] {
4 -- {
3 -- 0 -- 1[second],
10 -- {
8 -- {
6 -- {5,7},
9
} } }
};
% here I need the quote library, see http://bit.ly/1T88wKl
\tikz \graph [spring layout,
edge quotes mid,
edges={nodes={font=\scriptsize, fill=white, sloped, inner sep=1pt}}]
{
1 ->["Das"] 2 ->["ist"] 3 ->["das"] 4 ->["Haus"]
2 ->["vom" near start] 5 ->["Ni"] 4 ->["ko" near start]
1 ->["laus", orient=right] 5;
};
\end{document}