Browse Source

Add dag?.

master
Sergiu Ivanov 3 months ago
parent
commit
f7c6c89672
  1. 8
      graph.rkt

8
graph.rkt

@ -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))))

Loading…
Cancel
Save