5 of 7 added 199 characters in body

# GridGraph[{6,6,6}] crashes—can you reproduce this?

Occasionally, I see a kernel crash with GridGraph[{6,6,6}]. It is not easy to trigger. Sometimes it may require as many as 30 evaluations before it happens, and doing those evaluations in a Do loop doesn't trigger it. It is necessary to evaluate separate inputs manually. At other times, I cannot evaluate GridGraph[{6,6,6}] even once in a new session as it causes a crash every time.

Here's a screenshot (command line) of how it crashed after 20 evaluations (silent exit):

So far I could reproduce this with M11.3.0 on macOS 10.13.4. With M11.2.0 I could not. I would like to know if others can see the crash too, or if it is related to some settings specific to my machine.

Update: Wolfram Support responded and confirmed the problem within hours after reporting it.

If the problem is significantly inconveniencing you, you can use IGMakeLattice from IGraph/M as a workaround. IGMakeLattice was included for other reasons (features not found in GridGraph), but it also makes a good workaround for this issue.

Specifically for the 2D and 3D case you may also use

gridGraph[dims_List, opt : OptionsPattern[]] := IndexGraph@NearestNeighborGraph[Tuples[Range /@ dims], opt]


Update 2:

It seems that HypercubeGraph has a similar crash. My guess is that this is because it might be implemented as GridGraph[ConstantArray[2,n]]. Reported as CASE:4064377.