11

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

enter image description here

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

Szabolcs
  • 234,956
  • 30
  • 623
  • 1,263
PlatoManiac
  • 14,723
  • 2
  • 42
  • 74
  • 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 '14 at 15:33
  • 1
    Here's a minimal example: g = RandomGraph[{10, 20}]; GraphEmbedding[g]; g. – Szabolcs Jul 29 '14 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 '14 at 15:36
  • Still there in 10.0.1 – Sjoerd C. de Vries Sep 17 '14 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 '14 at 15:52

3 Answers3

8

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

RunnyKine
  • 33,088
  • 3
  • 109
  • 176
  • This does not seem to solve OP's problem in version 10 on my machine. – Silvia Jul 29 '14 at 18:50
  • @Silvia, Well, I'm on Windows 8.1 and it works just fine as my answer shows. – RunnyKine Jul 29 '14 at 18:55
  • I'm on win8.1 x64 and mma 10.0 too... Now this is really getting strange... – Silvia Jul 29 '14 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 '14 at 19:12
  • Agree this is a bug (and a weird one).. – Silvia Jul 29 '14 at 19:15
  • @RunnyKine Actually before posting this I have checked, without the ; as you have done works in my machine with win 8.1 and MMA 10. I also think this is a bug. Very annoying actually as this was my first few lines of code while trying version 10 for the first time :( – PlatoManiac Jul 29 '14 at 21:38
  • @PlatoManiac, sorry to hear you had such an unpleasant experience with it. I assure you, other than a few (okay, more than a few) bugs we've discovered here, V10 is actually so much fun to use :) – RunnyKine Jul 29 '14 at 21:40
  • @RunnyKine I totally agree. That :( was meant to describe my mood six hours ago...As the hours passed by I am enjoying my time with the new characters of V10...lots of new functionalities to catch up with :) – PlatoManiac Jul 29 '14 at 21:44
  • @PlatoManiac, good to hear :) – RunnyKine Jul 29 '14 at 21:59
6

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.

Silvia
  • 27,556
  • 3
  • 84
  • 164
2

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

Mathematica graphics

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

Mathematica graphics

Nasser
  • 143,286
  • 11
  • 154
  • 359