Graph algorithms
There is sophisticated built-in support for graphs and graph algorithms
There are lots of built-in graphs obtainable using GraphData, e.g.
Let’s perform a depth-first search on this tree
We start with the root node (33) in our case, and visit each node in the graph by first visiting all the children of a given node before visiting any of its siblings
We will need to find the neighbors of a given node:
We also don’t want to visit our parent, so we will use Cases and Except to skip items