DepthFirstTraversal
DepthFirstTraversal[g,v]
performs a depth-first traversal of graph g starting from vertex v, and gives a list of vertices in the order in which they were encountered.
DepthFirstTraversal[g,v,Edge]
returns the edges of the graph that are traversed by the depth-first traversal in the order in which they are traversed.
DepthFirstTraversal[g,v,Tree]
returns the depth-first tree of the graph.
Details and Options
- DepthFirstTraversal functionality is now available in the built-in Wolfram Language function DepthFirstScan.
- To use DepthFirstTraversal, you first need to load the Combinatorica Package using Needs["Combinatorica`"].
Examples
Basic Examples (2)Summary of the most common use cases
https://wolfram.com/xid/0jjcp8cvr5kjai7s-rmcvi
https://wolfram.com/xid/0jjcp8cvr5kjai7s-kog7jp
https://wolfram.com/xid/0jjcp8cvr5kjai7s-c7xwog
https://wolfram.com/xid/0jjcp8cvr5kjai7s-g8ga0g
DepthFirstTraversal has been superseded by DepthFirstScan:
https://wolfram.com/xid/0jjcp8cvr5kjai7s-ec1xd2
https://wolfram.com/xid/0jjcp8cvr5kjai7s-gtwffv
Wolfram Research (2012), DepthFirstTraversal, Wolfram Language function, https://reference.wolfram.com/language/Combinatorica/ref/DepthFirstTraversal.html.
Text
Wolfram Research (2012), DepthFirstTraversal, Wolfram Language function, https://reference.wolfram.com/language/Combinatorica/ref/DepthFirstTraversal.html.
Wolfram Research (2012), DepthFirstTraversal, Wolfram Language function, https://reference.wolfram.com/language/Combinatorica/ref/DepthFirstTraversal.html.
CMS
Wolfram Language. 2012. "DepthFirstTraversal." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/Combinatorica/ref/DepthFirstTraversal.html.
Wolfram Language. 2012. "DepthFirstTraversal." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/Combinatorica/ref/DepthFirstTraversal.html.
APA
Wolfram Language. (2012). DepthFirstTraversal. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/Combinatorica/ref/DepthFirstTraversal.html
Wolfram Language. (2012). DepthFirstTraversal. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/Combinatorica/ref/DepthFirstTraversal.html
BibTeX
@misc{reference.wolfram_2024_depthfirsttraversal, author="Wolfram Research", title="{DepthFirstTraversal}", year="2012", howpublished="\url{https://reference.wolfram.com/language/Combinatorica/ref/DepthFirstTraversal.html}", note=[Accessed: 23-January-2025
]}
BibLaTeX
@online{reference.wolfram_2024_depthfirsttraversal, organization={Wolfram Research}, title={DepthFirstTraversal}, year={2012}, url={https://reference.wolfram.com/language/Combinatorica/ref/DepthFirstTraversal.html}, note=[Accessed: 23-January-2025
]}