networks: Functions for interaction graph explicitly say they use forms.
This commit is contained in:
parent
65445e6ba8
commit
a77d42af85
2 changed files with 9 additions and 8 deletions
|
@ -83,8 +83,8 @@
|
||||||
|
|
||||||
(let* ([n #hash((a . (not b)) (b . a))]
|
(let* ([n #hash((a . (not b)) (b . a))]
|
||||||
[doms (make-boolean-domains '(a b))]
|
[doms (make-boolean-domains '(a b))]
|
||||||
[sig1 (build-signed-interaction-graph n doms)]
|
[sig1 (build-signed-interaction-graph/form n doms)]
|
||||||
[sig2 (build-boolean-signed-interaction-graph n)])
|
[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 'a 'b) '+)
|
||||||
(check-equal? (get-interaction-sign (nn n) doms 'b 'a) '-)
|
(check-equal? (get-interaction-sign (nn n) doms 'b 'a) '-)
|
||||||
|
|
||||||
|
|
11
networks.rkt
11
networks.rkt
|
@ -32,8 +32,8 @@
|
||||||
[make-boolean-domains (-> (listof variable?) (hash/c variable? (list/c #f #t)))]
|
[make-boolean-domains (-> (listof variable?) (hash/c variable? (list/c #f #t)))]
|
||||||
[build-all-boolean-states (-> (listof variable?) (listof state?))]
|
[build-all-boolean-states (-> (listof variable?) (listof state?))]
|
||||||
[get-interaction-sign (-> network? domain-mapping/c variable? variable? (or/c '+ '- '0))]
|
[get-interaction-sign (-> network? domain-mapping/c variable? variable? (or/c '+ '- '0))]
|
||||||
[build-signed-interaction-graph (-> network-form? domain-mapping/c graph?)]
|
[build-signed-interaction-graph/form (-> network-form? domain-mapping/c graph?)]
|
||||||
[build-boolean-signed-interaction-graph (-> network-form? graph?)]
|
[build-boolean-signed-interaction-graph/form (-> network-form? graph?)]
|
||||||
[make-asyn (-> (listof variable?) mode?)]
|
[make-asyn (-> (listof variable?) mode?)]
|
||||||
[make-syn (-> (listof variable?) mode?)]
|
[make-syn (-> (listof variable?) mode?)]
|
||||||
[make-dynamics-from-func (-> network? (-> (listof variable?) mode?) dynamics?)]
|
[make-dynamics-from-func (-> network? (-> (listof variable?) mode?) dynamics?)]
|
||||||
|
@ -291,7 +291,7 @@
|
||||||
;;; /!\ This function iterates through almost all states of the
|
;;; /!\ This function iterates through almost all states of the
|
||||||
;;; network for every arrow in the unsigned interaction graph, so its
|
;;; network for every arrow in the unsigned interaction graph, so its
|
||||||
;;; performance decreases very quickly with the size of the network.
|
;;; 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)]
|
(let ([ig (build-interaction-graph network-form)]
|
||||||
[network (network-form->network network-form)])
|
[network (network-form->network network-form)])
|
||||||
(weighted-graph/directed
|
(weighted-graph/directed
|
||||||
|
@ -305,8 +305,9 @@
|
||||||
;;;
|
;;;
|
||||||
;;; /!\ The same performance warning applies as for
|
;;; /!\ The same performance warning applies as for
|
||||||
;;; build-signed-interaction-graph.
|
;;; build-signed-interaction-graph.
|
||||||
(define (build-boolean-signed-interaction-graph network-form)
|
(define (build-boolean-signed-interaction-graph/form network-form)
|
||||||
(build-signed-interaction-graph network-form
|
(build-signed-interaction-graph/form
|
||||||
|
network-form
|
||||||
(make-boolean-domains (hash-keys network-form))))
|
(make-boolean-domains (hash-keys network-form))))
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue