Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Sometimes I have a graph and I want to make tweaks to the vertex locations. Is there any way to manually adjust graph vertex location by dragging?

If I double click to edit, I can move around the vertex rendered shape (square) or the label inside the square, but not the vertex itself. Also, even if I could move the vertex, it is under the rendered square/circle which does not seem to move with it.

I have been using GraphPlot. (Should I be using Graph instead? I don't really understand the difference.):

 VertexLabeling -> True, PlotStyle -> {Black}, 
 VertexRenderingFunction -> ({EdgeForm[Black], White, Disk[#1, 0.08], 
     Black, Text[#2, #1]} &)]
share|improve this question
Highly related (if not duplicate): Manipulate Graphs. – István Zachar Dec 9 '13 at 21:06
up vote 5 down vote accepted

You can change the locations of the vertices by double clicking on them and dragging. For example:

GraphPlot[{1 -> 2, 2 -> 3, 3 -> 4, 4 -> 5, 5 -> 1}]

enter image description here

After double clicking and dragging two of the vertices:

enter image description here

If you have labels and ornaments on the vertices, then you can move them independently. For example, after moving two of the circles, numbered labels, and vertices:

GraphPlot[{1 -> 2, 2 -> 3, 3 -> 4, 4 -> 5, 5 -> 1}, PlotStyle -> {Black}, 
VertexRenderingFunction->({EdgeForm[Black],White,Disk[#1, 0.08],Black,Text[#2,#1]} &)]

enter image description here

share|improve this answer
How do I do deal with the situation that there is a rendered label on top of the vertex? – Tyler Durden Dec 10 '13 at 0:53
How are you rendering the label? – bill s Dec 10 '13 at 1:06
I have updated the post to show the rendering code. – Tyler Durden Dec 10 '13 at 1:14
I guess the answer is the same: you can move the labels independently of the vertices, the circles, and the numbers. – bill s Dec 10 '13 at 1:22

You may try:

GraphEdit[Table[i -> Mod[i^3, 27], {i, 0, 27}]]
share|improve this answer

Your Answer


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.