Bug introduced in version 8 or earlier and fixed in 10.0
I have created a notebook with two cells. This is the content of the first:
g = Graph[{1 \[UndirectedEdge] 2, 2 \[UndirectedEdge] 3, 1 \[UndirectedEdge] 3, 1 \[UndirectedEdge] 4, 4 \[UndirectedEdge] 5, 4 \[UndirectedEdge] 6}]
And this is the content of the second:
g
listDegree = VertexDegree[g]
vl = VertexList[g]
nodeMaxDegree = Pick[vl, listDegree, Max[VertexDegree[g]]][[1]]
aM = AdjacencyMatrix[g];
vLM = aM[[VertexIndex[g, nodeMaxDegree]]];
nN = Pick[vl, vLM, 0]
If I evaluate the second cell (after processing the first) for a second time:
- the first time no problem, the results are correct;
- the second time the vertex list of
gis inexplicably wrong but the graph remain correct!!
I don't understand the cause because the graph g is never touched.
Thanks in advance
FullForm[vl]givesList[1, System`Private`InternSequence[], System`Private`InternSequence[], System`Private`InternSequence[], 5, 6]. – István Zachar Mar 27 '14 at 18:34PrivateInternSequence[]"? – Adam Reith Mar 27 '14 at 18:49System'Private'InternSequence[](by itself, without a wrapper likeList) "evaluates to"StandardForm. Peculiar :P – Jacob Akkerboom Mar 27 '14 at 19:46Typeset`MakeBoxes[_, StandardForm]not having a rule forSystem'Private'InternSequence[]like it does forSequence[]– Simon Woods Mar 27 '14 at 20:04sPIfor short. If you use a rule to transformsPI[], like insPI[] /. x_ :> x, it will evaluate toSequence[]. I thought it might have to do with that. I've never looked atTypeset'Makeboxes, your guess is probably better than mine. By the way yourSpelunkgives an error for that one. – Jacob Akkerboom Mar 27 '14 at 20:13Spelunkbut the way howMakeBoxesdefinitions are returned and converted to boxformat: just try for exampleAttributes[LabeledSlider] = {}; FullDefinition@LabeledSliderand be prepared for LOTS of errors... – István Zachar Mar 27 '14 at 20:16SparseArray, as illustrated by istvan's answer, is present in version 7 (I could not test earlier versions). The code by the OP first causes trouble in version 8, as the `Combinatorica`` package in version 7 had different syntax. – Jacob Akkerboom Feb 03 '15 at 11:03