# HG changeset patch # User Steve Losh # Date 1675910578 18000 # Node ID 91b9b04d69145e221f113de82e5768cce2b2f5cd # Parent f11da0d6a058484c457f545348df842988c4b529# Parent 63712529f020071f133f66f32380d7933e8d9169 Merge diff -r 63712529f020 -r 91b9b04d6914 docs/04-reference-dot.markdown --- a/docs/04-reference-dot.markdown Tue Aug 24 21:15:58 2021 -0400 +++ b/docs/04-reference-dot.markdown Wed Feb 08 21:42:58 2023 -0500 @@ -9,7 +9,7 @@ ### `DRAW` (function) - (DRAW DIGRAPH &KEY (FILENAME digraph.png) (FORMAT :PNG)) + (DRAW DIGRAPH &KEY (FILENAME digraph.png) (FORMAT :PNG) (SHAPE :CIRCLE)) Draw `digraph` with cl-dot. diff -r 63712529f020 -r 91b9b04d6914 docs/05-changelog.markdown --- a/docs/05-changelog.markdown Tue Aug 24 21:15:58 2021 -0400 +++ b/docs/05-changelog.markdown Wed Feb 08 21:42:58 2023 -0500 @@ -5,6 +5,11 @@ [TOC] +v1.5.0 +------ + +Added `shape` argument to `digraph.dot:draw` to change the shape of the nodes. + v1.4.0 ------ diff -r 63712529f020 -r 91b9b04d6914 src/dot.lisp --- a/src/dot.lisp Tue Aug 24 21:15:58 2021 -0400 +++ b/src/dot.lisp Wed Feb 08 21:42:58 2023 -0500 @@ -19,21 +19,21 @@ (defparameter *current-digraph* nil) -(defparameter *vertex-shape* :circle - "The shape to use for vertex nodes. Must be a valid cl-dot :shape node attribute.") +(defparameter *shape* nil) (defmethod cl-dot:graph-object-node ((graph (eql 'digraph)) (vertex t)) (make-instance 'cl-dot:node - :attributes `(:label ,(format nil "~A" vertex) :shape ,*vertex-shape*))) + :attributes `(:label ,(format nil "~A" vertex) :shape ,*shape*))) (defmethod cl-dot:graph-object-points-to ((graph (eql 'digraph)) (vertex t)) (successors *current-digraph* vertex)) -(defun draw (digraph &key (filename "digraph.png") (format :png)) +(defun draw (digraph &key (filename "digraph.png") (format :png) (shape :circle)) "Draw `digraph` with cl-dot." - (let ((*current-digraph* digraph)) + (let ((*current-digraph* digraph) + (*shape* shape)) (cl-dot:dot-graph (cl-dot:generate-graph-from-roots 'digraph (find-dot-roots digraph)) filename