Perform the initialization of the Flood algorithm.
[m,np]=RoutingFloodInit(g,ne,nr,TTL)
network graph.
source node.
destination node.
discovery radius (Packet Time To Live).
discovery packet storage matrix.
quantity of discovery packets on the network.
RoutingFloodInit initializes the Flood algorithm from the source node ne on the graph g in order to find multiple paths towards the destination node nr.
The research is limited by the maximal quantity of nodes TTL that a discovery packet can cross before its rejection by the network. The set of possible 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 v=[];//display the first step of the flood for i=1:np v=[v m(i,1:2)]; end pr=nodes_2_path(v,g); EC=ones(1,nl); EB=ones(1,nl); EC(pr)=5; EB(pr)=2; D=ones(1,nf); D(ne)=3; g.node_border=D; g.edge_color=EC; g.edge_width=EB; show_graph(g); m np | ![]() | ![]() |