Perform the Euclidian distance between two network nodes of a graph.
[d]=NARVAL_F_Distance(n1,n2,nx,ny)
network node.
network node.
x-coordinates of network nodes.
y-coordinates of network nodes.
NARVAL_F_Distance calculates the Euclidian distance between two network nodes n1 and n2. The network nodes coordinates are assumed to be stored inside the vectors nx and ny.
n=80;//network size L=1000;//network square area side dmax=100;//locality radius [g]=NARVAL_T_LocalityConnex(n,L,dmax);//generation of a random topology in respect with the Locality method. N=length(g.node_x);//real network size [n1,n2]=NARVAL_F_Random_i_j(N);//selection of two distinct nodes nd=5*ones(1,N);//display the graph nc=ones(1,N); nd([n1 n2])=10; nc([n1 n2])=5; g.node_border=nd; g.node_color=nc; ind=1;//window index [f]=NARVAL_G_ShowGraph(g,ind); [d]=NARVAL_F_Distance(n1,n2,g.node_x,g.node_y);//application of NARVAL_F_Distance n1 n2 d | ![]() | ![]() |