Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Perform a depth-first scan of a tree with access to computations made on the current vertex's ancestors
ResourceFunction["AncestralTreeScan"][function,outputFunction,tree] performs a depth-first scan of function over tree, where function is passed the history of computations performed at ancestral vertices. |
Create a tree:
In[1]:= | ![]() |
Out[1]= | ![]() |
Scan the tree:
In[2]:= | ![]() |
Create a tree whose vertices are numbers:
In[3]:= | ![]() |
Out[3]= | ![]() |
Find each sequence of incremental sums from the root to a vertex, without having to repeat the computation of any partial sums:
In[4]:= | ![]() |
Store all permutations of {a,b,c,d} as paths from the root id to leaves:
In[5]:= | ![]() |
Out[5]= | ![]() |
Associate each of a,b,c,d with square matrices, and id with the identity matrix:
In[6]:= | ![]() |
Out[6]= | ![]() |
Find all matrix products involving each matrix at most once without having to repeat subcomputations or store more than five matrix products at a time:
In[7]:= | ![]() |
Wolfram Language 13.0 (December 2021) or above
This work is licensed under a Creative Commons Attribution 4.0 International License