4 (let ((g (make-instance 'graph-container
5 :default-edge-type :directed)))
6 (add-edge-between-vertexes g :a :b)
7 (add-edge-between-vertexes g :a :c)
8 (add-edge-between-vertexes g :b :d)
22 #<GRAPH-CONTAINER 4 #x17D9B526>
24 (defclass* weighted-directed-edge (directed-edge-mixin weighted-edge)
27 (let ((g (make-instance 'graph-container
28 :default-edge-class 'weighted-directed-edge)))
29 (add-edge-between-vertexes g :a :b)
30 (add-edge-between-vertexes g :a :c)
31 (add-edge-between-vertexes g :b :d :weight 2.5)
34 (lambda (e s) (format s "weight=~D" (weight e)))))
48 #<GRAPH-CONTAINER 4 #x17DAFE36>
51 (defun weighted-sum-of-connected-vertexes (vertex)
56 (incf sum (* (weight e) (element (other-vertex e vertex))))))
63 (in-package metabang.graph)
66 (defun is-connected-p (g)
68 (cl-graph::breadth-first-visitor g (first-item g) (lambda (v)
73 (let ((g (make-container 'graph-container))
75 (loop for v in '(a b c d e) do
77 (loop for (v1 . v2) in '((a . b) (a . c) (b . d) (c . e)) do
78 (add-edge-between-vertexes g v1 v2))
82 (let ((g (make-container 'graph-container))
84 (loop for v in '(a b c d e) do
86 (loop for (v1 . v2) in '((a . b) (a . c) (b . d)) do
87 (add-edge-between-vertexes g v1 v2))
98 nearest-common-descendent
103 all-previous-vertexes
104 all-previous-vertexes*
107 add-edge doesn't use force-new? or other args
109 I'd like to be able to (setf (edges g a b) c) or something
111 pull id-pools from AFS to use for graph and edge id's
114 ;;; ---------------------------------------------------------------------------
116 ok - do vertexes know their graph? edges their vertexes?
117 ok - edges can be defined 'generically'
118 ok - in-undirected-cycle-p uses loop instead of iterate-vertexes