# Don't understand why Mathematica is complaining about my Graph expression; how can I fix it?

The Tube in Arrow problem is fixed in version 10. Note that in version 10 Graph3D must be used with 3D coordinates.

In Mathematica 9.0.1, when I evaluate

Graph[PolyhedronData["GreatRhombicosidodecahedron", "SkeletonRules"],
VertexCoordinates ->
PolyhedronData["GreatRhombicosidodecahedron", "VertexCoordinates"]]]


No error message was printed, so Quiet is ineffective, yet the output is highlighted in 'error red' and on mouseover it states:

Coordinate index -1 is out of range for the enclosing GraphicsComplex.

However, the coordinates have clearly been implemented in the Graph, so I would like to simply silence this error just as Quiet or Off would for error messages.

I've only encountered this problem in the above context, but suspect the solution is simple. Does anyone know of a solution?

-
I can reproduce your problem, but can't see anything wrong with your code. I suspect a bug in Mathematica's rendering algorithm has surfaced here. Could be wrong because I have little experience with Graph. –  m_goldberg Apr 4 '14 at 2:27
Replacing Graph with Graph3D and running your command on the Raspberry Pi produces the desired error-free output. I'm sure v10 will be out for the masses any day now. –  bobthechemist May 27 '14 at 11:54
@bobthechemist Thanks for letting me know. Excited to not have to bypass the error anymore (not to mention the rest of v10. –  Ghersic May 28 '14 at 23:03

tl;dr In version 9 Tube inside of Arrow is not handled correctly. This bug is fixed in version 10.

Version 10 and later explicitly supports 3D coordinates for graph vertices, but only when using Graph3D.

I was surprised that Graph supports 3D coordinates at all (!!). Layout algorithms supported in Graph are 2D only.

The problem doesn't seem to be with Graph itself but the Graphics3D object it translates to. Here's a smaller example of the same:

Show@Graph[{1 -> 2}, VertexCoordinates -> {1 -> {0, 0, 0}, 2 -> {1, 0, 0}}]


Show converts it to a Graphics3D object. If you look at the input form, you'll see expressions of the form Arrow[Tube[{1, 2}]] where 1 and 2 stand for 3D coordinates.

This is a valid and documented specification for 3D Arrows and this works fine in Graphics3D:

Graphics3D@Arrow[Tube[{{0, 0, 0}, {1, 0, 0}}]]


But this doesn't seem to work:

Graphics3D@GraphicsComplex[{{0, 0, 0}, {1, 0, 0}}, Arrow[Tube[{1, 2}]]]


It causes the errors you see.

I consider this to be a bug. I'm optimistic it'll be fixed in the next release, but of course it's always a good idea to report bugs you find to support!

Until then, you can use one of two workarounds: either replace Tube with Line, or get rid of Arrow (then you won't see the direction of edges).

If g is your Graph, then just do

Show[g] /. Tube -> Line


or

Show[g] /. Arrow -> Identity

-
Thank you, Szabolcs. The latter (Arrow -> Identity) allows for what visualization I need without resorting to GraphPlot3D (retain styling defaults of Graph, too). Glad to possibly have found a bug and to have prompted an answer from you. Will wait little bit for good measure, then accept an answer. –  Ghersic Apr 4 '14 at 2:56

Wrong use of Graph in this case I believe. I think the following does what you're after:

Graphics3D[{FaceForm[], EdgeForm[Blue],
PolyhedronData["GreatRhombicosidodecahedron", "Faces"],
PointSize[Large], Red,
Point /@ PolyhedronData["GreatRhombicosidodecahedron",
"VertexCoordinates"]}, Boxed -> False]


-
Thanks, Rasher! –  Ghersic Apr 4 '14 at 2:56
Just as a clarification to my answer: I completely agree that to plot this in 3D, your solution should be used. It looks like 3D vertex coordinates are not documented so probably not supported in v9 ... when I said I believe this is a bug I was referring to the fact that Arrow[Tube[...]] doesn't work inside GraphicsComplex. That's a graphics bug, not a graph one. –  Szabolcs Apr 5 '14 at 17:53
@Szabolcs: No need to clarify, but appreciated. Yes, the whole ability to even get a 3D result for a graph is I think a side-effect of Graph using the underlying graphics primitives, and the vertex info gets passed along. Neat that it works, but who knows what will or won't work for undocumented features / effects in the future. –  ciao Apr 5 '14 at 22:32
We'll have Graph3D in the future for this :-) –  Szabolcs Apr 6 '14 at 0:54