http://landoflisp.com/graph-util.lisp
(defun uedges->dot (edges);draw undirected graphs
(maplist (lambda (lst)
(mapc (lambda (edge)
(unless (assoc (car edge) (cdr lst))
(fresh-line)
(princ (dot-name (caar lst)))
(princ "--")
(princ (dot-name (car edge)))
(princ "[label=\"")
(princ (dot-label (cdr edge)))
(princ "\"];")))
(cdar lst)))
edges))
我认为这个功能有问题,有人可以解决吗?
答案 0 :(得分:1)
我自己解决了。我希望有人在研究lisp p125 uedges-dot功能的土地时要小心。
(defun uedges->dot (edges);draw undirected graphs
(maplist (lambda (lst)
(mapc (lambda (edge)
(unless (assoc (caar lst)
(cdr (assoc (car edge) (cdr lst))));<-----modify 'unless'
(fresh-line)
(princ (dot-name (caar lst)))
(princ "--")
(princ (dot-name (car edge)))
(princ "[label=\"")
(princ (dot-label (cdr edge)))
(princ "\"];")))
(cdar lst)))
edges))