Perform the path between two nodes of a tree.
[p] = NARVAL_R_TreeN2R(ni,nj,r,pred)
node.
node.
root.
predecessor vector.
path.
NARVAL_R_TreeN2N performs the path p between the two nodes ni and nj of the tree defined by its root node r and its predecessor vector pred. The algorithm finds a common ancestor between the two paths from each node ni and nj towards the root node. Finally the two sub-paths are merged into a single path.
n=150;//network size L=1000;//network square area side dmax=100;//Locality radius [g]=NARVAL_T_LocalityConnex(n,L,dmax);//generation of a topology in respect with the Locality method [r,nind]=NARVAL_F_AleaVec(1:length(g.node_x));//selection of the root node dw=5;//display parameter ind=1;//window index [ni,nind]=NARVAL_F_AleaVec(nind);//selection of ni [nj,nind]=NARVAL_F_AleaVec(nind);//selection of nj [go,v,pred]=NARVAL_R_BFS(g,r,dw,ind);//performance of the tree [p1]=NARVAL_R_TreeN2R(ni,r,pred);//path between node ni and the root [p2]=NARVAL_R_TreeN2R(nj,r,pred);//path between node nj and the root [path]=NARVAL_R_TreeN2N(ni,nj,r,pred);//application of NARVAL_R_TreeN2N p1 p2 path | ![]() | ![]() |
Dr. Foued Melakessou
Research Associate
Interdisciplinary Centre for Security, Reliability and Trust
Room F106
University of Luxembourg
6, rue Coudenhove Kalergi
L-1359 Luxembourg-Kirchberg
E-mail: foued.melakessou@uni.lu
Tel: (+352) 46 66 44 5346