diff --git a/dynamics.rkt b/dynamics.rkt index 289c177..1e40397 100644 --- a/dynamics.rkt +++ b/dynamics.rkt @@ -24,13 +24,18 @@ (step s))))) (: build-state-graph (-> (Listof State) Graph)) - (define/abstract/error (build-state-graph sts)) + (define/public (build-state-graph sts) + (build-state-graph* sts 'full)) (: build-state-graph/annotated (-> (Listof State) Graph)) - (define/abstract/error (build-state-graph/annotated sts)) + (define/public (build-state-graph/annotated sts) + (build-state-graph*/annotated sts 'full)) (: build-state-graph* (-> (Listof State) (U Positive-Integer 'full) Graph)) - (define/abstract/error (build-state-graph* sts nsteps)) + (define/public (build-state-graph* sts nsteps) + (unweighted-graph/directed + (assert-type (get-edges (build-state-graph*/annotated sts nsteps)) + (Listof (List Any Any))))) (: build-state-graph*/annotated (-> (Listof State) (U Positive-Integer 'full) Graph)) (define/public (build-state-graph*/annotated sts nsteps) diff --git a/networks.rkt b/networks.rkt index cb8ce2a..b377629 100644 --- a/networks.rkt +++ b/networks.rkt @@ -567,8 +567,17 @@ (check-equal? (graphviz (send dyn-syn build-state-graph*/annotated (list s1) 'full)) "digraph G {\n\tnode0 [label=\"'#hash((x . #t) (y . #f) (z . #f))\"];\n\tnode1 [label=\"'#hash((x . #f) (y . #t) (z . #f))\"];\n\tnode2 [label=\"'#hash((x . #t) (y . #t) (z . #f))\"];\n\tnode3 [label=\"'#hash((x . #f) (y . #f) (z . #f))\"];\n\tsubgraph U {\n\t\tedge [dir=none];\n\t}\n\tsubgraph D {\n\t\tnode0 -> node2 [label=\"'(x y z)\"];\n\t\tnode1 -> node3 [label=\"'(x y z)\"];\n\t\tnode2 -> node1 [label=\"'(x y z)\"];\n\t\tnode3 -> node0 [label=\"'(x y z)\"];\n\t}\n}\n") ) - ) - ) + (test-case "dynamics%:build-state-graph*" + (check-equal? (graphviz (send dyn-syn build-state-graph* (list s1) 2)) + "digraph G {\n\tnode0 [label=\"'#hash((x . #t) (y . #f) (z . #f))\"];\n\tnode1 [label=\"'#hash((x . #f) (y . #f) (z . #f))\"];\n\tnode2 [label=\"'#hash((x . #t) (y . #t) (z . #f))\"];\n\tsubgraph U {\n\t\tedge [dir=none];\n\t}\n\tsubgraph D {\n\t\tnode0 -> node2 [];\n\t\tnode1 -> node0 [];\n\t}\n}\n") + (check-equal? (graphviz (send dyn-syn build-state-graph* (list s1) 'full)) + "digraph G {\n\tnode0 [label=\"'#hash((x . #t) (y . #f) (z . #f))\"];\n\tnode1 [label=\"'#hash((x . #f) (y . #f) (z . #f))\"];\n\tnode2 [label=\"'#hash((x . #f) (y . #t) (z . #f))\"];\n\tnode3 [label=\"'#hash((x . #t) (y . #t) (z . #f))\"];\n\tsubgraph U {\n\t\tedge [dir=none];\n\t}\n\tsubgraph D {\n\t\tnode0 -> node3 [];\n\t\tnode1 -> node0 [];\n\t\tnode2 -> node1 [];\n\t\tnode3 -> node2 [];\n\t}\n}\n")) + (test-case "dynamics%:build-state-graph/annotated" + (check-equal? (graphviz (send dyn-syn build-state-graph/annotated (list s1))) + (graphviz (send dyn-syn build-state-graph*/annotated (list s1) 'full)))) + (test-case "dynamics%:build-state-graph" + (check-equal? (graphviz (send dyn-syn build-state-graph (list s1))) + (graphviz (send dyn-syn build-state-graph* (list s1) 'full)))))) ) (require 'typed)