example: Update the presentation of the functions concerning the interaction graphs.

This commit is contained in:
Sergiu Ivanov 2020-11-19 23:48:50 +01:00
parent fe0fbc3ed0
commit 097c5a7f09
3 changed files with 62 additions and 42 deletions

View file

@ -4,11 +4,11 @@
<!-- Generated by graphviz version 2.43.0 (0) <!-- Generated by graphviz version 2.43.0 (0)
--> -->
<!-- Title: G Pages: 1 --> <!-- Title: G Pages: 1 -->
<svg width="437pt" height="48pt" <svg width="446pt" height="48pt"
viewBox="0.00 0.00 437.16 48.40" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> viewBox="0.00 0.00 446.16 48.40" 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 44.4)"> <g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 44.4)">
<title>G</title> <title>G</title>
<polygon fill="white" stroke="transparent" points="-4,4 -4,-44.4 433.16,-44.4 433.16,4 -4,4"/> <polygon fill="white" stroke="transparent" points="-4,4 -4,-44.4 442.16,-44.4 442.16,4 -4,4"/>
<!-- node0 --> <!-- node0 -->
<g id="node1" class="node"> <g id="node1" class="node">
<title>node0</title> <title>node0</title>
@ -19,7 +19,7 @@
<g id="edge1" class="edge"> <g id="edge1" class="edge">
<title>node0&#45;&gt;node0</title> <title>node0&#45;&gt;node0</title>
<path fill="none" stroke="black" d="M403.61,-26.89C414.19,-27.35 423.16,-25.12 423.16,-20.2 423.16,-15.28 414.19,-13.05 403.61,-13.51"/> <path fill="none" stroke="black" d="M403.61,-26.89C414.19,-27.35 423.16,-25.12 423.16,-20.2 423.16,-15.28 414.19,-13.05 403.61,-13.51"/>
<text text-anchor="middle" x="426.16" y="-16.5" font-family="Times-Roman" font-size="14.00">&#45;</text> <text text-anchor="middle" x="430.66" y="-16.5" font-family="Times-Roman" font-size="14.00">&#45;1</text>
</g> </g>
<!-- node1 --> <!-- node1 -->
<g id="node2" class="node"> <g id="node2" class="node">
@ -32,7 +32,7 @@
<title>node0&#45;&gt;node1</title> <title>node0&#45;&gt;node1</title>
<path fill="none" stroke="black" d="M350.86,-20.2C322.78,-20.2 278.85,-20.2 247.63,-20.2"/> <path fill="none" stroke="black" d="M350.86,-20.2C322.78,-20.2 278.85,-20.2 247.63,-20.2"/>
<polygon fill="black" stroke="black" points="247.57,-16.7 237.57,-20.2 247.57,-23.7 247.57,-16.7"/> <polygon fill="black" stroke="black" points="247.57,-16.7 237.57,-20.2 247.57,-23.7 247.57,-16.7"/>
<text text-anchor="middle" x="292.75" y="-24" font-family="Times-Roman" font-size="14.00">+</text> <text text-anchor="middle" x="294.25" y="-24" font-family="Times-Roman" font-size="14.00">1</text>
</g> </g>
<!-- node2 --> <!-- node2 -->
<g id="node3" class="node"> <g id="node3" class="node">
@ -45,14 +45,14 @@
<title>node1&#45;&gt;node2</title> <title>node1&#45;&gt;node2</title>
<path fill="none" stroke="black" d="M184.26,-15.3C152.5,-13.06 98.91,-12.86 63.25,-14.7"/> <path fill="none" stroke="black" d="M184.26,-15.3C152.5,-13.06 98.91,-12.86 63.25,-14.7"/>
<polygon fill="black" stroke="black" points="63.02,-11.21 53.25,-15.3 63.44,-18.19 63.02,-11.21"/> <polygon fill="black" stroke="black" points="63.02,-11.21 53.25,-15.3 63.44,-18.19 63.02,-11.21"/>
<text text-anchor="middle" x="117.26" y="-3.8" font-family="Times-Roman" font-size="14.00">+</text> <text text-anchor="middle" x="118.76" y="-3.8" font-family="Times-Roman" font-size="14.00">1</text>
</g> </g>
<!-- node2&#45;&gt;node1 --> <!-- node2&#45;&gt;node1 -->
<g id="edge4" class="edge"> <g id="edge4" class="edge">
<title>node2&#45;&gt;node1</title> <title>node2&#45;&gt;node1</title>
<path fill="none" stroke="black" d="M53.3,-25.1C85.06,-27.35 138.65,-27.55 174.31,-25.7"/> <path fill="none" stroke="black" d="M53.3,-25.1C85.06,-27.35 138.65,-27.55 174.31,-25.7"/>
<polygon fill="black" stroke="black" points="174.54,-29.2 184.31,-25.1 174.12,-22.21 174.54,-29.2"/> <polygon fill="black" stroke="black" points="174.54,-29.2 184.31,-25.1 174.12,-22.21 174.54,-29.2"/>
<text text-anchor="middle" x="108.81" y="-29.2" font-family="Times-Roman" font-size="14.00">0</text> <text text-anchor="middle" x="106.31" y="-29.2" font-family="Times-Roman" font-size="14.00">&#45;1</text>
</g> </g>
</g> </g>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

