Add dag?.

This commit is contained in:
Sergiu Ivanov 2021-10-31 21:05:42 +01:00
parent a40b1ec187
commit f7c6c89672

View file

@ -35,6 +35,7 @@
bfs bfs/generalized fewest-vertices-path
dfs dfs/generalized
dag?
graphviz)
@ -170,6 +171,8 @@
#:process-unvisited process-unvisited
#:combine combine
#:return finish))
(define (dag? g)
(g:dag? (gg g)))
;; 10 Graphviz
(define (graphviz g #:output [output #f] #:colors [colors #f])
@ -250,6 +253,7 @@
#:combine (-> Any Any Any)
#:return (-> Graph Any Any))
Any)]
[dag? (-> Graph Boolean)]
;; 10 Graphviz
[graphviz (->* (Graph)
@ -349,7 +353,9 @@
'((a . 7) (b . 6) (c . 3) (d . 2)))
(check-equal? (dfs/generalized (directed-graph '((a b) (a c) (b d) (c d))))
(void)))
(void))
(check-true (dag? (directed-graph '((a b) (b c)))))
(check-false (dag? (directed-graph '((a b) (b a))))))
(test-case "10 Graphviz"
(define g (directed-graph '((a b) (b c))))