networks: Add build-tbn-state-graph and use it in example.

This commit is contained in:
Sergiu Ivanov 2020-10-23 00:17:36 +02:00
parent 485b859f34
commit e79fef9118
2 changed files with 12 additions and 12 deletions

View File

@ -1042,11 +1042,7 @@ tab
#+NAME: tbfs-nots-sg
#+BEGIN_SRC racket :results silent drawer :var tbfs-nots=munch-sexp(tbfs-nots)
(dotit ((compose pretty-print-state-graph
build-full-01-state-graph
make-syn-dynamics
tbn->network
read-org-tbn) tbfs-nots))
(dotit (build-tbn-state-graph (read-org-tbn tbfs-nots)))
#+END_SRC
#+BEGIN_SRC dot :file dots/examplew206DH.svg :results raw drawer :cmd sfdp :noweb yes
@ -1069,11 +1065,7 @@ tab
#+NAME: sbn-figure2-sg
#+BEGIN_SRC racket :results silent drawer :var sbn-figure2=munch-sexp(sbn-figure2)
(dotit ((compose pretty-print-state-graph
build-full-01-state-graph
make-syn-dynamics
tbn->network
read-org-sbn) sbn-figure2))
(dotit (build-tbn-state-graph (read-org-sbn sbn-figure2)))
#+END_SRC
#+BEGIN_SRC dot :file dots/sbn-figure2-sg.svg :results raw drawer :cmd sfdp :noweb yes
@ -1082,7 +1074,7 @@ tab
#+RESULTS:
:results:
[[file:dots/sbn-figure2-sg.svg]]
[[file:dots/sbn-figure2-sg.svg]]
:end:
* Reaction systems

View File

@ -116,7 +116,8 @@
tbn?)]
[read-org-sbn (->* (string?)
(#:headers boolean? #:func-names boolean?)
tbn?)])
tbn?)]
[build-tbn-state-graph (-> tbn? graph?)])
;; Predicates
(contract-out [variable? (-> any/c boolean?)]
[state? (-> any/c boolean?)]
@ -1466,3 +1467,10 @@
(tbf/state '#hash((x0 . -1) (x1 . 0)) 0)
'x1
(tbf/state '#hash((x0 . 0) (x1 . -1)) 0)))))
;;; A shortcut for building the state graphs of TBN.
(define build-tbn-state-graph
(compose pretty-print-state-graph
build-full-01-state-graph
make-syn-dynamics
tbn->network))