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

Bug introduced in 11.3 and fixed in 12.0

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.

• I have reported (couple days ago) a bug where ChromaticPolynomial@GridGraph[{2, 2, 2}] crashed on v11.3, typically couple evaluations after start up of a kernel. It might be related. It never occurred to me that the bug might actually reside in GridGraph - could it? – kirma Apr 26 '18 at 11:53
• @kirma It sounds like it might be the same thing. Also, I could only reproduce it with 3D grids, not with 2D ones. Yours is 3D too, also, you are on a Mac too. – Szabolcs Apr 26 '18 at 11:56
• I tried to reproduce this (... a bit) with 2D grids, but didn't succeed. I didn't try too hard, though. My report was accepted as CASE:4054452. Probably you should refer this to them, the root cause might possibly be a similar memory corruption of sorts. – kirma Apr 26 '18 at 12:01
• @kirma My report is CASE:4059855. I will tell them that yours may be related. – Szabolcs Apr 26 '18 at 12:19
• I can't help but note that indeed the devil is in the details :) – yosimitsu kodanuri May 9 '18 at 6:14