Why I cannot see the graph? Example:

g = RandomGraph[BarabasiAlbertGraphDistribution[100000, 1]]

Output: enter image description here

No further analysis of g can be done. Why?

  • $\begingroup$ You can't see it because it's too large. I tried calculations like GraphRadius[g] and they abort. ConnectedComponents crashed my kernel too. $\endgroup$
    – flinty
    Apr 13, 2021 at 16:30
  • 1
    $\begingroup$ "No further analysis of g can be done." Can you explain what you mean by this? $\endgroup$
    – Szabolcs
    Apr 13, 2021 at 17:01
  • 2
    $\begingroup$ @flinty I see no crash in M12.2. This is not a large graph at all for analysis (which is not the same as visualization), and finding connected components is one of the simplest and fastest operations one can do on a graph. No reason it should not work. $\endgroup$
    – Szabolcs
    Apr 13, 2021 at 17:02
  • $\begingroup$ As for GraphRadius returning $Aborted[], I'm not sure, but as I recall, many of the shortest path based functions in Mathematica calculated the entire distance matrix before doing anything with the distances. THis is quite unnecessary (and I would consider it a bug). I suspect this is in play here: it cannot allocate a 100000 by 100000 matrix, so it stops. But it shouldn't even try to allocate that matrix. $\endgroup$
    – Szabolcs
    Apr 13, 2021 at 17:05
  • $\begingroup$ Example; it does not work: Association[(# -> PropertyValue[{g, #}, VertexCoordinates]) & /@ VertexList[g]] $\endgroup$
    – ralph
    Apr 13, 2021 at 17:38

2 Answers 2


Why I cannot see the graph?

Because it is too big. Plotting it would take a long time, thus automatic plotting would be counter-productive. You can still request plotting manually through GraphPlot.

This is the usual way to deal with this situation, not to increase the size limits for automatic plotting. If you do that, you'll eventually find your Mathematica session locked up for a few minutes just because you forgot to suppress output with ;.

  • $\begingroup$ Is there an upper limit on how large a graph can you visualize, or does it depend on the computer memory, or graph density? I've had problems visualizing sparse graphs with GraphPlot[], of about 100K nodes. $\endgroup$ Apr 4, 2022 at 14:56

This works in Mathematica 12.3. It took about 1-2 mins.

  "GraphOptions" -> {"EdgeCountThreshold" -> 200000, 
    "VertexCountThreshold" -> 150000}];
g = RandomGraph[BarabasiAlbertGraphDistribution[100000, 1]]

enter image description here


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