1
$\begingroup$

Why does Mathematica not display (and export) the graph 'g' when n> 10000?

n = 10000;  g = RandomGraph[BarabasiAlbertGraphDistribution[n, 1]]

ralph

$\endgroup$
0

1 Answer 1

5
$\begingroup$

Graph objects render as a visual representation by default. This is merely for convenience, not a way to visualize the graph. If you want to explicitly visualize it, use GraphPlot.

Once the graph gets large, visualization becomes expensive. I wouldn't want my work to be slowed down (or at worst: the notebook interface hang) when working with large graphs that I don't want to visualize at every step. It makes perfect sense that there is a limit on the graph size above which auto-visualization is not done. You can still use GraphPlot when necessary.

$\endgroup$
3
  • $\begingroup$ But the problem is that other functions don't work, for example: Association [(# -> PropertyValue [{g, #}, VertexCoordinates]) & / @VertexList [g]] If I use Graph [] also doesn't work. $\endgroup$
    – ralph
    Commented Sep 16, 2021 at 7:46
  • 3
    $\begingroup$ @ralph your question was "Why does Mathematica not display (and export) the graph?" and that was answered. If need to clarify your question, you can edit it, but if you are now asking something different you need to ask a new question. $\endgroup$
    – rhermans
    Commented Sep 16, 2021 at 9:39
  • 2
    $\begingroup$ @ralph - independent of the issue at hand, don't use PropertyValue to get the coordinates for each vertex, it would be more efficient to use AssociationThread[VertexList[g] -> GraphEmbedding[g]] $\endgroup$
    – Jason B.
    Commented Sep 16, 2021 at 11:41

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