Takes a GRAPH and a TEST-FN (a single argument
function returning NIL or non-NIL), and filters the graph nodes
according to the test-fn (those that return non-NIL are accepted),
returning a new graph with only nodes corresponding to those in the
original graph that satisfy the test (the nodes in the new graph are
new, but their values and name point to the same contents of the
original graph). There are four options for how the new graph is
filled-out, depending on the following keywords passed to the optional
GRAPH-COMPLETION-METHOD argument:
* NIL (default)
New graph has only nodes that correspond to those in the original
graph that pass the test. NO LINKS are reproduced.
* :COMPLETE-LINKS
New graph has only nodes that pass, but reproduces corresponding
links between passing nodes in the original graph.
* :COMPLETE-CLOSURE-NODES-ONLY
New graph also includes nodes corresponding to the transitive
closure(s) that include the passign nodes in the original
graph. NO LINKS are reproduced.
* :COMPLETE-CLOSURE-WITH-LINKS
Same as above, except corresponding links are reproduced.
For both transitive closure options, an additional optional argument,
DEPTH, specifies how many links away from a source vertex to travel in
gathering vertexes of the closure. E.g., a depth of 1 returns the
source vertex and the parents and children of that vertex (all
vertexes one link away from the source). The default value is NIL,
indicating that all vertexes are to be included, no matter their
depth. This value is ignored in non closure options.
make-filtered-graph < cl-graph:basic-graph > < t > |