Last active
October 9, 2015 15:21
-
-
Save caseywatts/78e1577fab56d04df8cd to your computer and use it in GitHub Desktop.
Intro to Graphviz
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
digraph { | |
1 -> "Simple Nodes" -> | |
"http://graphviz-repl.herokuapp.com/intro-to-graphviz-1" | |
2 -> "Attributes = Lables, Colors, Styles" -> | |
"http://graphviz-repl.herokuapp.com/intro-to-graphviz-2" | |
3 -> "Subgraphs" -> | |
"http://graphviz-repl.herokuapp.com/intro-to-graphviz-3" | |
1 -> 2 -> 3 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
digraph SimplestDiagrams { | |
### Here are 4 "nodes" and 5 "connections": | |
A -> B -> C | |
C -> D | |
B -> A | |
B -> D | |
manySimpleDiagrams -> canBeExpressed -> usingJustCapitalization | |
usingJustCapitalization -> like | |
like -> MixedCase | |
like -> camelCase | |
manySimpleDiagrams -> "might use" -> "'multiple words' in quotes" | |
} | |
# comments start with either # or // | |
// take your pick :D | |
// ### using three #'s might help things line up visually | |
// ### everything must be in a digraph{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
digraph AdvancedAttributes { | |
### LABELS | |
### "c" is this node's "node name" or "nickname" | |
### "label" is the text that shows up inside the circle/node/shape | |
c [label="the letter c"] | |
c -> d | |
### STYLE & COLOR | |
d [label="DeeDee"] | |
d [style=dotted] | |
d [color=orange] | |
### MULTIPLE STYLES | |
e [label="The Big E" style=dashed color=purple] | |
f [ | |
label="Effff (f)" | |
style=dashed | |
color=purple | |
] | |
### STYLING LINES | |
g -> h -> i [label="comes before" style="dotted" color="purple"] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
digraph FancyOneWithSubgraphs { | |
O -> P | |
### to make a subgraph with a box around its contents | |
### you must have "subgraph" and "cluster..." present as in this example | |
### if you forget cluster in your clustername it will never show up | |
subgraph clusterSomeClusterName { | |
label="title about why these are grouped in here" | |
style="dotted" | |
P -> Q -> R | |
} | |
### graphviz doesn't mind if you do things outside of a subgraph | |
R [label = "Rrrrrr"] | |
### If a node is ever used/described/declared inside a subgraph, | |
### it will always appear within that subgraph. | |
R -> S | |
### Note: you may want to point to/from a subgraph itself | |
### sorry you can't really :/ | |
### you can only point to/from the specific nodes inside of it | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment