Add has-vertex?.
This commit is contained in:
parent
82b1150444
commit
15681c23ae
|
@ -22,6 +22,7 @@
|
||||||
(require (prefix-in g: graph))
|
(require (prefix-in g: graph))
|
||||||
(provide graph?
|
(provide graph?
|
||||||
directed-graph
|
directed-graph
|
||||||
|
has-vertex?
|
||||||
has-edge?
|
has-edge?
|
||||||
graphviz)
|
graphviz)
|
||||||
|
|
||||||
|
@ -29,6 +30,8 @@
|
||||||
|
|
||||||
(define (directed-graph es [ws #f])
|
(define (directed-graph es [ws #f])
|
||||||
(graph (g:directed-graph es ws)))
|
(graph (g:directed-graph es ws)))
|
||||||
|
(define (has-vertex? g v)
|
||||||
|
(g:has-vertex? (graph-g g) v))
|
||||||
(define (has-edge? g u v)
|
(define (has-edge? g u v)
|
||||||
(g:has-edge? (graph-g g) u v))
|
(g:has-edge? (graph-g g) u v))
|
||||||
(define (graphviz g #:output [output #f] #:colors [colors #f])
|
(define (graphviz g #:output [output #f] #:colors [colors #f])
|
||||||
|
@ -37,6 +40,7 @@
|
||||||
(require/typed 'graph-wrapper
|
(require/typed 'graph-wrapper
|
||||||
[#:opaque Graph graph?]
|
[#:opaque Graph graph?]
|
||||||
[directed-graph (->* ((Listof (List Any Any))) ((Listof Any)) Graph)]
|
[directed-graph (->* ((Listof (List Any Any))) ((Listof Any)) Graph)]
|
||||||
|
[has-vertex? (-> Graph Any Boolean)]
|
||||||
[has-edge? (-> Graph Any Any Boolean)]
|
[has-edge? (-> Graph Any Any Boolean)]
|
||||||
[graphviz (->* (Graph)
|
[graphviz (->* (Graph)
|
||||||
(#:output Output-Port
|
(#:output Output-Port
|
||||||
|
@ -45,4 +49,5 @@
|
||||||
|
|
||||||
(define g (directed-graph '((a b) (b c))))
|
(define g (directed-graph '((a b) (b c))))
|
||||||
(has-edge? g 'a 'c)
|
(has-edge? g 'a 'c)
|
||||||
|
(has-vertex? g 'a)
|
||||||
(graphviz g)
|
(graphviz g)
|
||||||
|
|
Loading…
Reference in New Issue