networks: Functions for interaction graph explicitly say they use forms.

This commit is contained in:
Sergiu Ivanov 2020-03-22 20:45:11 +01:00
parent 65445e6ba8
commit a77d42af85
2 changed files with 9 additions and 8 deletions

View file

@ -83,8 +83,8 @@
(let* ([n #hash((a . (not b)) (b . a))]
[doms (make-boolean-domains '(a b))]
[sig1 (build-signed-interaction-graph n doms)]
[sig2 (build-boolean-signed-interaction-graph n)])
[sig1 (build-signed-interaction-graph/form n doms)]
[sig2 (build-boolean-signed-interaction-graph/form n)])
(check-equal? (get-interaction-sign (nn n) doms 'a 'b) '+)
(check-equal? (get-interaction-sign (nn n) doms 'b 'a) '-)

View file

@ -32,8 +32,8 @@
[make-boolean-domains (-> (listof variable?) (hash/c variable? (list/c #f #t)))]
[build-all-boolean-states (-> (listof variable?) (listof state?))]
[get-interaction-sign (-> network? domain-mapping/c variable? variable? (or/c '+ '- '0))]
[build-signed-interaction-graph (-> network-form? domain-mapping/c graph?)]
[build-boolean-signed-interaction-graph (-> network-form? graph?)]
[build-signed-interaction-graph/form (-> network-form? domain-mapping/c graph?)]
[build-boolean-signed-interaction-graph/form (-> network-form? graph?)]
[make-asyn (-> (listof variable?) mode?)]
[make-syn (-> (listof variable?) mode?)]
[make-dynamics-from-func (-> network? (-> (listof variable?) mode?) dynamics?)]
@ -291,7 +291,7 @@
;;; /!\ This function iterates through almost all states of the
;;; network for every arrow in the unsigned interaction graph, so its
;;; performance decreases very quickly with the size of the network.
(define (build-signed-interaction-graph network-form doms)
(define (build-signed-interaction-graph/form network-form doms)
(let ([ig (build-interaction-graph network-form)]
[network (network-form->network network-form)])
(weighted-graph/directed
@ -305,9 +305,10 @@
;;;
;;; /!\ The same performance warning applies as for
;;; build-signed-interaction-graph.
(define (build-boolean-signed-interaction-graph network-form)
(build-signed-interaction-graph network-form
(make-boolean-domains (hash-keys network-form))))
(define (build-boolean-signed-interaction-graph/form network-form)
(build-signed-interaction-graph/form
network-form
(make-boolean-domains (hash-keys network-form))))
;;; ====================