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.

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]]

enter image description here

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

share|improve this question
1  
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? –  Szabolcs Jul 29 at 15:33
1  
Here's a minimal example: g = RandomGraph[{10, 20}]; GraphEmbedding[g]; g. –  Szabolcs Jul 29 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]. –  Szabolcs Jul 29 at 15:36
    
Still there in 10.0.1 –  Sjoerd C. de Vries Sep 17 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. –  PlatoManiac Sep 17 at 15:52

2 Answers 2

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]}]]

Mathematica graphics

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

share|improve this answer
2  
other workaround: Show[g = RandomGraph[{12, 18}]]; pt = GraphEmbedding[g]; g –  halmir Jul 29 at 19:02
    
@halmir Why I didn't think of that! :) –  Silvia Jul 29 at 19:18

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.