Highlight the leaves of a tree (BFS,BFSW,DFS,DFSW).
[Go] = NL_G_HighlightTreeLeaves(G,S,P,D,Sc,Sb,Sd,Ac,Ab,Ad,Lc,Lb,Ld,Ec,Ew)
Network graph.
Sink (Root).
Predecessor vector.
Aggregation matrix.
Sink color.
Sink border.
Sink diameter.
Aggregator color.
Aggregator border.
Aggregator diameter.
Leaf color.
Leaf border.
Leaf diameter.
Tree edge color.
Tree edge width.
Output graph.
NL_G_HighlightTreeLeaves highlights the leaves of a tree (BFS,BFSW,DFS,DFSW) extracted from the graph G. The sink of the tree is S. The predecessor vector P generated by BFS, BFSW, DFS or DFSW algorithms applied in S is needed. D is a matrix (n,n+1) if the graph is composed by n nodes. We assume that each graph node forwards a packet towards the sink according to the path performed in respect with the predecessor vector P. We store in each line of index i of d the source node of all packets that have crossed the node i to reach the sink. The visualization highlights the tree components, e.g. the sinks (color: , border:
, diameter:
), the aggregators (color:
, border:
, diameter:
) and the leaves (color:
, border:
, diameter:
). The edges of the tree are also displayed with the color
and the width
. The output graph is stored in
.
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 w=1;//window index f=NL_G_ShowGraph(g,w);//graph visualization n=g.node_number;//real network size sink=NL_F_RandInt1n(n);//selection of the sink dw=5;//visualization parameter ind=1;//window index [gBFS,VBFS,predBFS]=NL_R_BFSPlot(g,sink,dw,ind);//tree building dist=ones(1,g.node_number);//distance vector dist(sink)=100000000; [dataBFS]=NL_R_AggregationTree(predBFS,dist,sink);//generation of the aggregation matrix sc=2;//visualization parameters sb=10; sd=40; ac=1; ab=3; ad=30; lc=5; lb=10; ld=20; ec=2; ew=3; [gl]=NL_G_HighlightTreeLeaves(g,sink,predBFS,dataBFS,sc,sb,sd,ac,ab,ad,lc,lb,ld,ec,ew);//application of NL_G_HighlightTreeLeaves i2=2;//window index ft=NL_G_ShowGraph(gl,i2);//graph visualization | ![]() | ![]() |