From 1fa342c2adab0c78753fc7de643ddb539f67a313 Mon Sep 17 00:00:00 2001 From: Sergiu Ivanov Date: Sun, 1 Mar 2020 17:40:36 +0100 Subject: [PATCH] generic: Make fallback-dds-build-state-graph-edges collect duplicate edges. --- generic.rkt | 4 ++-- networks-tests.rkt | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/generic.rkt b/generic.rkt index 4fd82c4..2385937 100644 --- a/generic.rkt +++ b/generic.rkt @@ -5,7 +5,7 @@ ;;; Provides the definition of several generic interfaces for discrete ;;; dynamical systems. -(require racket/generic graph) +(require racket/generic graph "utils.rkt") (provide ;; Generics @@ -41,7 +41,7 @@ [labels empty] [current-states states] [visited-states states] - #:result (values edges labels)) + #:result (collect-by-key edges labels)) ([i step-range] #:break (set-empty? current-states)) (for/fold ([new-edges empty] diff --git a/networks-tests.rkt b/networks-tests.rkt index bcec724..05441df 100644 --- a/networks-tests.rkt +++ b/networks-tests.rkt @@ -185,25 +185,25 @@ (#hash((a . #f) (b . #t)) #hash((a . #t) (b . #t))))) (check-equal? (edge-weight gr-complete-bool-ann #hash((a . #f) (b . #f)) #hash((a . #t) (b . #f))) - (set 'a)) + (list (set 'a))) (check-equal? (edge-weight gr-complete-bool-ann #hash((a . #f) (b . #f)) #hash((a . #f) (b . #f))) - (set 'b)) + (list (set 'b))) (check-equal? (edge-weight gr-complete-bool-ann #hash((a . #t) (b . #f)) #hash((a . #t) (b . #f))) - (set 'b)) + (list (set 'b))) (check-equal? (edge-weight gr-complete-bool-ann #hash((a . #t) (b . #f)) #hash((a . #f) (b . #f))) - (set 'a)) + (list (set 'a))) (check-equal? (edge-weight gr-complete-bool-ann #hash((a . #t) (b . #t)) #hash((a . #f) (b . #t))) - (set 'a)) + (list (set 'a))) (check-equal? (edge-weight gr-complete-bool-ann #hash((a . #t) (b . #t)) #hash((a . #t) (b . #t))) - (set 'b)) + (list (set 'b))) (check-equal? (edge-weight gr-complete-bool-ann #hash((a . #f) (b . #t)) #hash((a . #f) (b . #t))) - (set 'b)) + (list (set 'b))) (check-equal? (edge-weight gr-complete-bool-ann #hash((a . #f) (b . #t)) #hash((a . #t) (b . #t))) - (set 'a)))) + (list (set 'a)))))