networks: Use '+ and '- as labels in the signed interaction graph.

This commit is contained in:
Sergiu Ivanov 2020-03-22 20:26:04 +01:00
parent e7b35a451c
commit 5330336b6d
3 changed files with 11 additions and 12 deletions

View File

@ -4,11 +4,11 @@
<!-- Generated by graphviz version 2.43.0 (0)
-->
<!-- Title: G Pages: 1 -->
<svg width="446pt" height="48pt"
viewBox="0.00 0.00 446.16 48.40" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<svg width="437pt" 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">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 44.4)">
<title>G</title>
<polygon fill="white" stroke="transparent" points="-4,4 -4,-44.4 442.16,-44.4 442.16,4 -4,4"/>
<polygon fill="white" stroke="transparent" points="-4,4 -4,-44.4 433.16,-44.4 433.16,4 -4,4"/>
<!-- node0 -->
<g id="node1" class="node">
<title>node0</title>
@ -19,7 +19,7 @@
<g id="edge1" class="edge">
<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"/>
<text text-anchor="middle" x="430.66" y="-16.5" font-family="Times-Roman" font-size="14.00">&#45;1</text>
<text text-anchor="middle" x="426.16" y="-16.5" font-family="Times-Roman" font-size="14.00">&#45;</text>
</g>
<!-- node1 -->
<g id="node2" class="node">
@ -32,7 +32,7 @@
<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"/>
<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="294.25" y="-24" font-family="Times-Roman" font-size="14.00">1</text>
<text text-anchor="middle" x="292.75" y="-24" font-family="Times-Roman" font-size="14.00">+</text>
</g>
<!-- node2 -->
<g id="node3" class="node">
@ -45,7 +45,7 @@
<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"/>
<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="118.76" y="-3.8" font-family="Times-Roman" font-size="14.00">1</text>
<text text-anchor="middle" x="117.26" y="-3.8" font-family="Times-Roman" font-size="14.00">+</text>
</g>
<!-- node2&#45;&gt;node1 -->
<g id="edge4" class="edge">

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

@ -96,8 +96,8 @@
(check-false (has-edge? sig1 'b 'b))
(check-false (has-edge? sig1 'c 'b))
(check-false (has-edge? sig1 'c 'a))
(check-equal? (edge-weight sig1 'a 'b) 1)
(check-equal? (edge-weight sig1 'b 'a) -1)
(check-equal? (edge-weight sig1 'a 'b) '+)
(check-equal? (edge-weight sig1 'b 'a) '-)
(check-true (has-vertex? sig2 'a))
(check-true (has-vertex? sig2 'b))
@ -107,8 +107,8 @@
(check-false (has-edge? sig2 'b 'b))
(check-false (has-edge? sig2 'c 'b))
(check-false (has-edge? sig2 'c 'a))
(check-equal? (edge-weight sig2 'a 'b) 1)
(check-equal? (edge-weight sig2 'b 'a) -1)))
(check-equal? (edge-weight sig2 'a 'b) '+)
(check-equal? (edge-weight sig2 'b 'a) '-)))
(test-case "Dynamics of networks"
(check-equal? (pretty-print-state (st '((a . #f) (b . 3) (c . 4)))) "a:#f b:3 c:4")

View File

@ -297,8 +297,7 @@
(weighted-graph/directed
(for/list ([e (in-edges ig)])
(match-let ([(list x y) e])
(list (match (get-interaction-sign network-form doms x y)
['+ 1] ['- -1] ['0 0])
(list (get-interaction-sign network-form doms x y)
x y))))))
;;; Calls build-signed-interaction-graph with the Boolean domain for