# Record and struct (GraphViz) Record shapes give a node internal structure, and edges can point at an individual field. That is what makes Graphviz workable for data structure diagrams. --- ## What this example shows * shape=record with pipe-separated fields. * Named ports, addressed as node:port in an edge. * A linked list, drawn without any manual positioning. --- ## A worked example Open it, edit it, or copy the source below. ![Record and struct (GraphViz)](https://help.gocapable.com/images/att1423900783.svg) The source, which you can paste into a new diagram and edit: ``` digraph structs { rankdir=LR; node [shape=record, fontname="Helvetica", fontsize=10]; head [label=" head", shape=plaintext]; n1 [label="{ 42 | next}"]; n2 [label="{ 17 | next}"]; n3 [label="{ 93 | null}"]; table [label="{orders | {id | uuid} | {customer_id | uuid} | {status | text} | {total | numeric}}"]; head:f0 -> n1:data; n1:next -> n2:data; n2:next -> n3:data; n3:next -> table [style=dashed, label="row per order"]; } ``` --- ## Making it your own * Angle brackets define a port name; a colon in an edge addresses it. * Braces flip the field direction, which is how you get a vertical record. * Escape any literal pipe, brace or angle bracket inside a label. --- ## Related [Undirected graph (GraphViz)No arrows, because the relationship is symmetric.](https://help.gocapable.com/diagrams/undirected-graph-graphviz.html) [State diagram (GraphViz)States as nodes, with a double circle for accepting.](https://help.gocapable.com/diagrams/state-diagram-graphviz.html) [GraphViz examplesBack to the rest of these examples.](https://help.gocapable.com/diagrams/graphviz-examples.html) --- _Give it the edges. It does the rest._