# How could I do make both vertices and edges in a graph moveable?

How could I make both vertices and edges moveable like this.

(In the image only nodes are movable but I would like to do this for edges as well)

Graph[{1, 2, 3, 4, 5, 6}, {1 \[UndirectedEdge] 3,
1 \[UndirectedEdge] 5, 1 \[UndirectedEdge] 6, 2 \[UndirectedEdge] 5,
2 \[UndirectedEdge] 6, 1 \[UndirectedEdge] 6,
3 \[UndirectedEdge] 4, 3 \[UndirectedEdge] 5, 3 \[UndirectedEdge] 6,
5 \[UndirectedEdge] 6}, VertexLabels -> "Name"]

• Something like this is coming in the next version of the IGraph/M package, if I ever get to it ... stay tuned! Commented Feb 19, 2022 at 22:53
• @Szabolcs that's nice. Is there any sample so I can try now?
– hana
Commented Feb 19, 2022 at 23:01

Use the option PerformanceGoal -> "Quality" in Graph

g1 = Graph[{1 -> 2, 2 <-> 3, 3 -> 1, 1 -> 3},
VertexLabels -> Placed["Name", Center], VertexSize -> {v_ :> v/10},
VertexStyle -> Directive[EdgeForm[{Thick, Black}], White],
VertexLabelStyle -> Large, PerformanceGoal -> "Quality"]


To move vertices interactively (with the edges adjusting automatically to new vertex locations), use Show @ g1 to get a Graphics object which can be interactively manipulated after double-clicking on it:

Show @ g1


• Would it be possible to move the edges as you like? I tried but the edges got separated.
– hana
Commented Feb 20, 2022 at 0:33
• @hana, can't think of a simple way to get full interactivity. See these Q/As on DynamicLocation for some examples that you might find useful.
– kglr
Commented Feb 20, 2022 at 2:21