Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Generates a generalized version of GridGraph
ResourceFunction["GeneralizedGridGraph"][{spec1,spec2,…,speck}] gives a k-dimensional generalized grid graph according to the specifications specj . |
m | m vertices in the jth dimension |
m → “Circular” | m vertices in the jth dimension connected cyclically |
m → “Directed” | m vertices connected by directed edges in the jth dimension |
m → {“Circular”, “Directed”} | m vertices in the jth dimension cyclically connected by directed edges |
“VertexNamingFunction” | Automatic | function to use for naming the vertices |
Generate an 8×8 grid graph with directed edges:
In[1]:= |
|
Out[1]= |
|
Generate an 5×5×5 grid graph with directed edges:
In[2]:= |
|
Out[2]= |
|
Generate an ordinary grid graph:
In[3]:= |
|
Out[3]= |
|
Generate a grid graph that is circular in the first dimension, and has directed edges in the second:
In[4]:= |
|
Out[4]= |
|
Generate a grid graph that has directed edges and is circular in the first dimension:
In[5]:= |
|
Out[5]= |
|
Label vertices with their coordinates:
In[8]:= |
|
Out[8]= |
|
Labeling by coordinates works with arbitrary grids:
In[9]:= |
|
Out[9]= |
|
Labeling by coordinates works in any dimension:
In[10]:= |
|
Out[10]= |
|
For plain integer specifications, GeneralizedGridGraph is the same as GridGraph:
In[11]:= |
|
Out[11]= |
|
In[12]:= |
|
Out[12]= |
|
This work is licensed under a Creative Commons Attribution 4.0 International License