Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Construct a graph by folding a list of arguments
ResourceFunction["FoldGraph"][f,{x1,x2,…},{y1,y2,…}] constructs a graph with edges for each output of a multioutput function f applied to inputs xi and iteratively to each yi. | |
ResourceFunction["FoldGraph"][f,x,{y1,y2,…}] is equivalent to ResourceFunction["FoldGraph"][f,{x},{y1,y2,…}]. | |
ResourceFunction["FoldGraph"][f,{x,y1,y2,…}] is equivalent to ResourceFunction["FoldGraph"][f,{x},{y1,y2,…}]. | |
ResourceFunction["FoldGraph"][f] represents an operator form of ResourceFunction["FoldGraph"] that can be applied to expressions. |
Fold a single output function to make a graph:
In[1]:= |
Out[1]= |
Use the first element of the list as an initial vertex:
In[2]:= |
Out[2]= |
Fold with multiple inputs:
In[3]:= |
Out[3]= |
Fold a multi-output function:
In[4]:= |
Out[4]= |
Use arbitrary functions to define the vertices:
In[5]:= |
Out[5]= |
Tag edges:
In[6]:= |
Out[6]= |
Use an operator form:
In[7]:= |
Out[7]= |
Use a different head to specify tags:
In[8]:= |
Out[8]= |
This work is licensed under a Creative Commons Attribution 4.0 International License