View file

@ -12,27 +12,14 @@
<!-- node0 --> <!-- node0 -->
<g id="node1" class="node"> <g id="node1" class="node">
<title>node0</title> <title>node0</title>
<ellipse fill="none" stroke="black" cx="42.25" cy="-105" rx="42.49" ry="18"/> <ellipse fill="none" stroke="black" cx="42.25" cy="-18" rx="42.49" ry="18"/>
<text text-anchor="middle" x="42.25" y="-101.3" font-family="Times-Roman" font-size="14.00">a:1 b:1</text> <text text-anchor="middle" x="42.25" y="-14.3" font-family="Times-Roman" font-size="14.00">a:0 b:1</text>
</g> </g>
<!-- node0&#45;&gt;node0 --> <!-- node0&#45;&gt;node0 -->
<g id="edge1" class="edge"> <g id="edge1" class="edge">
<title>node0&#45;&gt;node0</title> <title>node0&#45;&gt;node0</title>
<path fill="none" stroke="black" d="M80.49,-112.87C92.76,-112.79 102.49,-110.17 102.49,-105 102.49,-99.83 92.76,-97.21 80.49,-97.13"/> <path fill="none" stroke="black" d="M80.49,-25.87C92.76,-25.79 102.49,-23.17 102.49,-18 102.49,-12.83 92.76,-10.21 80.49,-10.13"/>
<text text-anchor="middle" x="116.49" y="-101.3" font-family="Times-Roman" font-size="14.00">{b}</text> <text text-anchor="middle" x="129.49" y="-14.3" font-family="Times-Roman" font-size="14.00">{b}{a}</text>
</g>
<!-- node2 -->
<g id="node3" class="node">
<title>node2</title>
<ellipse fill="none" stroke="black" cx="42.25" cy="-18" rx="42.49" ry="18"/>
<text text-anchor="middle" x="42.25" y="-14.3" font-family="Times-Roman" font-size="14.00">a:0 b:1</text>
</g>
<!-- node0&#45;&gt;node2 -->
<g id="edge5" class="edge">
<title>node0&#45;&gt;node2</title>
<path fill="none" stroke="black" d="M42.25,-86.8C42.25,-75.16 42.25,-59.55 42.25,-46.24"/>
<polygon fill="black" stroke="black" points="45.75,-46.18 42.25,-36.18 38.75,-46.18 45.75,-46.18"/>
<text text-anchor="middle" x="55.75" y="-57.8" font-family="Times-Roman" font-size="14.00">{a}</text>
</g> </g>
<!-- node1 --> <!-- node1 -->
<g id="node2" class="node"> <g id="node2" class="node">
@ -46,11 +33,24 @@
<path fill="none" stroke="black" d="M254.49,-25.87C266.76,-25.79 276.49,-23.17 276.49,-18 276.49,-12.83 266.76,-10.21 254.49,-10.13"/> <path fill="none" stroke="black" d="M254.49,-25.87C266.76,-25.79 276.49,-23.17 276.49,-18 276.49,-12.83 266.76,-10.21 254.49,-10.13"/>
<text text-anchor="middle" x="303.49" y="-14.3" font-family="Times-Roman" font-size="14.00">{b}{a}</text> <text text-anchor="middle" x="303.49" y="-14.3" font-family="Times-Roman" font-size="14.00">{b}{a}</text>
</g> </g>
<!-- node2 -->
<g id="node3" class="node">
<title>node2</title>
<ellipse fill="none" stroke="black" cx="42.25" cy="-105" rx="42.49" ry="18"/>
<text text-anchor="middle" x="42.25" y="-101.3" font-family="Times-Roman" font-size="14.00">a:1 b:1</text>
</g>
<!-- node2&#45;&gt;node0 -->
<g id="edge5" class="edge">
<title>node2&#45;&gt;node0</title>
<path fill="none" stroke="black" d="M42.25,-86.8C42.25,-75.16 42.25,-59.55 42.25,-46.24"/>
<polygon fill="black" stroke="black" points="45.75,-46.18 42.25,-36.18 38.75,-46.18 45.75,-46.18"/>
<text text-anchor="middle" x="55.75" y="-57.8" font-family="Times-Roman" font-size="14.00">{a}</text>
</g>
<!-- node2&#45;&gt;node2 --> <!-- node2&#45;&gt;node2 -->
<g id="edge3" class="edge"> <g id="edge3" class="edge">
<title>node2&#45;&gt;node2</title> <title>node2&#45;&gt;node2</title>
<path fill="none" stroke="black" d="M80.49,-25.87C92.76,-25.79 102.49,-23.17 102.49,-18 102.49,-12.83 92.76,-10.21 80.49,-10.13"/> <path fill="none" stroke="black" d="M80.49,-112.87C92.76,-112.79 102.49,-110.17 102.49,-105 102.49,-99.83 92.76,-97.21 80.49,-97.13"/>
<text text-anchor="middle" x="129.49" y="-14.3" font-family="Times-Roman" font-size="14.00">{b}{a}</text> <text text-anchor="middle" x="116.49" y="-101.3" font-family="Times-Roman" font-size="14.00">{b}</text>
</g> </g>
<!-- node3 --> <!-- node3 -->
<g id="node4" class="node"> <g id="node4" class="node">

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

