Perform the data aggregation on each node of a graph (Tree).
[R] = NL_R_AggregationTree(P,D,S)
Predecessor vector.
Distance vector.
Sink.
Output data.
NL_R_AggregationTree performs the data aggregation R (all information from its children) on each node of the graph defined by the predecessor vector P generated by the Bellman-Ford algorithm, the Dijkstra's algorithm, BFS, DFS or the Prim's algorithm applied in the sink node S. The graph is assumed to be composed by n nodes. R is a matrix (n,n+1). We assume that each graph node forwards a packet towards the sink in respect with the path performed in respect with the predecessor vector P. We store in each line of index i within R the source node of all packets that have crossed the node i to reach the sink. Thus R gives the relevant information about the location where it is preferable to aggregate packets in constrained environments.
n=100;//network size L=1000;//network squared area side r=150;//Locality radius [g]=NL_T_LocalityConnex(n,L,r);//generation of a topology st=[1 17 5 6 2 3];//style w=1;//window index f=NL_G_ShowGraph(g,w);//graph visualization n=g.node_number;//quantity of nodes sink=NL_F_RandInt1n(n);//selection of the sink ind=2;//window index dw=5;//display parameter [gBFS,VBFS,predBFS]=NL_R_BFSPlot(g,sink,dw,ind);//performance of the BFS algorithm dist=ones(1,g.node_number);//distance vector used in NARVAL_R_AggregationTree dist(sink)=100000000;//initialization of the value for the sink [dataBFS]=NL_R_AggregationTree(predBFS,dist,sink);//application of NL_R_AggregationTree ip=3;//window index ymax=max([dataBFS(:,$)]);//graph visualization scf(ip); clf(ip); plot2d(1:n,dataBFS(:,$)',style=st(1),rect=[1 0 n ymax]); plot2d3(1:n,dataBFS(:,$)',style=st(1),rect=[1 0 n ymax]); xtitle('BFS','Sensor ID','Aggregation Level',''); xgrid(1); | ![]() | ![]() |