diff options
author | Johannes Stoelp <johannes.stoelp@gmail.com> | 2022-06-25 21:52:54 +0200 |
---|---|---|
committer | Johannes Stoelp <johannes.stoelp@gmail.com> | 2022-06-25 21:52:54 +0200 |
commit | 6b252dbc87462a5ccfd31c8fc6c27195646365dd (patch) | |
tree | d301ee6b62cf569c9cae1cfec9b88ee0249d2b8a /src | |
parent | f33fbacc6aaa54599458ac3eb375708650656010 (diff) | |
download | notes-6b252dbc87462a5ccfd31c8fc6c27195646365dd.tar.gz notes-6b252dbc87462a5ccfd31c8fc6c27195646365dd.zip |
[dot]: added copy & paste dot example graph
Diffstat (limited to 'src')
-rw-r--r-- | src/SUMMARY.md | 1 | ||||
-rw-r--r-- | src/assets/g.svg | 94 | ||||
-rw-r--r-- | src/tools/README.md | 1 | ||||
-rw-r--r-- | src/tools/dot.md | 54 |
4 files changed, 150 insertions, 0 deletions
diff --git a/src/SUMMARY.md b/src/SUMMARY.md index 97b62dd..8f87671 100644 --- a/src/SUMMARY.md +++ b/src/SUMMARY.md @@ -16,6 +16,7 @@ - [radare2](./tools/radare2.md) - [qemu](./tools/qemu.md) - [pacman](./tools/pacman.md) + - [dot](./tools/dot.md) - [Resource analysis & monitor](./monitor/README.md) - [lsof](./monitor/lsof.md) diff --git a/src/assets/g.svg b/src/assets/g.svg new file mode 100644 index 0000000..f66c7b7 --- /dev/null +++ b/src/assets/g.svg @@ -0,0 +1,94 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" + "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> +<!-- Generated by graphviz version 4.0.0 (0) + --> +<!-- Pages: 1 --> +<svg width="495pt" height="168pt" + viewBox="0.00 0.00 495.00 168.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> +<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 164)"> +<g id="clust2" class="cluster"> +<title>cluster_1</title> +<polygon fill="transparent" stroke="black" points="383,-46 383,-152 479,-152 479,-46 383,-46"/> +</g> +<!-- stage1 --> +<g id="node1" class="node"> +<title>stage1</title> +<polygon fill="none" stroke="black" points="65,-62 0,-62 0,-26 65,-26 65,-62"/> +<text text-anchor="middle" x="32.5" y="-40.3" font-family="Times,serif" font-size="14.00">stage1</text> +</g> +<!-- stage2 --> +<g id="node2" class="node"> +<title>stage2</title> +<polygon fill="none" stroke="black" points="167,-62 102,-62 102,-26 167,-26 167,-62"/> +<text text-anchor="middle" x="134.5" y="-40.3" font-family="Times,serif" font-size="14.00">stage2</text> +</g> +<!-- stage1->stage2 --> +<g id="edge1" class="edge"> +<title>stage1->stage2</title> +<path fill="none" stroke="red" stroke-dasharray="1,5" d="M65.14,-44C73.53,-44 82.72,-44 91.57,-44"/> +<polygon fill="red" stroke="red" points="91.72,-47.5 101.72,-44 91.72,-40.5 91.72,-47.5"/> +</g> +<!-- stage3_1 --> +<g id="node3" class="node"> +<title>stage3_1</title> +<polygon fill="none" stroke="black" points="284,-90 204,-90 204,-54 284,-54 284,-90"/> +<text text-anchor="middle" x="244" y="-68.3" font-family="Times,serif" font-size="14.00">stage3_1</text> +</g> +<!-- stage2->stage3_1 --> +<g id="edge2" class="edge"> +<title>stage2->stage3_1</title> +<path fill="none" stroke="red" stroke-dasharray="1,5" d="M167.17,-52.25C175.63,-54.45 184.97,-56.89 194.13,-59.27"/> +<polygon fill="red" stroke="red" points="193.37,-62.69 203.93,-61.82 195.14,-55.92 193.37,-62.69"/> +</g> +<!-- stage3_2 --> +<g id="node4" class="node"> +<title>stage3_2</title> +<polygon fill="none" stroke="black" points="284,-36 204,-36 204,0 284,0 284,-36"/> +<text text-anchor="middle" x="244" y="-14.3" font-family="Times,serif" font-size="14.00">stage3_2</text> +</g> +<!-- stage2->stage3_2 --> +<g id="edge3" class="edge"> +<title>stage2->stage3_2</title> +<path fill="none" stroke="red" stroke-dasharray="1,5" d="M167.17,-36.34C175.63,-34.29 184.97,-32.03 194.13,-29.82"/> +<polygon fill="red" stroke="red" points="195.04,-33.2 203.93,-27.45 193.39,-26.4 195.04,-33.2"/> +</g> +<!-- stage5_1 --> +<g id="node6" class="node"> +<title>stage5_1</title> +<polygon fill="none" stroke="black" points="471,-144 391,-144 391,-108 471,-108 471,-144"/> +<text text-anchor="middle" x="431" y="-122.3" font-family="Times,serif" font-size="14.00">stage5_1</text> +</g> +<!-- stage3_1->stage5_1 --> +<g id="edge5" class="edge"> +<title>stage3_1->stage5_1</title> +<path fill="none" stroke="red" stroke-dasharray="1,5" d="M284.23,-83.45C312.44,-91.69 350.67,-102.84 380.9,-111.67"/> +<polygon fill="red" stroke="red" points="380.24,-115.12 390.82,-114.56 382.2,-108.4 380.24,-115.12"/> +</g> +<!-- stage5_2 --> +<g id="node7" class="node"> +<title>stage5_2</title> +<polygon fill="none" stroke="black" points="471,-90 391,-90 391,-54 471,-54 471,-90"/> +<text text-anchor="middle" x="431" y="-68.3" font-family="Times,serif" font-size="14.00">stage5_2</text> +</g> +<!-- stage3_1->stage5_2 --> +<g id="edge6" class="edge"> +<title>stage3_1->stage5_2</title> +<path fill="none" stroke="red" stroke-dasharray="1,5" d="M284.23,-72C312.32,-72 350.34,-72 380.51,-72"/> +<polygon fill="red" stroke="red" points="380.82,-75.5 390.82,-72 380.82,-68.5 380.82,-75.5"/> +</g> +<!-- stage4 --> +<g id="node5" class="node"> +<title>stage4</title> +<polygon fill="lightgray" stroke="green" stroke-dasharray="5,2" points="458,-36 404,-36 404,0 458,0 458,-36"/> +<text text-anchor="middle" x="431" y="-14.3" font-family="Times,serif" font-size="14.00">s4</text> +</g> +<!-- stage3_2->stage4 --> +<g id="edge4" class="edge"> +<title>stage3_2->stage4</title> +<path fill="none" stroke="red" stroke-dasharray="1,5" d="M284.23,-18C316.63,-18 362.26,-18 393.8,-18"/> +<polygon fill="red" stroke="red" points="393.91,-21.5 403.91,-18 393.91,-14.5 393.91,-21.5"/> +<text text-anchor="middle" x="337.5" y="-21.8" font-family="Times,serif" font-size="14.00">some text</text> +</g> +</g> +</svg> diff --git a/src/tools/README.md b/src/tools/README.md index 8d3baa6..d6b0a21 100644 --- a/src/tools/README.md +++ b/src/tools/README.md @@ -13,3 +13,4 @@ - [radare2](./radare2.md) - [qemu](./qemu.md) - [pacman](./pacman.md) +- [dot](./dot.md) diff --git a/src/tools/dot.md b/src/tools/dot.md new file mode 100644 index 0000000..d3d7ac8 --- /dev/null +++ b/src/tools/dot.md @@ -0,0 +1,54 @@ +# dot(1) + +Example `dot` file to copy & paste from. + +Can be rendered to `svg` with the following command. +```bash +dot -T svg -o g.svg g.dot +``` + +Example `dot` file. +```dot +// file: g.dot +digraph { + // Render ranks from left to right. + rankdir=LR + // Make background transparent. + bgcolor=transparent + + // Global node attributes. + node [shape=box] + // Global edge attributes. + edge [style=dotted,color=red] + + // Add nodes & edge. + stage1 -> stage2 + // Add multiple edges at once. + stage2 -> { stage3_1, stage3_2 } + // Add edge with custom attributes. + stage3_2 -> stage4 [label="some text"] + + // Set custom attributes for specific node. + stage4 [color=green,fillcolor=lightgray,style="filled,dashed",label="s4"] + + // Create a subgraph. This can be used to group nodes/edges or as scope for + // global node/edge attributes. + // If the name starts with 'cluster' a border is drawn. + subgraph cluster_1 { + stage5_1 + stage5_2 + } + + // Add some edges to subgraph nodes. + stage3_1 -> { stage5_1, stage5_2 } +} +``` + +Rendered `svg` file. +![g.svg](/assets/g.svg) + +## References +- [DOT language](https://graphviz.org/doc/info/lang.html) +- [Attributes](https://graphviz.org/doc/info/attrs.html) +- [Node shapes](https://graphviz.org/doc/info/shapes.html) +- [Colors](https://graphviz.org/doc/info/colors.html) |