From 5330336b6dce818b6886bdda680bf880e1a7707d Mon Sep 17 00:00:00 2001 From: Sergiu Ivanov Date: Sun, 22 Mar 2020 20:26:04 +0100 Subject: [PATCH] networks: Use '+ and '- as labels in the signed interaction graph. --- example/dots/exampledpQygl.svg | 12 ++++++------ networks-tests.rkt | 8 ++++---- networks.rkt | 3 +-- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/example/dots/exampledpQygl.svg b/example/dots/exampledpQygl.svg index 8e594e7..13d7c8c 100644 --- a/example/dots/exampledpQygl.svg +++ b/example/dots/exampledpQygl.svg @@ -4,11 +4,11 @@ - + G - + node0 @@ -19,7 +19,7 @@ node0->node0 --1 +- @@ -32,7 +32,7 @@ node0->node1 -1 ++ @@ -45,7 +45,7 @@ node1->node2 -1 ++ diff --git a/networks-tests.rkt b/networks-tests.rkt index a97c19d..326500d 100644 --- a/networks-tests.rkt +++ b/networks-tests.rkt @@ -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") diff --git a/networks.rkt b/networks.rkt index 5e4ac60..fada109 100644 --- a/networks.rkt +++ b/networks.rkt @@ -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