Compute all paths between a destination and the root node from the ARC algorithm (Sort).
[Ps,Cs] = NL_R_ARCMultiPathSort(P,C,G)
Paths matrix.
Paths color matrix.
Graph.
Sorted paths matrix.
Sorted paths color matrix.
NL_R_ARCMultiPathSort sorts all paths P between a destination and the root node from the ARC algorithm. For the visualization, we used 4 colors in order to detect the change from one arc to another one. Paths are sorted (min length to max).
Ax=[500 465 450 465 500 535 550 535]; Ay=[100 150 200 250 300 250 200 150]; Bx=[400 300 200 250 300 350 400]; By=[100 100 150 175 200 200 200]; Cx=[600 700 800 750 700 650 600]; Cy=[100 100 150 175 200 200 200]; Dx=[175 175 200 225 275 300]; Dy=[225 300 350 400 375 300]; Ex=[350 375 415 450]; Ey=[300 350 400 350]; Fx=[550 600 650 650]; Fy=[350 400 350 300]; Gx=[700 725 750 775 800]; Gy=[300 350 400 350 300]; Hx=[250 275 325 375 400]; Hy=[500 550 600 550 500]; Ix=[650 675 715 750 750]; Iy=[450 550 600 550 450]; Jx=[550 550 575 625 675]; Jy=[450 550 650 700 650]; Kx=[350 400 450 515 575]; Ky=[700 750 800 800 750]; nodx=[Ax Bx Cx Dx Ex Fx Gx Hx Ix Jx Kx]; nody=[Ay By Cy Dy Ey Fy Gy Hy Iy Jy Ky]; heA=[1 2 3 4 5 6 7 8]; taA=[2 3 4 5 6 7 8 1]; heB=[1 9 10 11 12 13 14 15]; taB=[9 10 11 12 13 14 15 3]; heC=[1 16 17 18 19 20 21 22]; taC=[16 17 18 19 20 21 22 7]; heD=[11 23 24 25 26 27 28]; taD=[23 24 25 26 27 28 13]; heE=[14 29 30 31 32]; taE=[29 30 31 32 4]; heF=[6 33 34 35 36]; taF=[33 34 35 36 21]; heG=[20 37 38 39 40 41]; taG=[37 38 39 40 41 18]; heH=[26 42 43 44 45 46]; taH=[42 43 44 45 46 31]; heI=[35 47 48 49 50 51]; taI=[47 48 49 50 51 39]; heJ=[33 52 53 54 55 56]; taJ=[52 53 54 55 56 49]; heK=[44 57 58 59 60 61]; taK=[57 58 59 60 61 55]; he=[heA heB heC heD heE heF heG heH heI heJ heK]; ta=[taA taB taC taD taE taF taG taH taI taJ taK]; n=length(nodx); [gt] = NL_G_MakeGraph('ARC',n,ta,he,nodx,nody); f=NL_G_ShowGraphN(gt,1); marc=zeros(11,30);//11 arcs marc(1,1:length(heA)+1)=[heA taA($)];marc(1,$)=length(heA)+1; marc(2,1:length(heB)+1)=[heB taB($)];marc(2,$)=length(heB)+1; marc(3,1:length(heC)+1)=[heC taC($)];marc(3,$)=length(heC)+1; marc(4,1:length(heD)+1)=[heD taD($)];marc(4,$)=length(heD)+1; marc(5,1:length(heE)+1)=[heE taE($)];marc(5,$)=length(heE)+1; marc(6,1:length(heF)+1)=[heF taF($)];marc(6,$)=length(heF)+1; marc(7,1:length(heG)+1)=[heG taG($)];marc(7,$)=length(heG)+1; marc(8,1:length(heH)+1)=[heH taH($)];marc(8,$)=length(heH)+1; marc(9,1:length(heI)+1)=[heI taI($)];marc(9,$)=length(heI)+1; marc(10,1:length(heJ)+1)=[heJ taJ($)];marc(10,$)=length(heJ)+1; marc(11,1:length(heK)+1)=[heK taK($)];marc(11,$)=length(heK)+1; [cmarc]=NL_R_ARCCursor(marc); [RTARC]=NL_R_ARCRT(cmarc); s=1; [RTARCO]=NL_R_ARCRTInit(RTARC,s);//initial routing table A=[cmarc(:,1:$-1) zeros(lc,2) cmarc(:,$)]; [lc cc]=size(cmarc); A=[cmarc(:,1:$-1) zeros(lc,2) cmarc(:,$)]; for i=1:lc curs=A(i,$-3); direct=RTARCO(curs,3); if (direct==1) then A(i,$-2)=1;//left A(i,$-1)=0;//right else A(i,$-2)=0;//left A(i,$-1)=1;//right end end l1=11; l2=12; r1=5; r2=19; [P,CP]=NL_R_ARCMultiPath(A,s,44,l1,l2,r1,r2,gt)//application of NL_R_ARCMultiPath [sP,sCP]=NL_R_ARCMultiPathSort(P,CP,gt)//application of NL_R_ARCMultiPathSort | ![]() | ![]() |