Browse Source

Add max-st-kruskal.

master
Sergiu Ivanov 10 months ago
parent
commit
25671ff201
  1. 9
      graph.rkt

9
graph.rkt

@ -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))))

Loading…
Cancel
Save