example: Illustrate state graphs for reaction systems.

This commit is contained in:
Sergiu Ivanov 2020-03-03 00:25:26 +01:00
parent cf99c8acf3
commit 227dfff14a
2 changed files with 125 additions and 0 deletions

View File

@ -0,0 +1,82 @@
<?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 2.43.0 (0)
-->
<!-- Title: G Pages: 1 -->
<svg width="202pt" height="481pt"
viewBox="0.00 0.00 201.75 480.70" 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 476.7)">
<title>G</title>
<polygon fill="white" stroke="transparent" points="-4,4 -4,-476.7 197.75,-476.7 197.75,4 -4,4"/>
<!-- node0 -->
<g id="node1" class="node">
<title>node0</title>
<ellipse fill="none" stroke="black" cx="96.87" cy="-236.35" rx="50.82" ry="26.74"/>
<text text-anchor="middle" x="96.87" y="-240.15" font-family="Times-Roman" font-size="14.00">C:{}{t}</text>
<text text-anchor="middle" x="96.87" y="-225.15" font-family="Times-Roman" font-size="14.00">D:{}</text>
</g>
<!-- node2 -->
<g id="node3" class="node">
<title>node2</title>
<ellipse fill="none" stroke="black" cx="96.87" cy="-131.61" rx="38.37" ry="26.74"/>
<text text-anchor="middle" x="96.87" y="-135.41" font-family="Times-Roman" font-size="14.00">C:{t}</text>
<text text-anchor="middle" x="96.87" y="-120.41" font-family="Times-Roman" font-size="14.00">D:{}</text>
</g>
<!-- node0&#45;&gt;node2 -->
<g id="edge2" class="edge">
<title>node0&#45;&gt;node2</title>
<path fill="none" stroke="black" d="M96.87,-209.42C96.87,-197.14 96.87,-182.25 96.87,-168.86"/>
<polygon fill="black" stroke="black" points="100.37,-168.53 96.87,-158.53 93.37,-168.53 100.37,-168.53"/>
<text text-anchor="middle" x="106.37" y="-180.28" font-family="Times-Roman" font-size="14.00">{}</text>
</g>
<!-- node1 -->
<g id="node2" class="node">
<title>node1</title>
<ellipse fill="none" stroke="black" cx="96.87" cy="-341.09" rx="69.09" ry="26.74"/>
<text text-anchor="middle" x="96.87" y="-344.89" font-family="Times-Roman" font-size="14.00">C:{z}{}{t}</text>
<text text-anchor="middle" x="96.87" y="-329.89" font-family="Times-Roman" font-size="14.00">D:{z}</text>
</g>
<!-- node1&#45;&gt;node0 -->
<g id="edge3" class="edge">
<title>node1&#45;&gt;node0</title>
<path fill="none" stroke="black" d="M96.87,-314.16C96.87,-301.88 96.87,-286.99 96.87,-273.6"/>
<polygon fill="black" stroke="black" points="100.37,-273.27 96.87,-263.27 93.37,-273.27 100.37,-273.27"/>
<text text-anchor="middle" x="106.37" y="-285.02" font-family="Times-Roman" font-size="14.00">{}</text>
</g>
<!-- node4 -->
<g id="node5" class="node">
<title>node4</title>
<ellipse fill="none" stroke="black" cx="96.87" cy="-26.87" rx="35.21" ry="26.74"/>
<text text-anchor="middle" x="96.87" y="-30.67" font-family="Times-Roman" font-size="14.00">C:</text>
<text text-anchor="middle" x="96.87" y="-15.67" font-family="Times-Roman" font-size="14.00">D:{}</text>
</g>
<!-- node2&#45;&gt;node4 -->
<g id="edge4" class="edge">
<title>node2&#45;&gt;node4</title>
<path fill="none" stroke="black" d="M96.87,-104.68C96.87,-92.4 96.87,-77.51 96.87,-64.12"/>
<polygon fill="black" stroke="black" points="100.37,-63.79 96.87,-53.79 93.37,-63.79 100.37,-63.79"/>
<text text-anchor="middle" x="106.37" y="-75.54" font-family="Times-Roman" font-size="14.00">{}</text>
</g>
<!-- node3 -->
<g id="node4" class="node">
<title>node3</title>
<ellipse fill="none" stroke="black" cx="96.87" cy="-445.83" rx="96.75" ry="26.74"/>
<text text-anchor="middle" x="96.87" y="-449.63" font-family="Times-Roman" font-size="14.00">C:{x y}{z}{}{t}</text>
<text text-anchor="middle" x="96.87" y="-434.63" font-family="Times-Roman" font-size="14.00">D:{}</text>
</g>
<!-- node3&#45;&gt;node1 -->
<g id="edge5" class="edge">
<title>node3&#45;&gt;node1</title>
<path fill="none" stroke="black" d="M96.87,-418.9C96.87,-406.62 96.87,-391.73 96.87,-378.34"/>
<polygon fill="black" stroke="black" points="100.37,-378.01 96.87,-368.01 93.37,-378.01 100.37,-378.01"/>
<text text-anchor="middle" x="110.87" y="-389.76" font-family="Times-Roman" font-size="14.00">{b}</text>
</g>
<!-- node4&#45;&gt;node4 -->
<g id="edge1" class="edge">
<title>node4&#45;&gt;node4</title>
<path fill="none" stroke="black" d="M129.96,-36.62C141.2,-36.67 150.23,-33.42 150.23,-26.87 150.23,-20.32 141.2,-17.07 129.96,-17.12"/>
<text text-anchor="middle" x="159.73" y="-23.17" font-family="Times-Roman" font-size="14.00">{}</text>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.3 KiB

View File

@ -536,6 +536,49 @@ tab
(list (set 'x 'y) (set 'z) (set) (set 't))
:END:
Let's see what the evolution of =rs1= looks like with the context
sequence =ctx1=.
#+NAME: rs1-sgr
#+HEADER: :var input-rs=munch-sexp(rs1) :var input-ctx=munch-sexp(ctx1)
#+BEGIN_SRC racket :results output drawer
(dotit (ppsg (build-interactive-process (unorg-rs input-rs) (read-ctx input-ctx))))
#+END_SRC
#+RESULTS: rs1-sgr
:RESULTS:
digraph G {
node0 [label="(state (set 'z) (list (set 'z) (set) (set 't)))\n"];
node1 [label="(state (set) (list (set 'x 'y) (set 'z) (set) (set 't)))\n"];
node2 [label="(state (set) '())\n"];
node3 [label="(state (set) (list (set 't)))\n"];
node4 [label="(state (set) (list (set) (set 't)))\n"];
subgraph U {
edge [dir=none];
node2 -> node2 [label="{}"];
}
subgraph D {
node0 -> node4 [label="{}"];
node1 -> node0 [label="{b}"];
node3 -> node2 [label="{}"];
node4 -> node3 [label="{}"];
}
}
:END:
#+BEGIN_SRC dot :file dots/examplevvXFaI.svg :results raw drawer :cmd dot :noweb yes
<<rs1-sgr()>>
#+END_SRC
#+RESULTS:
:RESULTS:
[[file:dots/examplevvXFaI.svg]]
:END:
Note that we need to keep the full context sequence in the name of
each state to avoid confusion between the states at different steps
of the evolution.
* Local Variables :noexport:
# Local Variables:
# eval: (auto-fill-mode)