13
$\begingroup$

Bug introduced in 7.0 or earlier and persisting through 12.0


Show @ Graph[{1 -> 2, 2 -> 3}, Frame -> True]
Normal @ %

enter image description here

Is this a pure bug, or have I missed something?


InputForms reveal that Disks are converted correctly while Arrows remain in GraphicsComplex form. Going with investigation further, I found that not all Arrows...

{#, Normal @ #} & @ Graphics[
    GraphicsComplex[
      {{0, 0}, {1., 0}, {2., 0}}, 
      {
        {Thickness@.05, Blue, Arrow[{{1, 2}, {2, 3}}, .03]},
        {Thickness@.01, Red, Arrow[{1, 2}, .03], Arrow[{2, 3}, .03]}
    }], 
    ImageSize -> 300
]

enter image description here

So, as we can see, "separate" arrows are converted correctly while those gathered under one Arrow are not...

Q is there any quick fix to convert Graph to normal form correctly?

V10.3.1 Win 10

$\endgroup$
  • 2
    $\begingroup$ Normal[# /. a : Arrow[{__List}, _] :> Thread@a] gives a quick fix for these examples $\endgroup$ – Simon Woods Jan 29 '16 at 18:35
  • $\begingroup$ Now answered ;-) $\endgroup$ – Simon Woods Jan 29 '16 at 18:47
  • 3
    $\begingroup$ I don't see how this can be anything but a bug so I am adding the tag. $\endgroup$ – Mr.Wizard Jan 29 '16 at 23:26
10
$\begingroup$
Normal[# /. a : Arrow[{__List}, Except[_List]] :> Thread @ a]

gives a quick fix for these examples.

$\endgroup$
  • $\begingroup$ I'd add Except[_List] for the second argument since it can be a list too. Or better map with it. $\endgroup$ – Kuba Jan 29 '16 at 18:53
  • $\begingroup$ @Kuba, good point $\endgroup$ – Simon Woods Jan 29 '16 at 18:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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