[cl-graph-devel] how to subclass vertices, too?

Gary King gwking at metabang.com
Wed Feb 8 01:51:56 UTC 2006


Hi John,

Use can use the :vertex-class initarg when creating a graph (or as  
a :default-initarg when subclassing) to change the vertex type. E.g.

(make-instance 'graph-container :vertex-class 'my-happy-vertex)

or (from the definition of graph-container):

(defclass* graph-container (iteratable-container-mixin
                             non-associative-container-mixin
                             initial-contents-mixin
                             basic-graph
                             container-uses-nodes-mixin)
   ()
   (:default-initargs
     :vertex-class 'graph-container-vertex
     :directed-edge-class 'graph-container-directed-edge
     :undirected-edge-class 'graph-container-edge)
   (:export-p t)
   (:documentation "A graph container is essentially an adjacency  
list graph representation [?? The Bad name comes from it being  
implemented with containers... ugh]"))

HTH,

On Feb 7, 2006, at 6:43 PM, John Morrison wrote:

> Hi;
>
> I see how to subclass edges (from the last email), but how do I
> subclass vertices, too?  I need to do both (I think) in order to do a
> force-directed layout...
>
> -jm
>
> -- 
> ==== John Morrison
> ==== MAK Technologies Inc.
> ==== 68 Moulton Street, Cambridge, MA 02138
> ==== http://www.mak.com/
> ==== vox:617-876-8085 x115
> ==== fax:617-876-9208
> ==== jm at mak.com
>
> _______________________________________________
> cl-graph-devel mailing list
> cl-graph-devel at common-lisp.net
> http://common-lisp.net/cgi-bin/mailman/listinfo/cl-graph-devel


-- 
Gary Warren King
metabang.com
http://www.metabang.com/





More information about the cl-graph-devel mailing list