(FILECREATED "18-Jun-86 09:59:16" {QV}<NOTECARDS>1.3K>KIRKPATCH007.;1 1920
changes to: (VARS KIRKPATCH007COMS x))
(* Copyright (c) 1986 by Xerox Corporation. All rights reserved.)
(PRETTYCOMPRINT KIRKPATCH007COMS)
(RPAQQ KIRKPATCH007COMS ((* * Changes to NCPROGINT so gathering structures BLOCK)
(FNS NCP.ComputeTransitiveClosure NCP.GetChildren)))
(* * Changes to NCPROGINT so gathering structures BLOCK)
(DEFINEQ
(NCP.ComputeTransitiveClosure
(LAMBDA (startNodes linkTypes depthCutOff) (* kirk: "17-Jun-86 12:14")
(* * Given a set of starting nodes, compute the transitive closure of these links.)
(* * Uses the simplest, stupidest, but most understandable algorithm)
(* * kirk 9Apr86 added a depth and call on NCP.GetChildren)
(* * kirk 24Apr86 Changed so 0 depth is a way to make this a noOp)
(* * kirk 17Jun86 Added BLOCK)
(if (NLISTP startNodes)
then (SETQ startNodes (LIST startNodes)))
(LET ((markedNodes startNodes)
(unvisitedNodes startNodes))
(for depth from 1 to depthCutOff while unvisitedNodes
do (* what nodes have we not yet seen?)
(BLOCK)
(SETQ unvisitedNodes (LDIFFERENCE (NCP.GetChildren unvisitedNodes linkTypes)
markedNodes))
(SETQ markedNodes (UNION markedNodes unvisitedNodes)))
(INTERSECTION markedNodes markedNodes))))
(NCP.GetChildren
(LAMBDA (nodes links) (* kirk: "17-Jun-86 12:14")
(for link in (NCP.GetLinks nodes NIL links) collect (PROGN (BLOCK)
(NCP.GetLinkDestination
link)))))
)
(PUTPROPS KIRKPATCH007 COPYRIGHT ("Xerox Corporation" 1986))
(DECLARE: DONTCOPY
(FILEMAP (NIL (443 1837 (NCP.ComputeTransitiveClosure 453 . 1565) (NCP.GetChildren 1567 . 1835)))))
STOP