DfsTraits
DfsTraits<
TNode> =object
Defined in: graph/dfs.ts:14
Type Parameters
Section titled “Type Parameters”TNode
Properties
Section titled “Properties”childrenOf
Section titled “childrenOf”childrenOf: (
node) =>Iterable<TNode> |undefined
Defined in: graph/dfs.ts:16
Returns the successors of a node, or undefined/empty for a leaf.
Parameters
Section titled “Parameters”TNode
Returns
Section titled “Returns”Iterable<TNode> | undefined
onEnter?
Section titled “onEnter?”
optionalonEnter?: (node) =>DfsWalkControl|undefined
Defined in: graph/dfs.ts:22
Called on entering a node, before its children. Returning undefined is
treated as DfsWalkContinue.
Parameters
Section titled “Parameters”TNode
Returns
Section titled “Returns”DfsWalkControl | undefined
onExit?
Section titled “onExit?”
optionalonExit?: (node) =>void
Defined in: graph/dfs.ts:29
Called on leaving a node, after its children — including when the walk is
stopping, so a caller undoing state applied in onEnter always gets the
matching call.
Parameters
Section titled “Parameters”TNode
Returns
Section titled “Returns”void
optionalseen?:Set<TNode>
Defined in: graph/dfs.ts:35
Marks nodes already visited, for a cyclic graph. Omit for a tree, where no node is reachable twice and the bookkeeping would be wasted.