Skip to content

trying to understand why graph->dot is failing #12

@arademaker

Description

@arademaker

I am trying to use cl-graph with https://github.com/own-pt/cl-conllu library. This library read conllu files (http://universaldependencies.org/format.html -- with a sentence tokenized). The library implements a class for a sentence that contains tokens (another class).

The first part works:

(let* ((sent (car (read-conllu #P"CF107.conllu")))
		(tks  (sentence-tokens sent))
		(g (cl-graph:make-graph 'cl-graph:graph-container)))
	   (dolist (tk tks g)
	     (if (equal "0" (token-head tk))
		 (add-vertex g tk)
		 (add-edge-between-vertexes g tk (nth (token-head tk) tks) :edge-type :directed))))

But it seems the problem is with the edges when I try:

(cl-graph:graph->dot
	  *
	  nil
	  :vertex-labeler 
	  (lambda (vertex stream)
	    (format stream "~(~A~)" (token-form (element vertex))))
	  :edge-formatter
	  (lambda (edge stream)
	    (format stream "~a" (element edge))))

I got

There is no applicable method for the generic function
  #<STANDARD-GENERIC-FUNCTION CL-GRAPH:DOT-ATTRIBUTE-VALUE (1)>
when called with arguments
  (:LABEL
   #<GRAPH-CONTAINER-DIRECTED-EDGE <#<#<TOKEN {100301C313}>> #<#<TOKEN {100301B153}>> NIL>>).
   [Condition of type SIMPLE-ERROR]

What did I miss?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions