SHIFT + D

directed acyclic depth-first steps

Updated on August 22, 2024Source codeTests

createDirectedAcyclicDepthFirstSteps is a pipe that transforms a directed acyclic graph to depth-first steps through the graph.

Your created directedAcyclicDepthFirstSteps function is a generator that yields each step separately.

Create depth-first steps

Call createDirectedAcyclicDepthFirstSteps with no parameters to create your directedAcyclicDepthFirstSteps function.

Call createDirectedAcyclicDepthFirstSteps with these parameters to create your directedAcyclicDepthFirstSteps function:

Parameter
Type
Required
Description
options
Object
no
Options to customize the behavior of the directedAcyclicDepthFirstSteps function. See the Options section for more guidance.

Options

Option
Type
Default
Description
root
GraphNode (String)
See description

The root node where directedAcyclicDepthFirstSteps should start its traversal.

If you don't pass a root node, directedAcyclicDepthFirstSteps will default to searching the array of nodes to find the first root node, as defined by createRoot.

toSetMetadata
Function
(node, totalConnectionsTraversed) => totalConnectionsTraversed

When stepping through the graph

ON THIS PAGE

directed acyclic depth-first stepsCreate depth-first stepsOptions