Debian Codegraph @

examples/sportsbracket.dot

raw
1 /*
2
3 :Title: Orthogonal edges
4 :Tags: PGF, topath
5
6
7 This example is adapted from an example posted by Ryan Schmidt to the `graphviz-interest`_ mailing
8 list. Graphviz currently does not support orthogonal edges. However,
9 with dot2tex you can use the ``topath`` attribute to create custom edges.
10
11 Here is the definition of the ``fork horizontal`` to-path. It uses the powerful
12 *coordinate calculations* feature introduced in PGF 2.00.
13
14 .. sourcecode:: latex
15
16 ...
17 \usetikzlibrary{calc}
18 ...
19 \tikzstyle{fork horizontal} =[to path={
20 -| ($(\tikztostart)!0.5!(\tikztotarget)$) |- (\tikztotarget) \tikztonodes}]
21
22
23 **Note**: This example requires PGF 2.00 or later.
24
25 Generated with::
26
27 $ dot2tex --crop sportsbracket.dot > sportsbracket.tex
28
29 .. _graphviz-interest: https://mailman.research.att.com/pipermail/graphviz-interest/2008q2/thread.html#5129
30
31 */
32 digraph G {
33 // Put our custom fork horizontal to path in the document preamble
34 d2tdocpreamble = "\usetikzlibrary{calc}\
35 \tikzstyle{fork horizontal} =[to path={\
36 -| ($(\tikztostart)!0.5!(\tikztotarget)$) |- (\tikztotarget) \tikztonodes}]";
37 rankdir=LR
38 node [shape=box, width=2]
39
40 graph [size="8.5,11" label="NCAA Men's Basketball: 2008 Tournament"]
41
42 11 [label="North Carolina"]
43 12 [label="Mount St. Mary's"]
44 13 [label="Indiana"]
45 14 [label="Arkansas"]
46 15 [label="Notre Dame"]
47 16 [label="George Mason"]
48 17 [label="Washington St."]
49 18 [label="Winthrop"]
50 19 [label="Oklahoma"]
51 110 [label="St. Joseph's"]
52 111 [label="Louisville"]
53 112 [label="Boise St."]
54 113 [label="Butler"]
55 114 [label="South Alabama"]
56 115 [label="Tennessee"]
57 116 [label="American"]
58 21 [label="North Carolina"]
59 22 [label="Arkansas"]
60 23 [label="Notre Dame"]
61 24 [label="Washington St."]
62 25 [label="Oklahoma"]
63 26 [label="Louisville"]
64 27 [label="Butler"]
65 28 [label="Tennessee"]
66 31 [label="North Carolina"]
67 32 [label="Washington St."]
68 33 [label="Louisville"]
69 34 [label="Tennessee"]
70 41 [label="North Carolina"]
71 42 [label="Louisville"]
72 51 [label="North Carolina"]
73 // Use the custom 'fork horizontal' to path defined above
74 edge [topath="fork horizontal"];
75 11:e->21:w
76 12:e->21:w
77 13:e->22:w
78 14:e->22:w
79 15:e->23:w
80 16:e->23:w
81 17:e->24:w
82 18:e->24:w
83 19:e->25:w
84 110:e->25:w
85 111:e->26:w
86 112:e->26:w
87 113:e->27:w
88 114:e->27:w
89 115:e->28:w
90 116:e->28:w
91 21:e->31:w
92 22:e->31:w
93 23:e->32:w
94 24:e->32:w
95 25:e->33:w
96 26:e->33:w
97 27:e->34:w
98 28:e->34:w
99 31:e->41:w
100 32:e->41:w
101 33:e->42:w
102 34:e->42:w
103 41:e->51:w
104 42:e->51:w
105
106 edge [style=invis]
107 rank=same {11->12->13->14->15->16->17->18->19->110->111->112->113->114->115->116}
108 }