Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

In Mathematica 9.0.1, when I evaluate

Graph[PolyhedronData["GreatRhombicosidodecahedron", "SkeletonRules"],
  VertexCoordinates -> 
    Thread[Table[i, {i, 1, 120}] -> 
      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?

share|improve this question
1  
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 at 2:27
2  
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 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 at 23:03

2 Answers 2

up vote 7 down vote accepted

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
share|improve this answer
    
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 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]

enter image description here

share|improve this answer
    
Thanks, Rasher! –  Ghersic Apr 4 at 2:56
1  
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 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. –  rasher Apr 5 at 22:32
    
We'll have Graph3D in the future for this :-) –  Szabolcs Apr 6 at 0:54
    
@Szabolcs Graph3D, you do not know how happy that makes me. –  Ghersic Apr 11 at 3:31

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.