1.1--- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2+++ b/notes/20231124.org Fri Nov 24 22:39:07 2023 -0500
1.3@@ -0,0 +1,33 @@
1.4+* cl-dot examples
1.5+#+begin_src lisp
1.6+(defmethod cl-dot:graph-object-node ((graph (eql 'example)) (object cons))
1.7+ (make-instance 'cl-dot:node
1.8+ :attributes '(:label "cell \\N"
1.9+ :shape :box)))
1.10+(defmethod cl-dot:graph-object-points-to ((graph (eql 'example)) (object cons))
1.11+ (list (car object)
1.12+ (make-instance 'cl-dot:attributed
1.13+ :object (cdr object)
1.14+ :attributes '(:weight 3))))
1.15+;; Symbols
1.16+(defmethod cl-dot:graph-object-node ((graph (eql 'example)) (object symbol))
1.17+ (make-instance 'cl-dot:node
1.18+ :attributes `(:label ,object
1.19+ :shape :hexagon
1.20+ :style :filled
1.21+ :color :black
1.22+ :fillcolor "#ccccff")))
1.23+(let* ((data '(a b c #1=(b z) c d #1#))
1.24+ (dgraph (cl-dot:generate-graph-from-roots 'example (list data)
1.25+ '(:rankdir "LR" :layout "twopi" :labelloc "t"))))
1.26+ (cl-dot:dot-graph dgraph "test-lr.svg" :format #+nil :x11 :svg))
1.27+#+end_src
1.28+
1.29+#+RESULTS:
1.30+
1.31+#+begin_src lisp
1.32+(let* ((data '(a b))
1.33+ (dgraph (cl-dot:generate-graph-from-roots 'example (list data)
1.34+ '(:rankdir "LR"))))
1.35+ (cl-dot:print-graph dgraph))
1.36+#+end_src