Message Boards Message Boards


Is GraphDistance (and other graph analysis functions) compiled in 32bits?

Posted 4 months ago
3 Replies
0 Total Likes

I have a Windows 10 PC with 32GB RAM and currently use Mathematica 11.3 I tried to obtain the GraphDistance between two nodes in a 500,000 node 600,000 vertex graph and Mathematica crashed without warning (all the fonts went from blue or black to dark purple, like when you exit the kernel). I thought that it was because my computer ran out of memory but I repeated the process with the Task Manager open and Mathematica never used more than 2GB RAM. Is it possible that GraphDistance is compiled in 32bits and this is the reason it crashes once it reaches 2GB? Related question: is there a way to obtain my GraphDistance in Mathematica for such a large network? It is kind of a trivial network in C++. Thanks! Fernando

3 Replies
Posted 4 months ago

There are no differences between functions in this regard. If you installed the 64-bit version of Mathematica then it's 64-bit.

I tried this on a random graph with more than 500000 nodes and more than 600000 vertices and got a response almost immediately.

In[18]:= $Version

Out[18]= "11.3.0 for Mac OS X x86 (64-bit) (March 7, 2018)"

In[19]:= SeedRandom[42];

In[20]:= g = 
  With[{g = RandomGraph[{600000, 700000}]}, 
   Subgraph[g, First@ConnectedComponents[g]]];

In[21]:= {VertexCount[g], EdgeCount[g]}

Out[21]= {520635, 687488}

In[22]:= RandomSample[VertexList[g], 2]

Out[22]= {382368, 532560}

In[23]:= GraphDistance[g, ##] & @@ %

Out[23]= 21
Posted 3 months ago

Thanks! I worked hard figuring out what was going on and the crashes stop when I remove multiple-edge-vertex connections. That is, vertex A and B being connected by two edges with different speeds. When I removed the slow edge it worked fine, and obtained what I wanted in fractions of a second. So now I guess I am starting a thread asking whether multiedge graphs are supported or not. Best, Fernando

A crash is always a bug. You should post a minimal example that illustrates the problem, and also forward it to Wolfram support.

IGraph/M has a function to combine parallel edges with a custom weight-combiner. You may be able to use this to work around the problem. See here for an example:

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract