2
$\begingroup$

Is it possible to Manipulate Graphs (e.g. a CompleteGraph[100, GraphLayout -> {"SpringElectricalEmbedding"}] in Mathematica 9 such that I can e.g. rotate it as 3D object and zoom in and out? If not, how else can one inspect large graphs without extra programming?

$\endgroup$
3
  • 1
    $\begingroup$ Graphs are zoomable in PDFs: mathematica.stackexchange.com/questions/11673/… $\endgroup$
    – C. E.
    Sep 7, 2013 at 21:34
  • $\begingroup$ If one right-clicks on the image, then a pop-up menu comes up. One option is convert to graphics. I am just not able to find what Mathematica command actually is used to do this so that one can program it in. Strange. Any one knows the actual command used by that menu to convert it to Graphics object? (I never used CompleteGraph before) $\endgroup$
    – Nasser
    Sep 7, 2013 at 22:10
  • $\begingroup$ Related in 2D: Generating graphs interactively (GUI) $\endgroup$ Sep 8, 2013 at 6:43

2 Answers 2

4
$\begingroup$

GraphPlot3D does what you want.

For instance, for a 10 node complete graph, you do this

GraphPlot3D@CompleteGraph[10, GraphLayout -> {"SpringElectricalEmbedding"}]

Plot

which will give a 3D plot of the graph that you can manipulate in the usual way.

$\endgroup$
5
  • $\begingroup$ It's good enough for my current purposes, but does not seem to scale to GraphPlot3D@CompleteGraph[100, GraphLayout -> {"SpringElectricalEmbedding"}] in terms of zooming :) ... Or does it? $\endgroup$
    – Drux
    Sep 8, 2013 at 17:40
  • $\begingroup$ I wouldn't expect it to scale, because an $n$-node complete graph has $O(n^2)$ edges. A 100-node complete graph has such a high "density" of edges that any visualisation of the whole graph will be a featureless blob. $\endgroup$ Sep 9, 2013 at 9:10
  • $\begingroup$ If one had the ability to zoom in (as mentioned in the original question) it would not be a matter of visualizing a whole graph, but only the portion that fits on the screen ... $\endgroup$
    – Drux
    Sep 9, 2013 at 10:37
  • 1
    $\begingroup$ But you do have the ability to zoom in - it's Ctrl (or Cmd) / left-click / drag (up/down). You can also pan with Shift / left-click / drag (up/down/left/right). For the 100-node complete graph this works OK, but it's not very informative! $\endgroup$ Sep 9, 2013 at 13:40
  • $\begingroup$ Now that actually answers my question, for I did not know about this key-combination. In my actual problem, I'm not dealing with a 100-node complete graph, just with graphs that would not fit on-screen entirely. So thx for the answer and clarification. $\endgroup$
    – Drux
    Sep 10, 2013 at 7:27
2
$\begingroup$

In Mathematica 10, we can use Graph3D:

Graph3D@RandomGraph[{20, 50}]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.