Add maximum-bipartite-matching?.
This commit is contained in:
parent
a544407f68
commit
5a7431f8cf
|
@ -45,7 +45,7 @@
|
||||||
coloring coloring/greedy coloring/brelaz
|
coloring coloring/greedy coloring/brelaz
|
||||||
order-smallest-last valid-coloring?
|
order-smallest-last valid-coloring?
|
||||||
|
|
||||||
maxflow bipartite?
|
maxflow bipartite? maximum-bipartite-matching
|
||||||
|
|
||||||
graphviz)
|
graphviz)
|
||||||
|
|
||||||
|
@ -235,6 +235,8 @@
|
||||||
(g:maxflow (gg g) source sink))
|
(g:maxflow (gg g) source sink))
|
||||||
(define (bipartite? g)
|
(define (bipartite? g)
|
||||||
(g:bipartite? (gg g)))
|
(g:bipartite? (gg g)))
|
||||||
|
(define (maximum-bipartite-matching g)
|
||||||
|
(g:maximum-bipartite-matching (gg g)))
|
||||||
|
|
||||||
;; 10 Graphviz
|
;; 10 Graphviz
|
||||||
(define (graphviz g #:output [output #f] #:colors [colors #f])
|
(define (graphviz g #:output [output #f] #:colors [colors #f])
|
||||||
|
@ -356,6 +358,7 @@
|
||||||
;; 9 Maximum Flow
|
;; 9 Maximum Flow
|
||||||
[maxflow (-> Graph Any Any (HashTable (List Any Any) Number))]
|
[maxflow (-> Graph Any Any (HashTable (List Any Any) Number))]
|
||||||
[bipartite? (-> Graph (U (List (Listof Any) (Listof Any)) False))]
|
[bipartite? (-> Graph (U (List (Listof Any) (Listof Any)) False))]
|
||||||
|
[maximum-bipartite-matching (-> Graph (Listof (List Any Any)))]
|
||||||
|
|
||||||
;; 10 Graphviz
|
;; 10 Graphviz
|
||||||
[graphviz (->* (Graph)
|
[graphviz (->* (Graph)
|
||||||
|
@ -584,7 +587,8 @@
|
||||||
|
|
||||||
(define g1 (directed-graph '((a b) (c b))))
|
(define g1 (directed-graph '((a b) (c b))))
|
||||||
(check-false (bipartite? g0))
|
(check-false (bipartite? g0))
|
||||||
(check-equal? (bipartite? g1) '((b) (a c))))
|
(check-equal? (bipartite? g1) '((b) (a c)))
|
||||||
|
(check-equal? (maximum-bipartite-matching g1) '((c b))))
|
||||||
|
|
||||||
(test-case "10 Graphviz"
|
(test-case "10 Graphviz"
|
||||||
(define g (directed-graph '((a b) (b c))))
|
(define g (directed-graph '((a b) (b c))))
|
||||||
|
|
Loading…
Reference in New Issue