You may be interested in my graph package: http://stchang.github.io/graph/graph.html
To install: raco pkg install graph Example: #lang racket (require graph) (define G (unweighted-graph/directed '((a b) (b c) (c d)))) (dag? G) (add-directed-edge! G 'd 'a) (dag? G) => #t #f On Fri, Feb 14, 2014 at 7:42 AM, Erich Rast <er...@snafu.de> wrote: > I have a directed graph given as list of pairs ((from-node . > to-node) ...) and need to detect whether adding a pair would create a > cycle. > > Is there an easy way to do this already, e.g. some Planet package or > snippet someone would like to share? > > I don't want to reinvent the wheel and this is not a homework question. > > Best, > > Erich > ____________________ > Racket Users list: > http://lists.racket-lang.org/users ____________________ Racket Users list: http://lists.racket-lang.org/users