Add maximum-bipartite-matching?.

This commit is contained in:
Sergiu Ivanov 2021-11-07 22:38:10 +01:00
parent a544407f68
commit 5a7431f8cf

View file

@ -45,7 +45,7 @@
coloring coloring/greedy coloring/brelaz
order-smallest-last valid-coloring?
maxflow bipartite?
maxflow bipartite? maximum-bipartite-matching
graphviz)
@ -235,6 +235,8 @@
(g:maxflow (gg g) source sink))
(define (bipartite? g)
(g:bipartite? (gg g)))
(define (maximum-bipartite-matching g)
(g:maximum-bipartite-matching (gg g)))
;; 10 Graphviz
(define (graphviz g #:output [output #f] #:colors [colors #f])
@ -356,6 +358,7 @@
;; 9 Maximum Flow
[maxflow (-> Graph Any Any (HashTable (List Any Any) Number))]
[bipartite? (-> Graph (U (List (Listof Any) (Listof Any)) False))]
[maximum-bipartite-matching (-> Graph (Listof (List Any Any)))]
;; 10 Graphviz
[graphviz (->* (Graph)
@ -584,7 +587,8 @@
(define g1 (directed-graph '((a b) (c b))))
(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"
(define g (directed-graph '((a b) (b c))))