Would it be possible to animate between graph layouts or two random graphs?
Thanks in advance.
I’m not sure what it would mean to animate between graphs. Esp between ones that aren’t isomorphic. You could, I suppose, take the position of each vertex in the graph and then interpolate between them in some way.
Do mean Graphs? Or do you mean plots, like “x-y” plots of some function?
I would like to interpolate (opposed to snapping) between these randomized layouts:
Demo 1: http://demonstrations.wolfram.com/TheRayPuzzle/
Demo 2: http://demonstrations.wolfram.com/AutomatedGraphLayout/
The layouts are being hard reset, I am wondering if there is a simple way to transition between them. Or if you know a technique that might suffice for this type of visualization.
Thanks for this reply, I appreciate it.
There isn’t built-in functionality for this.
To do this, you would need to find the location of the vertices in both layouts and and interpolate between them.
Suppose you have two graphs:
old = Graph[EdgeList@PetersenGraph[5, 2],
GraphLayout -> "SpringEmbedding"]
new = Graph[EdgeList@PetersenGraph[5, 2],
GraphLayout -> "BalloonEmbedding"]
We can get the locations of the vertices:
oldVertexCoors =
VertexCoordinates /. AbsoluteOptions[old, VertexCoordinates];
newVertexCoors =
VertexCoordinates /. AbsoluteOptions[new, VertexCoordinates];
And then make a Manipulate that interpolates between these:
Manipulate[
Graph[EdgeList@PetersenGraph[5, 2],
VertexCoordinates -> (oldVertexCoors + (newVertexCoors -
oldVertexCoors) t)], {t, 0, 1}]
Very nice, @Sean! There is simpler GraphEmbedding:
oldVertexCoors=GraphEmbedding[old];
newVertexCoors=GraphEmbedding[new];
And it probably worth fixing image size:
Manipulate[Graph[
EdgeList@PetersenGraph[5, 2],
VertexCoordinates -> (oldVertexCoors + (newVertexCoors -
oldVertexCoors) t), ImageSize -> {300, 300}], {t, 0, 1}]

Wow! I have much to learn about Mathematica and I truly appreciate your time and consideration.
Thank you both.