[racket] Graphing Help

From: Andrew Regnery (atregnery at gmail.com)
Date: Thu Mar 21 15:51:08 EDT 2013

Hi All,

I am currently struggling with this function below. Can anyone help me out?


Write the following two functions.

  ; a graph is  ; (make-graph (listof symbol) (symbol -> (listof symbol)))
(define-struct<http://docs.plt-scheme.org/htdp-langs/intermediate-lambda-unchanged.html#(form._((lib._lang%2Fhtdp-intermediate-lambda..rkt)._define-struct))>
 graph (nodes neighbor))    ; has-self-loop? : graph -> boolean  ; Determines
whether any node in the given graph is its own neighbor    ; has-cycle? :
graph -> boolean  ; Determines whether the given graph has a cycle.
A *cycle* is a path from a node to itself, and a *self-loop* is a special
case of a cycle that consists of only a single edge.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20130321/1d43c9d6/attachment-0001.html>

Posted on the users mailing list.