cldigraph
Simple directed graphs for Common Lisp.
DIGRAPH.QUICKUTILS
Package that contains Quickutil utility functions.

Macro
APPENDF
(place &rest lists &environment env)Modifymacro for `append`. Appends `lists` to the place designated by the first argument. 
Function
COMPOSE
(function &rest morefunctions)Returns a function composed of `function` and `morefunctions` that applies its ; arguments to to each in turn, starting from the rightmost of `morefunctions`, and then calling the next one with the primary value of the last. 
Function
CURRY
(function &rest arguments)Returns a function that applies `arguments` and the arguments it is called with to `function`. 
Macro
DOHASH
((key value table &optional result) &body body)Iterate over the hash table `table`, executing `body`, with `key` and `value` bound to the keys and values of the hash table respectively. Return `result` from the iteration form. 
Function
ENSUREBOOLEAN
(x)Convert `x` into a Boolean value. 
Macro
ENSUREGETHASH
(key hashtable &optional default)Like `gethash`, but if `key` is not found in the `hashtable` saves the `default` under key before returning it. Secondary return value is true if key was already in the table. 
Function
ENSURELIST
(list)If `list` is a list, it is returned. Otherwise returns the list designated by `list`. 
Function
MAPHASHKEYS
(function table)Like `maphash`, but calls `function` with each key in the hash table `table`. 
Function
HASHTABLEKEYS
(table)Returns a list containing the keys of hash table `table`. 
Function
MKSTR
(&rest args)Receives any number of objects (string, symbol, keyword, char, number), extracts all printed representations, and concatenates them all into one string. Extracted from _On Lisp_, chapter 4. 
Macro
ONCEONLY
(specs &body forms)Evaluates `forms` with symbols specified in `specs` rebound to temporary variables, ensuring that each initform is evaluated only once. Each of `specs` must either be a symbol naming the variable to be rebound, or of the form: (symbol initform) Bare symbols in `specs` are equivalent to (symbol symbol) Example: (defmacro cons1 (x) (onceonly (x) `(cons ,x ,x))) (let ((y 0)) (cons1 (incf y))) => (1 . 1) 
Function
RCURRY
(function &rest arguments)Returns a function that applies the arguments it is called with and `arguments` to `function`. 
Macro
REMOVEF
(place item &rest removekeywords &environment env)Modifymacro for `remove`. Sets place designated by the first argument to the result of calling `remove` with `item`, place, and the `keywordarguments`. 
Function
SYMB
(&rest args)Receives any number of objects, concatenates all into one string with `#'mkstr` and converts them to symbol. Extracted from _On Lisp_, chapter 4. See also: `symbolicate` 
Macro
WITHGENSYMS
(names &body forms)Binds each variable named by a symbol in `names` to a unique symbol around `forms`. Each of `names` must either be either a symbol, or of the form: (symbol stringdesignator) Bare symbols appearing in `names` are equivalent to: (symbol symbol) The stringdesignator is used as the argument to `gensym` when constructing the unique symbol the named variable will be bound to. 
Macro
WITHUNIQUENAMES
(names &body forms)Binds each variable named by a symbol in `names` to a unique symbol around `forms`. Each of `names` must either be either a symbol, or of the form: (symbol stringdesignator) Bare symbols appearing in `names` are equivalent to: (symbol symbol) The stringdesignator is used as the argument to `gensym` when constructing the unique symbol the named variable will be bound to.
DIGRAPH

Class
DIGRAPH
A directed graph. Use `makedigraph` to create one.
NODES
Reader:DIGRAPHNODES

TEST
Reader:DIGRAPHTEST

HASHFUNCTION
Reader:DIGRAPHHASHFUNCTION


Function
MAKEDIGRAPH
(&key initialvertices (test #'eql) (hashfunction nil))Create and return a new digraph. `initialvertices` can be a sequence of vertices to add to the graph. `test` should be one of the hash table equality predicates. If your Lisp implementation supports the `:hashfunction` argument for creating hash tables with custom predicates, you can specify one with `hashfunction`. 
Function
EMPTYP
(digraph)Return `t` if `digraph` has no vertices or edges, `nil` otherwise. 
Function
VERTICES
(digraph)Return a fresh list of the vertices of `digraph`. 
Function
EDGES
(digraph)Return a fresh list of the edges of `digraph`. Each edge will be a cons of the form `(predecessor . successor)`. 
Function
PREDECESSORS
(digraph vertex)Return a fresh list of the predecessors of `vertex`. 
Function
SUCCESSORS
(digraph vertex)Return a fresh list of the successors of `vertex`. 
Function
NEIGHBORS
(digraph vertex)Return a fresh list of the neighbors of `vertex`. 
Function
CONTAINSVERTEXP
(digraph vertex)Return whether the graph contains `vertex`. 
Function
CONTAINSEDGEP
(digraph predecessor successor)Return whether the graph contains an edge from `predecessor` to `successor`. 
Function
INSERTVERTEX
(digraph vertex)Insert `vertex` into the graph if it is not already a member. Returns `t` if the vertex was already in the graph, or `nil` if it was inserted. 
Function
INSERTEDGE
(digraph predecessor successor)Insert an edge from `predecessor` to `successor` if not already present. The `predecessor` and `successor` vertices must exist in the graph already. Returns `t` if the edge was already in the graph, or `nil` if it was inserted. 
Function
REMOVEEDGE
(digraph predecessor successor)Remove an edge from `predecessor` to `successor` if present. Returns `t` if there was such an edge, or `nil` if not. 
Function
REMOVEVERTEX
(digraph vertex)Remove `vertex` from the graph if present. If there are any edges to/from `vertex` they will be automatically removed. Returns `t` if there was such a vertex, or `nil` if not. 
Function
DEGREE
(digraph vertex)Return the number of neighbors of `vertex`. 
Function
DEGREEIN
(digraph vertex)Return the number of predecessors of `vertex`. 
Function
DEGREEOUT
(digraph vertex)Return the number of successors of `vertex`. 
Function
COUNTVERTICES
(digraph)Return the number of vertices in `digraph`. 
Function
COUNTEDGES
(digraph)Return the number of edges in `digraph`. 
Function
ROOTP
(digraph vertex)Return whether `vertex` is a root vertex in `digraph`. 
Function
LEAFP
(digraph vertex)Return whether `vertex` is a leaf vertex in `digraph`. 
Function
MAPCVERTICES
(function digraph)Call `function` on each vertex in `digraph`. The order in which the vertices are processed is unspecified. Returns `nil`. 
Function
MAPCEDGES
(function digraph)Call `function` on each edge in `digraph`. For each edge, `function` will be called once with two arguments: (function predecessor successor) The order in which the edges are processed is unspecified. Returns `nil`. 
Function
MAPVERTICES
(function digraph)Return a fresh list with the results of calling `function` on each vertex. The order of the resulting list is unspecified. 
Function
MAPEDGES
(function digraph)Return a fresh list with the results of calling `function` on each edge. For each edge, `function` will be called once with two arguments: (function predecessor successor) The order of the resulting list is unspecified. 
Function
COPYDIGRAPH
(digraph)Create a fresh copy of `digraph`. The vertex objects themselves are not copied, but everything else is. 
Function
MAPCDEPTHFIRST
(function digraph startvertex)Apply `function` to the vertices of a depthfirst traversal of `digraph`. Returns `nil`. Vertices are processed in depthfirst order, beginning at `startvertex`. Cycles in the graph will not be traversed into. 
Function
MAPCBREADTHFIRST
(function digraph startvertex)Apply `function` to the vertices of a breadthfirst traversal of `digraph`. Returns `nil`. Vertices are processed in breadthfirst order, beginning at `startvertex`. Cycles in the graph will not be traversed into. 
Function
MAPDEPTHFIRST
(function digraph startvertex)Apply `function` to the vertices of a breadthfirst traversal of `digraph`. Returns a fresh list with the results. Vertices are processed in depthfirst order, beginning at `startvertex`, and the resulting list has this order as well. Cycles in the graph will not be traversed into. 
Function
MAPBREADTHFIRST
(function digraph startvertex)Apply `function` to the vertices of a breadthfirst traversal of `digraph`. Returns a fresh list with the results. Vertices are processed in breadthfirst order, beginning at `startvertex`, and the resulting list has this order as well. Cycles in the graph will not be traversed into. 
Function
ROOTS
(digraph)Return all root vertices in `digraph`. This is currently O(vertices). A root is a vertex with no incoming edges (i.e. indegree 0). 
Function
LEAFS
(digraph)Return all leaf vertices in `digraph`. This is currently O(vertices). A root is a vertex with no outgoing edges (i.e. outdegree 0). 
Function
TOPOLOGICALSORT
(digraph)Return a fresh list of the vertices of `digraph` in topological order. Edges are treated as meaning "depends on", so an edge `A > B` means "A depends on B" and that B must come before A in the resulting list. Aside from this restriction, the order of the resulting list is arbitrary. The order in which the vertices are processed is unspecified. An error will be signaled if the graph contains a cycle. 
Function
REACHABLEP
(digraph start target &key (strategy :breadthfirst))Return `t` if it is possible to reach `target` from `start`, otherwise `nil`. All vertices are reachable from themselves. Otherwise a `target` is reachable from `start` if a directed path exists from the start to the target. `strategy` will be used to determine how to traverse the graph when searching for a path, and can be one of `:breadthfirst` or `:depthfirst`.