1 optimize : find-edge-between-vertexes-if
3 Should have delete-item-at-1
5 delete-edge : equal or eql
11 (let ((g (make-instance 'graph-container
12 :default-edge-type :directed)))
13 (add-edge-between-vertexes g :a :b)
14 (add-edge-between-vertexes g :a :c)
15 (add-edge-between-vertexes g :b :d)
29 #<GRAPH-CONTAINER 4 #x17D9B526>
31 (defclass* weighted-directed-edge (directed-edge-mixin weighted-edge)
34 (let ((g (make-instance 'graph-container
35 :default-edge-class 'weighted-directed-edge)))
36 (add-edge-between-vertexes g :a :b)
37 (add-edge-between-vertexes g :a :c)
38 (add-edge-between-vertexes g :b :d :weight 2.5)
41 (lambda (e s) (format s "weight=~D" (weight e)))))
55 #<GRAPH-CONTAINER 4 #x17DAFE36>
58 (defun weighted-sum-of-connected-vertexes (vertex)
63 (incf sum (* (weight e) (element (other-vertex e vertex))))))
70 (in-package metabang.graph)
73 (defun is-connected-p (g)
75 (cl-graph::breadth-first-visitor g (first-item g) (lambda (v)
80 (let ((g (make-container 'graph-container))
82 (loop for v in '(a b c d e) do
84 (loop for (v1 . v2) in '((a . b) (a . c) (b . d) (c . e)) do
85 (add-edge-between-vertexes g v1 v2))
89 (let ((g (make-container 'graph-container))
91 (loop for v in '(a b c d e) do
93 (loop for (v1 . v2) in '((a . b) (a . c) (b . d)) do
94 (add-edge-between-vertexes g v1 v2))
105 nearest-common-descendent
110 all-previous-vertexes
111 all-previous-vertexes*
114 add-edge doesn't use force-new? or other args
116 I'd like to be able to (setf (edges g a b) c) or something
118 pull id-pools from AFS to use for graph and edge id's
121 ;;; ---------------------------------------------------------------------------
123 ok - do vertexes know their graph? edges their vertexes?
124 ok - edges can be defined 'generically'
125 ok - in-undirected-cycle-p uses loop instead of iterate-vertexes