0
votes

I'm trying to construct a 3D graph in Mathematica, where the actual lengths of the edges are important. Taking a look at their documentation for graph drawing (http://www.wolfram.com/learningcenter/tutorialcollection/GraphDrawing/GraphDrawing.pdf) I found that the Spring Embedding Algorithm might best suit my needs. The algorithm they mention specify a parameter R and a set of natural lengths for each edge. However, I do not know how to actually use these in Mathematica. The code I use is

GraphPlot[adj_mat, Method->"SpringEmbedding"]

and cannot find any way to alter the natural lengths or the parameter R. Does anyone know how to set these values?

Thank you!

1

1 Answers

0
votes

Look up the documentation under GraphLayout and you will find many examples. Here is a brief code on how to use the layout specifiers with GraphPlot:

edge = RandomInteger[#] \[UndirectedEdge] # + 1 & /@ Range[0, 15];
weight = RandomInteger[{1, 5}, 16];
gr = Graph[edge, EdgeWeight -> weight];
GraphPlot[gr, 
   Method -> {"SpringEmbedding", "EdgeWeighted" -> #}] & /@ {True, 
  False}