Thanks for the positive feedback.
Here is a slightly modified version using a curried definition.
I am using the algorithm to color live intervals in order to do register
allocation.
(use-modules (srfi srfi-1) (srfi srfi-26) (ice-9 curried-definitions))
(define (dot graph colors)
What a delight! Thank you for this elegant snippet :)
Andy
On Fri 14 Nov 2014 19:16, Jan Wedekind writes:
> Hi,
> Here is an implementation [1] of Chaitin's graph coloring algorithm
> using GNU Guile and Graphviz. Any feedback and suggestions are
> welcome. Let me know if you can make the impl
Forgot to use the ordering actually. It needs to be:
(define (coloring graph nodes) (assign-colors graph (nodes graph) (order graph
(nodes graph
Or one can do the ordering directly within the "assign-colors" function:
(define (assign-colors graph nodes colors)
(if (null? nodes) '()
(
Hi,
Here is an implementation [1] of Chaitin's graph coloring algorithm using
GNU Guile and Graphviz. Any feedback and suggestions are welcome. Let me know if you
can make the implementation more concise ;)
Regards Jan
(use-modules (srfi srfi-1)
(srfi srfi-26))
(define (dot graph