Graph[]-related kernel crash bug
- To: mathgroup at smc.vnet.net
- Subject: [mg118860] Graph[]-related kernel crash bug
- From: Szabolcs Horvát <szhorvat at gmail.com>
- Date: Fri, 13 May 2011 06:28:15 -0400 (EDT)
Dear MathGroup,
Can you please try to reproduce this problem?
The following computation will crash the kernel (8.0.1). I haven't yet
been able to come up with a fully reduced test case, but this works:
(* find "endpoints" of a directed graph, i.e. those that have either
only incoming or only outgoing edges *)
endpoints[g_] :=
Pick[VertexList[g], VertexOutDegree[g] VertexInDegree[g], 0]
(* remove one layer of endpoints *)
removeEndpoints[graph_Graph] := VertexDelete[graph, endpoints[graph]]
(* keep removing endpoints until none are left *)
removeAllEndpoints[g_Graph] := FixedPoint[removeEndpoints, g]
This last function crashed on a graph.
When repeatedly applying removeEndpoints, after a while I end up with a
graph that has this InputForm:
gg = Graph[{16, 20},
{SparseArray[Automatic, {2, 2}, 0, {1, {{0, 1, 1}, {{2}}}, Pattern}],
Null}]
removeEndpoints[gg] will crash on this one.
I believe this is exactly the same bug as
https://groups.google.com/d/topic/comp.soft-sys.math.mathematica/3MS4Ar-zwqQ/discussion
However, there's another crash, which I believe is different. I didn't
manage to come up with a properly reduced testcase for this one, so the
starting graph is a bit big. The reason I think this is different is
that replacing removeEndpoints with
Uncompress@Compress@removeEndpoints[#]& avoids the crash in this second
case, but it does not avoid the crash in the first case.
gg=Graph[{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
19, 20, 21, 22,
23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
40, 41, 42, 43,
44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
61, 62, 63, 64,
65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81,
82, 83, 84, 85},
{SparseArray[Automatic, {85, 85}, 0, {1, {{0, 1, 1, 2, 3, 4, 5, 6, 7,
8, 9, 10, 11,
12, 13, 14, 15, 16, 17, 18, 26, 33, 39, 49, 58, 59, 60, 61, 62,
63, 65, 66, 67,
69, 70, 71, 72, 74, 76, 77, 79, 80, 83, 87, 88, 89, 91, 92, 93,
94, 95, 96, 98,
99, 100, 101, 103, 104, 107, 109, 112, 115, 116, 117, 118, 120,
124, 134, 141,
147, 149, 151, 156, 162, 165, 173, 174, 182, 189, 196, 199, 205,
208, 209, 211,
219}, {{2}, {2}, {2}, {2}, {2}, {2}, {2}, {2}, {2}, {2}, {2}, {2},
{2}, {2},
{2}, {2}, {2}, {2}, {2}, {7}, {11}, {12}, {13}, {14}, {21}, {22},
{2}, {7},
{11}, {12}, {13}, {14}, {22}, {2}, {7}, {11}, {12}, {13}, {14},
{2}, {7}, {11},
{12}, {13}, {14}, {20}, {21}, {22}, {24}, {2}, {7}, {11}, {12},
{13}, {14},
{20}, {21}, {22}, {21}, {11}, {28}, {5}, {9}, {9}, {10}, {15},
{17}, {7}, {8},
{8}, {18}, {37}, {18}, {19}, {18}, {19}, {24}, {1}, {3}, {4},
{20}, {23}, {24},
{20}, {21}, {22}, {24}, {7}, {16}, {9}, {10}, {22}, {5}, {14},
{6}, {18}, {18},
{51}, {1}, {1}, {4}, {6}, {57}, {2}, {18}, {19}, {40}, {6}, {56},
{18}, {19},
{51}, {40}, {56}, {57}, {40}, {26}, {46}, {40}, {53}, {11}, {12},
{13}, {14},
{7}, {11}, {12}, {13}, {14}, {20}, {21}, {22}, {23}, {24}, {1},
{7}, {20}, {21},
{22}, {23}, {24}, {13}, {14}, {20}, {21}, {22}, {24}, {11}, {12},
{13}, {14},
{13}, {14}, {20}, {21}, {22}, {7}, {11}, {12}, {13}, {14}, {17},
{7}, {13},
{14}, {7}, {11}, {12}, {13}, {14}, {20}, {21}, {22}, {68}, {13},
{14}, {17},
{20}, {21}, {22}, {23}, {24}, {13}, {14}, {17}, {20}, {21}, {22},
{24}, {11},
{12}, {13}, {14}, {18}, {19}, {37}, {18}, {19}, {37}, {13}, {14},
{17}, {20},
{21}, {22}, {20}, {21}, {22}, {13}, {8}, {14}, {7}, {13}, {14},
{17}, {20},
{21}, {22}, {24}}}, Pattern}], Null}]
removeAllEndpoints[gg]