[cl-graph-devel] find-connected-components gives error at subgraph-containing

Deepak Surti dmsurti at gmail.com
Mon Apr 25 13:54:55 UTC 2011


Hi,

I have written some code to create a directed graph reading the graph nodes
from a file.

When I try to find the connected components, it gives an error saying no
applicable method for generic function
subgraph-containing. I am not an expert in CLOS, hence any pointers
appreciated.
*
*
*CODE*

(defun create-graph (file)
  (let ((lines (file-lines file))
        (gd (make-graph 'graph-container
                         :default-edge-type :directed)))
    (mapcar #'(lambda (line)
                (let ((vertices (split-by-one-space line)))
                  (mapcar #'(lambda (v1 v2)
                              (let ((sv1 (intern v1))
                                    (sv2 (intern v2)))
                                (add-vertex gd v1)
                                (add-vertex gd v2)
                                (add-edge-between-vertexes gd sv1 sv2)))
                          (butlast vertices)
                          (cdr vertices))))
            lines)
    gd))

*REPL*

* (setf g (create-graph #P"graph.txt"))

#<GRAPH-CONTAINER [27181,11097] {10038D5471}>

* (connected-components g)

#<METABANG.CL-CONTAINERS:UNION-FIND-CONTAINER {10035D1971}>
* (connected-component-count g)

21648


* (find-connected-components g)

debugger invoked on a SIMPLE-ERROR in thread #<THREAD "initial thread"
RUNNING
                                               {10037317A1}>:
 * There is no applicable method for the generic function*
*    #<STANDARD-GENERIC-FUNCTION SUBGRAPH-CONTAINING (0)>*
*  when called with arguments*
*    (#<GRAPH-CONTAINER [27181,11097] {10038D5471}> #<101> :DEPTH*
*     1152921504606846975).*

Type HELP for debugger help, or (SB-EXT:QUIT) to exit from SBCL.

restarts (invokable by number or by possibly-abbreviated name):
  0: [RETRY] Retry calling the generic function.
  1: [ABORT] Exit debugger, returning to top level.

((SB-PCL::FAST-METHOD NO-APPLICABLE-METHOD (T))
 #<unavailable argument>
 #<unavailable argument>
 #<STANDARD-GENERIC-FUNCTION SUBGRAPH-CONTAINING (0)>)[:EXTERNAL]

Thanks and Regards,
Deepak Surti
-- 
http://deepaksurti.com
You want to see a miracle. Then be the miracle.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/cl-graph-devel/attachments/20110425/d91a3f27/attachment.html>


More information about the cl-graph-devel mailing list