((section 2 "Outdated egg!" (p "This is an egg for CHICKEN 4, the unsupported old release.  You're almost certainly looking for " (int-link "/eggref/5/graph-scc" "the CHICKEN 5 version of this egg") ", if it exists.") (p "If it does not exist, there may be equivalent functionality provided by another egg; have a look at the " (link "https://wiki.call-cc.org/chicken-projects/egg-index-5.html" "egg index") ". Otherwise, please consider porting this egg to the current version of CHICKEN.") (tags "egg")) (section 2 "graph-scc" (p "Computes strongly-connected components (SCC) of a graph.") (toc)) (section 2 "Usage" (p "(require-extension graph-scc)")) (section 2 "Documentation" (p "The graph-scc library computes the strongly connected components (SCC) of a graph, using Tarjan's algorithm, and a graph object that follows the API of e.g. the " (int-link "digraph" "digraph egg") ".") (section 3 "SCC procedures" (def (sig (procedure "graph-scc-fold:: G F INITIAL -> STATE" (id graph-scc-fold))) (p "SCC graph iterator; every SCC is represented as a list of nodes.  the nodes in each SCC are folded together using the user-supplied  function " (tt "F") ", which is of the form " (tt "LAMBDA SCC STATE"))))) (section 2 "Examples" (pre ";; example adapted from graph example in the Boost library documentation\n(use srfi-1 digraph graph-scc)\n\n(define g (make-digraph 'depgraph \"dependency graph\"))\n\n(define used-by\n   (list \n     (cons 'dax_h 'foo_cpp) (cons 'dax_h 'bar_cpp) (cons 'dax_h 'yow_h)\n     (cons 'yow_h 'bar_cpp) (cons 'yow_h 'zag_cpp) (cons 'boz_h 'bar_cpp)\n     (cons 'boz_h 'zig_cpp) (cons 'boz_h 'zag_cpp) (cons 'zow_h 'foo_cpp)\n     (cons 'foo_cpp 'foo_o) (cons 'foo_o 'libfoobar_a) \n     (cons 'bar_cpp 'bar_o) (cons 'bar_o 'libfoobar_a) \n     (cons 'libfoobar_a 'libzigzag_a)  (cons 'zig_cpp 'zig_o) \n     (cons 'zig_o 'libzigzag_a) (cons 'libfoobar_a 'dax_h) (cons 'zag_cpp 'zag_o) \n     (cons 'zag_o 'libzigzag_a) (cons 'libzigzag_a 'killerapp)))\n\n\n(define node-list (delete-duplicates \n\t\t   (concatenate (list (map car used-by) (map cdr used-by)))))\n\n(define node-ids (list-tabulate (length node-list) values))\n \n(for-each (lambda (i n) ((g 'add-node!) i n)) node-ids node-list)\n(define node-map (zip node-list node-ids))\n\n(for-each (lambda (e) \n\t    (match e ((ni . nj) (let ((i (car (alist-ref ni node-map)))\n\t\t\t\t      (j (car (alist-ref nj node-map))))\n\t\t\t\t  ((g 'add-edge!) (list i j (format \"~A->~A\" ni nj)))))\n\t\t   (else (error \"invalid edge \" e))))\n\t  used-by)\n\n(define roots (map car ((g 'roots))))\n\n;; accumulate all SCC in a list \n(graph-scc-fold g (lambda (scc ax) (cons scc ax)) (list))\n")) (section 2 "About this egg" (section 3 "Author" (p (int-link "/users/ivan-raikov" "Ivan Raikov"))) (section 3 "Version history" (dl (dt "1.9") (dd "Documentation converted to wiki format") (dt "1.8") (dd "Ported to Chicken 4") (dt "1.7") (dd "Now using matchable extension") (dt "1.6") (dd "Updated meta file for testbase") (dt "1.5") (dd "Updated units tests to use testbase") (dt "1.4") (dd "Build script updated for better cross-platform compatibility") (dt "1.3") (dd "eggdoc documentation fix") (dt "1.2") (dd "License upgrade to GPL v3.") (dt "1.1") (dd "Added support for chicken-setup -test") (dt "1.0") (dd "Initial release"))) (section 3 "License" (pre "Copyright 2007-2010 Ivan Raikov and the Okinawa Institute of Science and Technology\n\nThis program is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or (at\nyour option) any later version.\n\nThis program is distributed in the hope that it will be useful, but\nWITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\nGeneral Public License for more details.\n\nA full copy of the GPL license can be found at\n<http://www.gnu.org/licenses/>."))))