# Wolfram Function Repository

Instant-use add-on functions for the Wolfram Language

Function Repository Resource:

Iteratively construct graphs up to a termination condition

Contributed by:
Bradley Klee
| Brad Klee

ResourceFunction["NestWhileGraph"][ generates a directed graph whose nodes are obtained by applying | |

ResourceFunction["NestWhileGraph"][ supplies a list of the most recent | |

ResourceFunction["NestWhileGraph"][ supplies a list of all results so far to | |

ResourceFunction["NestWhileGraph"][ applies |

ResourceFunction["NestWhileGraph"] accepts all the options of Graph.

When testing on more than one successive graph, results are time ordered with older results occurring earlier in the list.

ResourceFunction["NestWhileGraph"] accepts all the options of Graph.

Setting DirectedEdges False returns an undirected graph.

Typically iterator *f* should be a list-valued function whose elements are also valid inputs to *f*.

Then the most general form for a typical output allows internal cycles.

If iteration returns to a previously visited value, it does not use that value as an input at the next step.

Thus, output graphs should not have duplicate edges.

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]= |

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]= |

- 1.0.1 – 05 July 2022
- 1.0.0 – 10 June 2022

This work is licensed under a Creative Commons Attribution 4.0 International License