Perform the shortest path between two network nodes in respect with the predecessor vector generated by the Bellman-Ford algorithm, the Dijkstra's algorithm, BFS, DFS or the Prim's algorithm.
[p] = NARVAL_R_PredRoute(pred,d,i,j)
vector composed by the predecessor of each node in order to reach the source node.
vector composed by the distance between each node and the source node.
emission node.
destination node.
route between i and j.
NARVAL_R_PredRoute performs the path p between the two network nodes i and j in respect with the predecessor vector pred generated by the Bellman-Ford algorithm, the Dijkstra's algorithm, BFS, DFS or the Prim's algorithm applied in i.
n=150;//network size l=1000;//network squared area side d=100;//Locality radius [g]=NARVAL_T_LocalityConnex(n,l,d);//application of NARVAL_T_LocalityConnex nf=length(g.node_x);//real network size nl=length(g.head);//quantity of network links [i,j]=NARVAL_F_Random_i_j(nf);//selection of the emission and destination nodes [dist,pred]=NARVAL_R_Dijkstra(g,i);//application of NARVAL_R_Dijkstra [path]=NARVAL_R_PredRoute(pred,dist,i,j)//application of NARVAL_R_PredRoute p=NARVAL_G_Nodes2Path(path,g);//display the path between i and j EC=ones(1,nl);//edge color EBi=2; EB=EBi*ones(1,nl);//edge width EC(p)=5; EB(p)=2*EBi; Dbi=5; D=Dbi*ones(1,nf);//node border D(path)=Dbi*2; g.node_border=D; g.edge_color=EC; g.edge_width=EB; ind=1;//window index [f]=NARVAL_G_ShowNodesIndex(g,ind);//graph visualization 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