[cl-graph-devel] Problem with find-connected-components
Gary King
gwking at metabang.com
Sat Sep 8 21:45:00 UTC 2007
Hi Daniel,
What you're doing looks to me like it should work. I'll take a look
this weekend and see what's gone wrong.
On Sep 8, 2007, at 4:18 PM, Daniel Katz wrote:
> Hi -
>
> I'm trying out cl-graph, and got as far as creating a simple graph
> but got stopped when I tried to find it's connected components. In
> particular, I tried to build the following graph and get a list of
> the connected subgraphs as follows:
>
> ----------------------------------------------------------------------
> --------------------------------------
> (defun foo ()
> (let ((graph (cl-graph:make-graph 'cl-graph:graph-container)))
> (cl-graph:add-vertex graph "a")
> (cl-graph:add-vertex graph "b")
> (cl-graph:add-vertex graph "c")
> (cl-graph:add-vertex graph "d")
> (cl-graph:add-vertex graph "e")
> (cl-graph:add-edge-between-vertexes graph "a" "b" :edge-
> type :directed)
> (cl-graph:add-edge-between-vertexes graph "b" "c" :edge-
> type :directed)
> (cl-graph:add-edge-between-vertexes graph "c" "a" :edge-
> type :directed)
> (cl-graph:add-edge-between-vertexes graph "d" "e" :edge-
> type :directed)
> (cl-graph:find-connected-components graph)))
> ----------------------------------------------------------------------
> ------------------------------------
>
> which I would expect to return a list of two subgraphs (one for a-b-
> c component and one for d-e component). Instead, I ended up in
> the debugger as follows:
>
> ----------------------------------------------------------------------
> -----------------------------------
> > (foo)
>
> keyword argument not a symbol: 536870911.
> [Condition of type SB-INT:SIMPLE-PROGRAM-ERROR]
>
> Restarts:
> 0: [ABORT] Return to SLIME's top level.
> 1: [ABORT] Exit debugger, returning to top level.
>
> Backtrace:
> 0: (SB-PCL::CHECK-APPLICABLE-KEYWORDS 0 (:NEW-GRAPH :DEPTH)
> 8397616 1)
> 1: ((LAMBDA
> (SB-PCL::.PV-CELL. SB-PCL::.NEXT-METHOD-CALL.
> #1="#<...>" . #1#))
> #<unused argument>
> #<unused argument>
> #<CL-GRAPH:GRAPH-CONTAINER [5,4] {1261BFC9}>
> #<b>
> 8397616
> 1)
> 2: ((LAMBDA (METABANG.CL-CONTAINERS::ITEM)) #<UFN: #<b>, 1
> {126266B9}>)
> 3: ((SB-PCL::FAST-METHOD METABANG.CL-CONTAINERS:ITERATE-FORWARD
> (METABANG.CL-CONTAINERS::BASIC-ITERATOR T))
> #<unavailable argument>
> #<unavailable argument>
> #<CHAINS-TEST::UNIQUE-VALUE-ITERATOR-MIXIN-AND-TRANSFORMING-
> ITERATOR-MIXIN-AND-HASH-TABLE-ITERATOR T {126279D9}>
> #<CLOSURE (LAMBDA #) {126287A5}>)
> 4: (METABANG.CL-CONTAINERS::COLLECTOR-INTERNAL
> #<CHAINS-TEST::UNIQUE-VALUE-ITERATOR-MIXIN-AND-TRANSFORMING-
> ITERATOR-MIXIN-AND-HASH-TABLE-ITERATOR T {126279D9}>
> #<STANDARD-GENERIC-FUNCTION METABANG.CL-CONTAINERS:ITERATE-
> ELEMENTS (10)>
> NIL
> #<CLOSURE (LAMBDA #) {1262878D}>)
> 5: (SB-INT:SIMPLE-EVAL-IN-LEXENV (FOO) #<NULL-LEXENV>)
> ----------------------------------------------------------------------
> ---------------------------
>
> Clearly the number 536870911 is just MOST-POSITIVE-FIXNUM (I'm
> running sbcl 1.0.7 on Mac OS X)
>
> ----------------------------------------------------------------------
> ---------------------------
> > most-positive-fixnum
> 536870911
> ----------------------------------------------------------------------
> --------------------------
>
> which is used in the code for find-connected-components, but before
> I start digging into that code, I thought I'd ask here if I was
> doing something stupid first.
>
>
> So: should the function foo I defined above work? And if so, what
> should I be expecting it to return?
>
>
> Thanks!
>
> Dan
>
> _______________________________________________
> 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
Cell: (413) 559 8738
Fax: (206) 338-4052
gwkkwg on Skype * garethsan on AIM
More information about the cl-graph-devel
mailing list