Perform the force generated by the Hooke's attraction.
[Hx,Hy] = NL_G_HookeForce(K,I,J,X,Y,L)
Hooke coefficient.
Starting node.
Ending node.
X-coordinates vector of nodes.
Y-coordinates vector of nodes.
Edge length at the equilibrium.
X-coordinate of the Hooke's attraction.
Y-coordinate of the Hooke's attraction.
NL_G_HookeForce performs the Hooke's attraction between the two nodes I and J of a graph after their displacement. The position of all nodes is assumed to be stored in [X,Y]. The edge length at the equilibrium is L. The Hooke's law of elasticity is an approximation that states that the extension of a spring is in direct proportion with the load applied to it (WIKIPEDIA).
n=3;//network size l0=5;//a maximum of 5 links are created for any created node L=1000;//network square area side kh=0.1;//Hooke's coefficient [g,d]=NL_T_BarabasiAlbert(n,l0,L);//generation of the topology n=g.node_number;//real network size l=length(g.head);//number of links nx=g.node_x;//current position ny=g.node_y; li=NL_F_RandInt1n(l);//selection of a link [nd,nf]=NL_G_Edge2Nodes(g,li);//edge index le=50;//edge length at the equilibrium [Hx,Hy]=NL_G_HookeForce(kh,nd,nf,nx,ny,le)//application of NL_G_HookeForce | ![]() | ![]() |