changelog shortlog graph tags branches changeset files revisions annotate raw help

Mercurial > org / notes/20231124.org

changeset 15: 27795b18326b
author: ellis <ellis@rwest.io>
date: Fri, 24 Nov 2023 22:39:07 -0500
permissions: -rw-r--r--
description: blog update
1 * cl-dot examples
2 #+begin_src lisp
3 (defmethod cl-dot:graph-object-node ((graph (eql 'example)) (object cons))
4  (make-instance 'cl-dot:node
5  :attributes '(:label "cell \\N"
6  :shape :box)))
7 (defmethod cl-dot:graph-object-points-to ((graph (eql 'example)) (object cons))
8  (list (car object)
9  (make-instance 'cl-dot:attributed
10  :object (cdr object)
11  :attributes '(:weight 3))))
12 ;; Symbols
13 (defmethod cl-dot:graph-object-node ((graph (eql 'example)) (object symbol))
14  (make-instance 'cl-dot:node
15  :attributes `(:label ,object
16  :shape :hexagon
17  :style :filled
18  :color :black
19  :fillcolor "#ccccff")))
20 (let* ((data '(a b c #1=(b z) c d #1#))
21  (dgraph (cl-dot:generate-graph-from-roots 'example (list data)
22  '(:rankdir "LR" :layout "twopi" :labelloc "t"))))
23  (cl-dot:dot-graph dgraph "test-lr.svg" :format #+nil :x11 :svg))
24 #+end_src
25 
26 #+RESULTS:
27 
28 #+begin_src lisp
29 (let* ((data '(a b))
30  (dgraph (cl-dot:generate-graph-from-roots 'example (list data)
31  '(:rankdir "LR"))))
32  (cl-dot:print-graph dgraph))
33 #+end_src