-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathexample.rkt
47 lines (44 loc) · 1.24 KB
/
example.rkt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#lang racket
(require pict)
(require graphviz)
(define examples
`(
;; graph 1
(["A" #:shape "diamond"]
["B" #:shape "box"]
["C" #:shape "circle"]
[("A" "B") #:style "dashed" #:color "grey"]
[("A" "C") #:color "black:invis:black"]
[("A" "D") #:penwidth "5" #:arrowhead "none"])
;; graph 2
([subgraph "process #1"
#:style "filled"
#:color "lightgrey"
("a0 -> a1 -> a2 -> a3")]
[subgraph "process #2"
#:color "blue"
("b0 -> b1 -> b2 -> b3")]
"start -> a0"
"start -> b0"
"a1 -> b3"
"b2 -> a3"
"a3 -> a0"
"a3 -> end"
"b3 -> end"
["start" #:shape "Mdiamond"]
["end" #:shape "Msquare"])
;;
(["a" #:shape "diamond" #:fillcolor "lightgray" #:style "filled"]
["b" #:shape ,(cloud 60 30) #:label "c"]
["c" #:shape ,(standard-fish 100 50 #:open-mouth #t #:color "Chartreuse")
#:label ""]
"d"
"a -> b -> c"
"a -> d -> c"
(subgraph "stdout" #:style "filled" #:fillcolor "cyan"
(["f" #:shape ,(file-icon 50 60 "bisque")]
"g"
"f -> g"))
"d -> g")))
(for/list ([d examples])
(digraph->pict (make-digraph d)))