hraban / cl-graph

Common Lisp library for manipulating graphs and running graph algorithms
http://common-lisp.net/project/cl-graph/
Other
72 stars 13 forks source link

Graphviz dot export broken? #8

Open enriquefernandez opened 8 years ago

enriquefernandez commented 8 years ago

I'm trying to run the example in the documentation (https://common-lisp.net/project/cl-graph/user-guide.html#header3-18):

(let ((g (make-container 'graph-container :default-edge-type :directed)))  
  (loop for (a b) in '((a b) (b c) (b d) (d e) (e f) (d f)) do  
        (add-edge-between-vertexes g a b))  
  (graph->dot g nil)) 

and I'm getting the following error:

There is no applicable method for the generic function
  #<STANDARD-GENERIC-FUNCTION DOT-ATTRIBUTE-VALUE (1)>
when called with arguments
  (:LABEL #<GRAPH-CONTAINER-DIRECTED-EDGE <#<A> #<B> NIL>>).

Has anything changed?

My old code that used cl-graph and dot export is failing with the same error and I just discovered that the example in the documentation doesn't work either.

Any idea as to why this fails?

Thanks!

daveloyall commented 7 years ago

Well, I had to change make-container to make-graph...

I think the problem is about types. I mean classes? I'm not sure about the terminology...

See where it says (:LABEL #<GRAPH-CONTAINER-DIRECTED-EDGE <#<A> #<B> NIL>>). in our error?

I think it wouldn't be an error if it said (:LABEL #<DOT-DIRECTED-EDGE <#<A> #<B> NIL>>)..

Because, the dot version of an edge does know how to handle :label.

...Right? Tell you what, if I'm wrong, I'll claim that I knew I would be. :)

daveloyall commented 7 years ago

Forget my previous comment, please.

Try this:

(let ((g (make-graph 'dot-graph :default-edge-type :directed)))  
  (loop for (a b) in '((a b) (b c) (b d) (d e) (e f) (d f)) do  
        (add-edge-between-vertexes g a b))  
  (graph->dot g nil))