Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Merge two graphs, linking them at a desired set of vertices
ResourceFunction["GraphMerge"][g1,g2,idx,v] merges two graphs g1 and g2, connecting them at the vertices listed in idx, and using the label v to label the vertices of g2. | |
ResourceFunction["GraphMerge"][g1,g2,dockingIndices] uses the string "v" as a label. |
Merge a Petersen graph and a complete graph at three of their vertices:
In[1]:= | ![]() |
Out[1]= | ![]() |
Display the vertex labels:
In[2]:= | ![]() |
Out[2]= | ![]() |
Merge two grid graphs of different sizes:
In[3]:= | ![]() |
Out[3]= | ![]() |
Merge two grid graphs of different dimensions:
In[4]:= | ![]() |
Out[4]= | ![]() |
Merge a directed and an undirected graph:
In[5]:= | ![]() |
Out[5]= | ![]() |
A grid graph:
In[6]:= | ![]() |
Out[6]= | ![]() |
Iteratively merge copies of the grid graph:
In[7]:= | ![]() |
Out[7]= | ![]() |
GraphMerge does not preserve the spatial appearance of the component graphs:
In[8]:= | ![]() |
Out[8]= | ![]() |
This work is licensed under a Creative Commons Attribution 4.0 International License