How to calculate the new positions of other vertices in spring-mass system graph, when one vertex is actively moved by the user? I am developing an android based game. I have 10 soldiers uniformly spaced in the scene using some kind of formation. Example - banks of 3 3 and 4 or banks of 4 4 2 or banks of 4 2 and 4 etc...
Now the user can translate any one soldier he has currently selected in any position in the 2d scene. WHat I want is other soldiers to move automatically and place themselves such that space looks to be equally partitioned, yet still somewhat follow the original formation e.g. 4 2 and then 4. 
o o o o
 o  o  
o o o o

I thought that this could be nicely done with spring mass system, so pulling one user away will automatically adjust others. But i dont understand how i should calculate the new position of eery user in the graph?

 A: Let's first consider that each of your springs acts linearly, ie, the relationship between the relative displacement of the spring and force is linear: $k \Delta \ell/\ell =f$. Your problem is formulated in the plane, so each mass' position has two coordinates, let's say $(x_i,y_i)$. For each mass (you do not really need this parameter in your problem), you can express Newton's second law stating the static equilibrium of each mass. By doing so, you will find a matrix, commonly called the stiffness matrix of your system such that:
$\begin{bmatrix}
k_{x11} & k_{x12} & k_{x13} & k_{x14} & \cdots & k_{x1n}\\
k_{y11} & k_{y12} & k_{y13} & k_{y14} & \cdots & k_{y1n}\\
k_{x21} & k_{x22} & k_{x23} & k_{x24} & \cdots & k_{x2n}\\
k_{y21} & k_{y22} & k_{y23} & k_{y24} & \cdots & k_{y2n}\\
& &\ddots \\
k_{xn1} & k_{xn2} & k_{xn3} & k_{xn4} & \cdots & k_{xnn}\\
k_{yn1} & k_{yn2} & k_{yn3} & k_{yn4} & \cdots & k_{ynn}
\end{bmatrix}\begin{pmatrix}x_1\\y_1\\x_{2s}\\y_{2s} \\\vdots \\ x_n \\ y_n\end{pmatrix}=\begin{pmatrix}0\\0\\f_{x_2}\\f_{y_2} \\\vdots \\ 0 \\ 0\end{pmatrix}$
Then by moving one of the mass, ie, by specifying one of the doublets $(x_i,y_i)$ (here, $(x_{2s},y_{2s})$ with dual unknown forces $(f_{x_2},f_{y_2})$), you will be able to find the remaining positions $(x_i,y_i)$ by inverting the corresponding stiffness submatrix. This provides the overall idea without going into details and this should work for small displacements of the masses even though you can try with large displacements.
This is based on the Direct Stiffness Method for which there is a decently large amount of information online: spring system and stiffness displacement method.
Also, the position of at least one of the masses has to be prescribed in space, so that the system of equations can be inverted and solved.
