# Rendering of a HighlightGraph in a Manipulate content pane distorted by changing the highlighted edge

A HighlightGraph inside a Manipulate initially displays correct however after approximately 2 seconds, the layout changes and the text, links and nodes get displaced. It appears to be caused by the Manipulate cell, after the initially correct display - is again being evaluated after two seconds (judging by the appearance of the darkening of the evaluation indicator right side of the cell).

Please find a simplified example and see how components "jump" away from the initial, correct placement.

The real problem I experience is on a larger graph and the effect is substantially more dramatic, as nodes are displaced in a manner that the graph becomes illegible.

Despite the simplicity of this mock-up, It does show the reevaluation (if that is what it is) after two seconds and the displacement of nodes and text.

What is causing this and how can I avoid it, preferable without changing what I am trying to display?

To my knowledge, it is only happening when I combine a graph with self-loops and Vertex labelling inside a Manipulate wrapped around HighlightGraph.

f = {1 <-> 5, 5 <-> 6, 5 <-> 5, 6 <-> 4, 4 <-> 5, 5 <-> 3, 3 <-> 6,
6 <-> 2, 2 <-> 4, 4 <-> 1, 1 <-> 3, 3 <-> 2, 2 <-> 1};
h = Graph[f, VertexLabels -> description, ImagePadding -> 10];
Manipulate[HighlightGraph[h, f[[i]]], {i, 1, 12, 1}]


-
Strange. Quick fix: PlotRangePadding -> Scaled@.2. – Kuba Jun 17 '14 at 7:06
Works like a charm on v8: see here. – Öskå Jun 17 '14 at 9:15
Thanks for the fix (it helps) but I'm afraid I need to dig a bit deeper if the problem cannot be replicated on your machines. – Sander Jun 19 '14 at 4:18

I didn't have this problem with 9.01. As an alternative you might try:

h = Graph[f, VertexLabels -> "description", ImagePadding -> 60,
ImageSize -> 400];

Manipulate[
Column[{
Slider[Dynamic@i, {1, 12, 1}],
Dynamic@HighlightGraph[h, f[[i]]]
}],
TrackedSymbols -> i,
Deployed -> True
]

-
Thanks for a working alternative and more important for given me some ideas what is actually causing this behaviour (some interference with scoping used by Manipulate). I'm afraid though I have some digging to do as this behaviour is not replicable by anyone else and I want to find out the cause. Thanks! – Sander Jun 19 '14 at 4:26