Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Compute a 3D embedding for multiple graphs so that all pairwise distances are preserved simultaneously along various 2D projections
ResourceFunction["MultiPerspectiveEmbedding"][gs] gives multi-perspective 3D embedding of graphs gs. | |
ResourceFunction["MultiPerspectiveEmbedding"][ds] gives multi-perspective 3D embedding for explicit distance matrices. |
"InitialEmbedding" | Automatic | array of initial embedding vectors |
"InitialProjection" | Automatic | array of initial normal vectors |
"FixProjection" | False | whether to fix or learn projection vectors |
"UseGraphEmbedding" | True | if the input is graphs, whether to use its embeddings for computing distances |
"NormalizeDistances" | True | whether to normalize distances |
"NetTrainOptions" | {} | custom options for NetTrain |
TrainingProgressReporting | Automatic | use "Verbose" for custom reporting |
Compute a 3D embedding for a grid graph and a path graph:
In[1]:= |
|
Out[1]= |
|
Define larger grid and path graphs and show them:
In[2]:= |
|
Out[3]= |
|
Compute an embedding:
In[4]:= |
|
Out[4]= |
|
View the embedding with the resource function MultiPerspectiveEmbeddingViewer:
In[5]:= |
|
Out[5]= |
|
Here is the progress for training an embedding for points that look like digits 1, 2 and 3 in 2D from three distance matrices and how they form into their position:
In[6]:= |
|
View the embedding:
In[7]:= |
|
Out[7]= |
|
Specify custom options for NetTrain, for example, MaxTrainingRounds:
In[8]:= |
|
Out[8]= |
|
Specify an initial embedding:
In[9]:= |
|
Out[9]= |
|
Specify initial normal projection vectors using the "InitialProjection" option. The "Normals" key of the resulting association would contain new projection normal vectors after training:
In[10]:= |
|
Out[10]= |
|
Disable learning for normal vectors. The "Normals" value stays the same:
In[11]:= |
|
Out[11]= |
|
By default, distances are taken to be the distances between its graph embeddings:
In[12]:= |
|
UseGraphEmbedding → False would use GraphDistanceMatrix instead:
In[13]:= |
|
Without normalizing distances, training may diverge:
In[14]:= |
|
This work is licensed under a Creative Commons Attribution 4.0 International License