# Mathematica 10 Graph issue

Bug introduced in 10.0.0 and fixed in 10.0.2

Please try to evaluate this code in Mathematica 10.

<< ComputationalGeometry
g = RandomGraph[{12, 18}];
pt = GraphEmbedding[g];
convexhull = ConvexHull[pt];
Show[PlanarGraphPlot[pt, convexhull, ColorOutput -> Red], g,
Graphics[{Red, PointSize@Large, Point[#]} & /@ pt]]


Works perfectly fine on the version 9. What is this dynamic object showing up? Anybody got some explanation for this.

• The graph doesn't have a layout. In this case it gets shown like a summary box. Why it doesn't have a layout I don't know. If you remove the ; after RandomGraph[...] so it gets a chance to be shown alone first, it'll work. This smells like a bug, can you please report it to support at wolfram.com? Commented Jul 29, 2014 at 15:33
• Here's a minimal example: g = RandomGraph[{10, 20}]; GraphEmbedding[g]; g. Commented Jul 29, 2014 at 15:34
• I shouldn't have said that it doesn't have a layout as the layout obviously gets computed by GraphEmbedding, what I meant is that the display of the graph looks the same as that of RandomGraph[{10, 20}, GraphLayout -> None]. Commented Jul 29, 2014 at 15:36
• Still there in 10.0.1 Commented Sep 17, 2014 at 15:49
• @SjoerdC.deVries Not a good news for us then :( Hope some other buggy things are repaired, that came along with the long awaited V 10. Commented Sep 17, 2014 at 15:52

Edit

As commented by Szabolcs, this problem occurs as a result of preventing the rendering of the Graph by adding a semi-colon to the end of the RandomGraph expression. This is obviously a bug.

Using the built-in ConvexHullMesh and allowing the graph to render:

g = RandomGraph[{12, 18}]
pt = GraphEmbedding[g];
chull = ConvexHullMesh[pt];


Then:

Show[HighlightMesh[chull, Style[1, Thin, Green]], g, Graphics[{Red, PointSize@Large, Point[pt]}]]


• This does not seem to solve OP's problem in version 10 on my machine. Commented Jul 29, 2014 at 18:50
• @Silvia, Well, I'm on Windows 8.1 and it works just fine as my answer shows. Commented Jul 29, 2014 at 18:55
• I'm on win8.1 x64 and mma 10.0 too... Now this is really getting strange... Commented Jul 29, 2014 at 18:57
• @Silvia, you're right. It seems like the bug occurs if you put the semi-colon after the RandomGraph expression. Commented Jul 29, 2014 at 19:12
• Agree this is a bug (and a weird one).. Commented Jul 29, 2014 at 19:15

Inspired by Szabolcs's comment, I found adding following line after g = RandomGraph[{12, 18}]; will make things right on my 10.0:

PrintTemporary[g];


Or

CopyToClipboard[g];


I guess any command that makes the FrontEnd rendering g.

• other workaround: Show[g = RandomGraph[{12, 18}]]; pt = GraphEmbedding[g]; g Commented Jul 29, 2014 at 19:02
• @halmir Why I didn't think of that! :) Commented Jul 29, 2014 at 19:18

Fixed in 10.0.2. On windows 7, 64 bit

<< ComputationalGeometry
g = RandomGraph[{12, 18}];
pt = GraphEmbedding[g];
convexhull = ConvexHull[pt];
Show[PlanarGraphPlot[pt, convexhull, ColorOutput -> Red], g,
Graphics[{Red, PointSize@Large, Point[#]} & /@ pt]]


g = RandomGraph[{10, 20}]; GraphEmbedding[g]; g