fix visited
This commit is contained in:
parent
fc14f5ee76
commit
d727e41a07
|
@ -26,8 +26,10 @@
|
|||
#:init (or (and (item? $v) (set-member? held (item-name $v)))
|
||||
(conj? $v)
|
||||
(and (requirement? $v) (empty? (get-neighbors G $v)))))
|
||||
(define-vertex-property G visited? #:init #f)
|
||||
(do-dfs G
|
||||
#:visit?: #t
|
||||
#:prologue: (visited?-set! $to #t)
|
||||
#:visit?: (not (visited? $to))
|
||||
#:epilogue: (cond
|
||||
[(and (conj? $from) (not (attainable? $to)))
|
||||
(attainable?-set! $from #f)]
|
||||
|
@ -39,6 +41,7 @@
|
|||
(define requirements
|
||||
(hash "a" (list (list "apples" "bananas" "meows") (list "bananas") (list "c"))
|
||||
"b" '()
|
||||
"d" (list (list "apples" "d"))
|
||||
"c" (list (list "apples" "meows"))))
|
||||
(define held (set "apples" "bananas" "clementines"))
|
||||
|
||||
|
|
Loading…
Reference in New Issue