From 8944f221e11bda1aacc21c335051b6b4a1aad5c8 Mon Sep 17 00:00:00 2001 From: Sergiu Ivanov Date: Sun, 7 Nov 2021 21:08:05 +0100 Subject: [PATCH] Add order-smallest-last. --- graph.rkt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/graph.rkt b/graph.rkt index f2d4319..bd42118 100644 --- a/graph.rkt +++ b/graph.rkt @@ -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))))