Add max-st-kruskal.

This commit is contained in:
Sergiu Ivanov 2021-10-31 22:02:00 +01:00
parent 40059d1b75
commit 25671ff201
1 changed files with 7 additions and 2 deletions

View File

@ -37,7 +37,7 @@
dfs dfs/generalized
dag? tsort cc cc/bfs scc
min-st-kruskal
min-st-kruskal max-st-kruskal
graphviz)
@ -187,6 +187,8 @@
;; 5 Spanning Trees
(define (min-st-kruskal g)
(g:min-st-kruskal (gg g)))
(define (max-st-kruskal g)
(g:max-st-kruskal (gg g)))
;; 10 Graphviz
(define (graphviz g #:output [output #f] #:colors [colors #f])
@ -275,6 +277,7 @@
;; 5 Spanning Trees
[min-st-kruskal (-> Graph (Listof (List Any Any)))]
[max-st-kruskal (-> Graph (Listof (List Any Any)))]
;; 10 Graphviz
[graphviz (->* (Graph)
@ -391,7 +394,9 @@
(define g0 (weighted-graph/undirected '((1 a b) (2 b c) (3 c a) (4 c d) (5 e a))))
(check-equal? (min-st-kruskal g0)
'((a e) (c d) (c b) (a b))))
'((a e) (c d) (c b) (a b)))
(check-equal? (max-st-kruskal g0)
'((c b) (c a) (c d) (a e))))
(test-case "10 Graphviz"
(define g (directed-graph '((a b) (b c))))