Add order-smallest-last.

This commit is contained in:
Sergiu Ivanov 2021-11-07 21:08:05 +01:00
parent d855753fa3
commit 8944f221e1

View file

@ -43,6 +43,7 @@
floyd-warshall transitive-closure johnson
coloring coloring/greedy coloring/brelaz
order-smallest-last
graphviz)
@ -222,6 +223,8 @@
(g:coloring/greedy (gg g) #:order order))
(define (coloring/brelaz g)
(g:coloring/brelaz (gg g)))
(define (order-smallest-last g)
(g:order-smallest-last (gg g)))
;; 10 Graphviz
(define (graphviz g #:output [output #f] #:colors [colors #f])
@ -337,6 +340,7 @@
(Values Number
(Mutable-HashTable Any Number)))]
[coloring/brelaz (-> Graph (Mutable-HashTable Any Number))]
[order-smallest-last (-> Graph (Listof Any))]
;; 10 Graphviz
[graphviz (->* (Graph)
@ -552,7 +556,9 @@
'((a . 0) (b . 1) (c . 0) (d . 1)))
(check-equal? (hash->ordered-list (coloring/brelaz g0))
'((a . 0) (b . 1) (c . 0) (d . 1))))
'((a . 0) (b . 1) (c . 0) (d . 1)))
(check-equal? (order-smallest-last g0) '(c d a b)))
(test-case "10 Graphviz"
(define g (directed-graph '((a b) (b c))))