<< NARVAL_R_PathWeightMod NARVAL NARVAL_R_Prim >>

NARVAL >> NARVAL > NARVAL_R_PredRoute

NARVAL_R_PredRoute

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.

Calling Sequence

[path]=NARVAL_R_PredRoute(pred,dist,i,j)

Parameters

pred :

vector composed by the predecessor of each node in order to reach the source node.

dist :

vector composed by the distance between each node and the source node.

i :

emission node.

j :

destination node.

path :

route between i and j.

Description

NARVAL_R_PredRoute performs the path path between 2 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.

Examples

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);
EBi=2;
EB=EBi*ones(1,nl);
EC(p)=5;
EB(p)=2*EBi;
Dbi=5;
D=Dbi*ones(1,nf);
D(path)=Dbi*2;
g.node_border=D;
g.edge_color=EC;
g.edge_width=EB;
ind=1;
[f]=NARVAL_G_ShowGraph(g,ind);
path

Author

http://wwwen.uni.lu/interdisciplinary_centre_for_security_reliability_and_trust

Contact

<< NARVAL_R_PathWeightMod NARVAL NARVAL_R_Prim >>