Perform the Dijkstra's algorithm on a network topology from a source node in respect with given links weights.
[dist,pred]=MobilityDijkstraWeight(n,head,tail,weight,ni)
network size.
links head vector.
links tail vector.
links weight vector.
source node.
distance vector from the source node towards remaining network nodes.
predecessors vector to reach the source node from remaining network nodes.
MobilityDijkstraWeight aims to perform the Dijkstra's Algorithm from the source node ni on a network topology represented by 3 vectors: head, tail and weight. Links weights are provided by the user. dist and pred permit to reconstruct the shortest path between any network nodes towards the source node ni.
n=80;//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. i=Random(length(g.node_x));//selection of the source node show_graph(g); hilite_nodes(i); [dist,pred]=MobilityDijkstraWeight(g.head,g.tail,g.edges.data.length,i);//Application of MobilityDijkstraWeight i dist pred | ![]() | ![]() |