Add some tests for building signed interaction graphs from networks.
Previously I only had functions for building interaction graphs from forms. These do not play well with networks randomly generated from truth tables.
This commit is contained in:
parent
b79bae9d67
commit
ac2d03f953
1 changed files with 10 additions and 2 deletions
|
@ -84,7 +84,8 @@
|
|||
(let* ([n #hash((a . (not b)) (b . a))]
|
||||
[doms (make-boolean-domains '(a b))]
|
||||
[sig1 (build-signed-interaction-graph/form n doms)]
|
||||
[sig2 (build-boolean-signed-interaction-graph/form n)])
|
||||
[sig2 (build-boolean-signed-interaction-graph/form n)]
|
||||
[sig3 (build-boolean-signed-interaction-graph (nn n))])
|
||||
(check-equal? (get-interaction-sign (nn n) doms 'a 'b) '+)
|
||||
(check-equal? (get-interaction-sign (nn n) doms 'b 'a) '-)
|
||||
|
||||
|
@ -108,7 +109,14 @@
|
|||
(check-false (has-edge? sig2 'c 'b))
|
||||
(check-false (has-edge? sig2 'c 'a))
|
||||
(check-equal? (edge-weight sig2 'a 'b) '+)
|
||||
(check-equal? (edge-weight sig2 'b 'a) '-)))
|
||||
(check-equal? (edge-weight sig2 'b 'a) '-)
|
||||
|
||||
(check-true (has-vertex? sig3 'a))
|
||||
(check-true (has-vertex? sig3 'b))
|
||||
(check-equal? (edge-weight sig3 'a 'a) '+)
|
||||
(check-equal? (edge-weight sig3 'b 'b) '+)
|
||||
(check-equal? (edge-weight sig3 'a 'b) '+)
|
||||
(check-equal? (edge-weight sig3 '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")
|
||||
|
|
Loading…
Reference in a new issue