View file

@ -434,19 +434,19 @@ tab
not to 2. not to 2.
Here's the unsigned syntactic interaction graph of this network: Here's the unsigned syntactic interaction graph of this network:
#+NAME: simple-bn-ig #+NAME: simple-bn-syig
#+BEGIN_SRC racket :results silent :var simple-bn=munch-sexp(simple-bn) #+BEGIN_SRC racket :results silent :var simple-bn=munch-sexp(simple-bn)
(dotit (build-syntactic-interaction-graph (unorgv simple-bn))) (dotit (build-syntactic-interaction-graph (unorgv simple-bn)))
#+END_SRC #+END_SRC
#+BEGIN_SRC dot :file dots/examplejTo8XT.svg :results raw drawer :cmd sfdp :noweb yes #+BEGIN_SRC dot :file dots/examplejTo8XT.svg :results raw drawer :cmd sfdp :noweb yes
<<simple-bn-ig()>> <<simple-bn-syig()>>
#+END_SRC #+END_SRC
#+RESULTS: #+RESULTS:
:RESULTS: :results:
[[file:dots/examplejTo8XT.svg]] [[file:dots/examplejTo8XT.svg]]
:END: :end:
Note that, while this definition is an easy one to check Note that, while this definition is an easy one to check
structurally, this is *not* how interaction graphs are typically structurally, this is *not* how interaction graphs are typically
@ -457,11 +457,36 @@ tab
syntactic interaction graph does not in fact agree with this syntactic interaction graph does not in fact agree with this
criterion, the simplest example being the network y = x \wedge \neg x. criterion, the simplest example being the network y = x \wedge \neg x.
Here is the unsigned interaction graph of the same network, this
time constructed according to the canonical definition:
#+NAME: simple-bn-ig
#+BEGIN_SRC racket :results silent :var simple-bn=munch-sexp(simple-bn)
(dotit (build-interaction-graph/form (unorgv simple-bn) (make-boolean-domains '(a b c))))
#+END_SRC
#+BEGIN_SRC dot :file dots/example1FH1rZ.svg :results raw drawer :cmd sfdp :noweb yes
<<simple-bn-ig()>>
#+END_SRC
#+RESULTS:
:results:
[[file:dots/example1FH1rZ.svg]]
:end:
In this particular case, the syntactic interaction graph is the
same as the interaction graph constructed according to the
conventional definition. This however may not necessarily be the
case for all networks.
The function =build-interaction-graph/form= builds the interaction
graph from the syntactic definition of the network. For an already
built network, you can use =build-interaction-graph=.
Here's the signed interaction graph of this network: Here's the signed interaction graph of this network:
#+NAME: simple-bn-sig #+NAME: simple-bn-sig
#+BEGIN_SRC racket :results silent :var simple-bn=munch-sexp(simple-bn) #+BEGIN_SRC racket :results silent :var simple-bn=munch-sexp(simple-bn)
(dotit (build-boolean-signed-interaction-graph/form (unorgv simple-bn))) (dotit (build-signed-interaction-graph/form (unorgv simple-bn) (make-boolean-domains '(a b c))))
#+END_SRC #+END_SRC
#+BEGIN_SRC dot :file dots/exampledpQygl.svg :results raw drawer :cmd sfdp :noweb yes #+BEGIN_SRC dot :file dots/exampledpQygl.svg :results raw drawer :cmd sfdp :noweb yes
@ -469,14 +494,9 @@ tab
#+END_SRC #+END_SRC
#+RESULTS: #+RESULTS:
:RESULTS: :results:
[[file:dots/exampledpQygl.svg]] [[file:dots/exampledpQygl.svg]]
:END: :end:
For the interaction a \to b, note indeed that when c is #f, b is
always #f (positive interaction). On the other hand, when c is #t,
b becomes (not a) (negative interaction). Therefore, the influence
of a on b is neither activating nor inhibiting.
Here is the full state graph of this network under the asynchronous Here is the full state graph of this network under the asynchronous
dynamics: dynamics:
@ -558,9 +578,9 @@ tab
#+END_SRC #+END_SRC
#+RESULTS: #+RESULTS:
:RESULTS: :results:
[[file:dots/examplei4we6j.svg]] [[file:dots/examplei4we6j.svg]]
:END: :end:
For some networks, a single transition between two states may be For some networks, a single transition between two states may be
due to different modalities. Consider the following network: due to different modalities. Consider the following network:
@ -580,9 +600,9 @@ tab
#+END_SRC #+END_SRC
#+RESULTS: #+RESULTS:
:RESULTS: :results:
[[file:dots/examplehsuRqc.svg]] [[file:dots/examplehsuRqc.svg]]
:END: :end:
** Tabulating functions and networks ** Tabulating functions and networks
Here's how you can tabulate a function. The domain of x is {1, 2}, Here's how you can tabulate a function. The domain of x is {1, 2},