Perform the topology discovery propagation of the Flood algorithm.
[m,np]=RoutingFloodIteration(g,ne,nr,m,np)
network graph.
source node.
destination node.
discovery packet storage matrix.
quantity of discovery packets on the network.
RoutingFloodIteration propagates discovery packets of the Flood algorithm on the graph g emitted from the source node ne towards the destination node nr.
The set of candidate routes is stored into the matrix m (route|arrival|TTL|route length). The current quantity of discovery packets rates np.
n=100;//network size L=1000;//network square area side dmax=100;//locality radius [g]=NtgLocalityConnex(n,L,dmax);//generation of a random topology in respect with the Locality method. nl=length(g.head);//quantity of network links nf=length(g.node_x);//real network size [ne nr]=Random_i_j(nf)//selection of the source and destination nodes [d,p] = graph_diameter(g); TTL=length(p);//initialization of TTL [m,np]=RoutingFloodInit(g,ne,nr,TTL);//application of RoutingFloodInit [m,np]=RoutingFloodIteration(g,ne,nr,m,np);//application of RoutingFloodIteration EC=ones(1,nl); EB=ones(1,nl); D=ones(1,nf); D(ne)=4; v=[];//display the first step of the flood for i=1:np v=[v nodes_2_path(m(i,1:2),g)]; end [v]=Unity(v); EC(v)=5; EB(v)=4; D(m(:,2)')=3 v=[];//display the first step of the flood for i=1:np v=[v nodes_2_path(m(i,2:3),g)]; end [v]=Unity(v); EC(v)=2; EB(v)=3; D(m(:,3)')=2 g.node_border=D; g.edge_color=EC; g.edge_width=EB; show_graph(g); m np | ![]() | ![]() |