Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Explore graph traversals while deleting visited components
ResourceFunction["MultiwayDeletionsGraph"][g] returns a directed acyclic graph which maps all possible traversals of graph g while deleting vertices along the way. | |
ResourceFunction["MultiwayDeletionsGraph"][g,v1] traverses graph g starting only from initial vertex v1. | |
ResourceFunction["MultiwayDeletionsGraph"][g,{v1,v2,…,vn}] traverses graph g starting from n initial vertices vi. | |
ResourceFunction["MultiwayDeletionsGraph"][g,{v1,v2,…,vn},method] allows deleting edges by setting method equals EdgeDelete. | |
ResourceFunction["MultiwayDeletionsGraph"][g,{v1,v2,…,vn},method,max] introduces a cutoff max for cases where the state space graph g is too large to explore efficiently. |
| w1={{},v1} | an initial condition for either method, where v1∈VertexList[g] |
| wn={Sort[{v1,v2,…,vn-1}],vn} | with vi∈VertexList[g] and wn∈VertexList[ResourceFunction["MultiwayDeletionsGraph"][g,v1]] |
| wn={Sort[{e1,e2,…,en-1}],vn] | withei∈EdgeList[g]andwn∈VertexList[ResourceFunction["MultiwayDeletionsGraph"][g,v1,EdgeDelete]] |
| method=VertexDelete | First[wn]==First[wn-1]⋃{vn}&&GraphDistance[g,Last[wn-1],Last[wn]]⩵1 |
| method=EdgeDelete | First[wn]==First[wn-1]⋃{edge[vn-1,vn]}&& GraphDistance[g,Last[wn-1],Last[wn]]⩵1 |
Plot two pairs of confluent self-avoiding walks on a 2×2 GridGraph:
| In[1]:= |
| Out[1]= | ![]() |
Add labels to see which vertices where visited when:
| In[2]:= | ![]() |
| Out[2]= | ![]() |
Graph self-avoiding walks on a 3×3 grid:
| In[3]:= |
| Out[3]= | ![]() |
Only compute the subgraph starting from vertex 5:
| In[4]:= |
| Out[4]= | ![]() |
Decorate the graph with publication-quality icons:
| In[5]:= | ![]() |
| Out[5]= | ![]() |
Allow walks from vertex 5 to intersect on vertices, but not on edges:
| In[6]:= |
| Out[6]= | ![]() |
Again, decorate the graph with publication-quality icons:
| In[7]:= | ![]() |
| Out[7]= | ![]() |
Test graph transformations on random inputs:
| In[8]:= | ![]() |
| Out[9]= | ![]() |
When inputting a directed acyclic graph, the output is always a TreeGraph:
| In[10]:= | ![]() |
| Out[10]= | ![]() |
MultiwayDeletionsGraph automatically deduplicates edges:
| In[11]:= |
| Out[11]= |
Graph non-self-intersecting walks along the edges of a cube:
| In[12]:= |
| Out[12]= | ![]() |
Find the out vertices associated with Hamiltonian cycles:
| In[13]:= | ![]() |
| Out[13]= |
Count the number of directed Hamiltonian cycles:
| In[14]:= |
| Out[14]= |
Solve Euler's bridges of Königsberg problem by computing all possible paths:
| In[15]:= | ![]() |
| Out[15]= | ![]() |
This work is licensed under a Creative Commons Attribution 4.0 International License