From 44e4fa4937b9d44fb89863834c412bca4ff46db8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind?= Date: Sun, 13 Feb 2022 17:40:43 +0100 Subject: [PATCH] Add graphviz files --- exercises/02/graphviz/1.1.dot | 25 +++++++++++++++++++++++++ exercises/02/graphviz/Makefile | 13 +++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 exercises/02/graphviz/1.1.dot create mode 100644 exercises/02/graphviz/Makefile diff --git a/exercises/02/graphviz/1.1.dot b/exercises/02/graphviz/1.1.dot new file mode 100644 index 0000000..5c7319b --- /dev/null +++ b/exercises/02/graphviz/1.1.dot @@ -0,0 +1,25 @@ +digraph finite_state_machine { + rankdir=LR; + size="8,5" + + subgraph cluster_c2 { + label="Accepting"; graph[style = dotted]; + node [shape = doublecircle]; + 3 -> 4 [label = "i"]; + 4 -> 3 [label = "o" constraint=false]; + } + + subgraph cluster_c1 { + label="Non-accepting"; graph[style = dotted]; + node [shape = circle]; + 0 -> 1 [label = "c"]; + 1 -> 2 [label = "o"]; + 2 -> 2 [label = "o"]; + 2 -> 3 [label = "l"]; + } + + // Create an invisible point called START, so our starting state gets an arrow + node [shape=point]; + START [style=invis]; + START -> 0; +} \ No newline at end of file diff --git a/exercises/02/graphviz/Makefile b/exercises/02/graphviz/Makefile new file mode 100644 index 0000000..2273655 --- /dev/null +++ b/exercises/02/graphviz/Makefile @@ -0,0 +1,13 @@ +GRAPHVIZ_PDFS:=$(patsubst %.dot,%.pdf,$(wildcard *.dot)) + +.PHONY: all clean +all: ${GRAPHVIZ_PDFS} + +%.pdf: %.svg + inkscape $< --export-area-drawing --batch-process --export-type=pdf --export-filename=$@ + +%.svg: %.dot + dot -Tsvg -o $@ $< + +clean: + rm -rf ${GRAPHVIZ_PDFS} \ No newline at end of file