Browse Source

Add has-vertex?.

master
Sergiu Ivanov 2 years ago
parent
commit
15681c23ae
  1. 5
      graph.rkt

5
graph.rkt

@ -22,6 +22,7 @@
(require (prefix-in g: graph))
(provide graph?
directed-graph
has-vertex?
has-edge?
graphviz)
@ -29,6 +30,8 @@
(define (directed-graph es [ws #f])
(graph (g:directed-graph es ws)))
(define (has-vertex? g v)
(g:has-vertex? (graph-g g) v))
(define (has-edge? g u v)
(g:has-edge? (graph-g g) u v))
(define (graphviz g #:output [output #f] #:colors [colors #f])
@ -37,6 +40,7 @@
(require/typed 'graph-wrapper
[#:opaque Graph graph?]
[directed-graph (->* ((Listof (List Any Any))) ((Listof Any)) Graph)]
[has-vertex? (-> Graph Any Boolean)]
[has-edge? (-> Graph Any Any Boolean)]
[graphviz (->* (Graph)
(#:output Output-Port
@ -45,4 +49,5 @@
(define g (directed-graph '((a b) (b c))))
(has-edge? g 'a 'c)
(has-vertex? g 'a)
(graphviz g)
Loading…
Cancel
Save