Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Iteratively construct graphs up to a termination condition
ResourceFunction["NestWhileGraph"][f,expr,test] generates a directed graph whose nodes are obtained by applying f repeatedly, starting from expr, and continuing until applying test to the result no longer yields True. | |
ResourceFunction["NestWhileGraph"][f,expr,test,m] supplies a list of the most recent m results to test at each step. | |
ResourceFunction["NestWhileGraph"][f,expr,test,All] supplies a list of all results so far to test at each step. | |
ResourceFunction["NestWhileGraph"][f,expr,test,m,max] applies f at most max times. |
Construct a graph by applying f while VertexCount is less than 5:
In[1]:= |
Out[1]= |
Apply a similar termination condition only to growth-front subgraph:
In[2]:= |
Out[2]= |
Terminate the growth of a graph according to properties of its vertex set:
In[3]:= |
Out[3]= |
Explore a grid graph through multiway spacetime evolution until every vertex has been visited:
In[4]:= |
Out[4]= |
Generate a torus graph:
In[5]:= |
Out[5]= |
Generate a few different Cayley graphs for the Octahedral group:
In[6]:= |
Out[6]= |
When setting DirectedEdges to False, outputs become undirected graphs:
In[7]:= |
Out[7]= |
Termination can also be accomplished by introducing a cutoff for recursion depth:
In[8]:= |
Out[8]= |
Construct the game graph of a loopy game:
In[9]:= |
Out[9]= |
Find loops in the game graph:
In[10]:= |
Out[10]= |
Generate a graph with structure related to prime numbers:
In[11]:= |
Out[11]= |
Notice false positives on the growth front:
In[12]:= |
Out[12]= |
This work is licensed under a Creative Commons Attribution 4.0 International License