From a074258b1aaf9fe54fb865a22cb5e8d00fac9e2e Mon Sep 17 00:00:00 2001 From: Sergiu Ivanov Date: Thu, 26 Nov 2020 22:13:57 +0100 Subject: [PATCH] networks: Rename and generalize state graph functions. build-full-state-graph and build-full-state-graph-annotated now retrieve the domains from the network and are not limited to Boolean state graphs. --- networks.rkt | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/networks.rkt b/networks.rkt index 13ad415..70c9d46 100644 --- a/networks.rkt +++ b/networks.rkt @@ -66,8 +66,8 @@ [ppsg (-> graph? graph?)] [pretty-print-boolean-state-graph (-> graph? graph?)] [ppsgb (-> graph? graph?)] - [build-full-boolean-state-graph (-> dynamics? graph?)] - [build-full-boolean-state-graph-annotated (-> dynamics? graph?)] + [build-full-state-graph (-> dynamics? graph?)] + [build-full-state-graph-annotated (-> dynamics? graph?)] [build-full-01-state-graph (-> dynamics? graph?)] [build-full-01-state-graph-annotated (-> dynamics? graph?)] [tabulate-state (->* (procedure? domain-mapping/c) (#:headers boolean?) @@ -738,16 +738,22 @@ (define ppsgb pretty-print-boolean-state-graph) ;;; Builds the full state graph of a Boolean network. -(define (build-full-boolean-state-graph dyn) +(define (build-full-state-graph dyn) (dds-build-state-graph dyn - (list->set (build-all-boolean-states (hash-keys (dynamics-network dyn)))))) + ((compose list->set + build-all-states + network-domains + dynamics-network) dyn))) ;;; Build the full annotated state graph of a Boolean network. -(define (build-full-boolean-state-graph-annotated dyn) +(define (build-full-state-graph-annotated dyn) (dds-build-state-graph-annotated dyn - (list->set (build-all-boolean-states (hash-keys (dynamics-network dyn)))))) + ((compose list->set + build-all-states + network-domains + dynamics-network) dyn))) (module+ test (test-case "Dynamics of networks" @@ -761,8 +767,8 @@ (define gr-full (dds-build-state-graph asyn (set s))) (define gr-full-pp (pretty-print-state-graph gr-full)) (define gr-full-ppb (pretty-print-boolean-state-graph gr-full)) - (define gr-complete-bool (build-full-boolean-state-graph asyn)) - (define gr-complete-bool-ann (build-full-boolean-state-graph-annotated asyn)) + (define gr-complete-bool (build-full-state-graph asyn)) + (define gr-complete-bool-ann (build-full-state-graph-annotated asyn)) (check-equal? (dds-step-one asyn s) (set (make-state '((a . #f) (b . #f))) (make-state '((a . #t) (b . #f))))) (check-equal? (dds-step-one-annotated asyn s)