The primary functions of AOLSR protocol are topology detection and path estimation. The network topology is sensed to inform the nodes the topology information. The path estimation utilizes the modified Dijkstra's algorithm to compute the various paths based on the information from topology detection. A link failure in one path should not affect other routes. The source path (route from source to destination including all the hops) is always preserved in the header of the data packets. The data flow diagram of AOLSR protocol is shown in Figure 1.
Topology detection and path estimation are responsible for the determination of the multiple paths from the source to the destination. The instability of the wireless medium and the variations in the network topology necessitates the auxiliary functions of the OLSR protocol such as, path recovery and loop discovery. Path recovery is used for the effective decrease of the packet loss and loop discovery is used to detect and avoid loops in the routing paths.
4.1 Topology detection
The information in the network topology is sensed by topology detection. The procedure in AOLSR consists of an additional process known as energy detection to that of OLSR, with processes namely, link detection, neighbor detection, and topology discovery. Link detection constructs the link set consisting of local link information. It concentrates on the packet communication between the OLSR interfaces and their addresses. Neighbor detection constructs a singlehop neighbor set and a doublehop neighbor set consisting of network information and node addresses. Topology discovery constructs a topology set containing the information about the nodes that are greater than double hops. The topology set construction depends on the TC message flooding.
Each sensor node in the WSN obtains sufficient topological information to enable routing. The AOLSR protocol estimates the route quality and energy usage according to the number of hops and maintains the link information. The hop count and energy consumption are used as the link metrics in the AOLSR protocol.
4.2 Path estimation
The determination of paths is based on an ondemand methodology to obviate the density estimation of multiple paths for every feasible destination. The lifetime of the nodes and links determine the path selection. The routes with longer lifetime (energy) are chosen to prohibit the failure of the entire route in case of energy exhaustion of certain nodes or links. A multipath estimation hypotheses model is introduced as a prerequisite for the modified Dijkstra's algorithm.
4.2.1 Hypotheses model
A multipath routing protocol constructs a group g_{
n
} of n paths without any loops. These paths connect a source node S to a destination node D.
An ad hoc network is defined by a directed energy graph (an abstract data type) G = (g_{
v
}, g_{
a
}, f_{
c
}), where g_{
v
} is the group of vertices, g_{
a
} ⊂ g_{
v
} × g_{
v
} the group of arcs, and f_{
c
}: g_{
v
} → ℝ^{*+} a rigidly realpositive cost function. The graph is initialized to be undirected, i.e., (v_{1}, v_{2}) ∈ g_{
a
} ⇒ (v_{2}, v_{1}) ∈ g_{
a
} and f_{
c
}(v_{1}, v_{2}) = f_{
c
}(v_{2}, v_{1}) and loopfree, i.e., No arcs from a node connect to itself. It is also assumed that a pair of vertices cannot be linked by more than one arc. A path between S and D is defined as a sequential order of vertices (v_{1}, v_{2}, …, v_{
D
}) so that consecutive vertices are elements of g_{
a
}, where v_{1} = S and v_{
D
} = D. These hypotheses define the cost function f_{
c
} in an ad hoc manner.
4.2.2 Modified Dijkstra's algorithm
The AOLSR maintains a status flag for every sensor node in the WSN to learn the validity of the routes to the relative sensor node. The status flag of every node x (status _flag_{
x
}) is initially set to 0, which implies the path to the corresponding destination needs to be refreshed or does not prevail. The source node will initially check status _flag_{
x
} when a RREQ to node x is placed.

When status _flag_{
x
} is equal to 0, the node executes Algorithm I to obtain the multiple routes to node x. These routes are stored in the multipath routing table and the relative status _flag_{
x
} is updated to 1.

When status _flag_{
x
} is equal to 1, the node determines a valid path to node x in the multipath routing table.
Whenever the node receives a new HELLO or TC message, variations occur in the topology set, and all the status flags will be set to 0. Algorithm I briefs the steps for the determination of n routes from S to D.
This modified Dijkstra's algorithm is applied to a graph G = (g_{
v
}, g_{
a
}, f_{
c
}), two vertices (S, D) ∈ g_{
a
}^{2}, and a rigidly realpositive integer n. It results in n paths (P_{1}, P_{2}, …, P_{
n
}) from S to D obtained from G. The following predefined functions or conventions are used:

Dijkstra(G, S) is the conventional Dijkstra algorithm [19] which yields the source tree (T_{
s
}) of the shortest route from vertex S in a graph G, where a tree is a type of data structure.

Get_Path(T_{
s
}, D) is the function to obtain the shortest path to D from T_{
s
}.

a^{1} means the opposite edge of a.

Vertex _Head(a) gives the head (forward vertex edge) of a.
Initially, the links are selected according to the maximum lifetime as per the following three conditions:

The link with the maximum lifetime is chosen from the former links which initiate from a specific node x.

When there are many links with equal lifetime, the lifetimes of the neighbors in each link are compared, and the link whose neighbor possesses the maximum lifetime is chosen.

When there are various links with equal lifetime and whose neighbors also possess equal lifetime, a link is chosen at random.
The links are selected are selected every time and further path selection is performed by using the two incremental functions. The energy factors are given by two iteration factor weights: weight for links (W_{
l
}) and weight for nodes (W_{
n
}). The range of these weights is [0, 1]. The iteration factor weights are given by the following formulae:
{\mathit{W}}_{\mathit{l}}=\left({{\mathit{t}}_{\mathit{l}}}_{\_max}\u2013{{\mathit{t}}_{\mathit{l}}}_{\_min}\right)/{{\mathit{t}}_{\mathit{l}}}_{\_\mathrm{avg}}
(2)
{\mathit{W}}_{\mathit{n}}=\left({{\mathit{t}}_{\mathit{n}}}_{\_\mathit{x}}\u2013{{\mathit{t}}_{\mathit{n}}}_{\_\mathrm{threshold}}\right)/{{\mathit{t}}_{\mathit{n}}}_{\_\mathrm{threshold}}
(3)
In (2), t_{l _max}, t_{l _min}, and t_{l _avg} respectively denote the maximum, minimum, and average lifetime of the links in the entire route. In (3), t_{n _x} denotes the lifetime of node x and t_{n _threshold} denotes the threshold of the lifetime for any node in the route. The computation of the energy factors can be altered according to the various inclines for the disconnectivity of the links or disconnectivity of the nodes during path selection.
Two incremental functions f_{
a
}, f_{
r
} : ℝ^{*+} → ℝ^{*+} are introduced at each round to obtain a disjoint route between S and D. f_{
a
} is used to increase the arc costs that converge to the vertices of the previous path P_{
x
}. f_{
r
} is used to increase the arc costs that belong to the previous path P_{
x
} (or the opposite arcs belonging to it). This will enable the further routes to utilize various arcs. The three possible conditions are as follows:

When f_{
i
} = f_{
a
} < f_{
r
}, the routes become arcdisjoint.

When f_{
i
} < f_{
a
} = f_{
r
}, the routes become vertexdisjoint.

When f_{
i
} < f_{
a
} < f_{
r
}, the routes try to be vertexdisjoint, but if not possible, they become arcdisjoint.
In the above conditions, f_{
i
} denotes the identity function. The cost functions determine the variety in the n paths of the network topology. There is no necessity that the multiple paths estimated by this algorithm require being completely disjointed. This is because the number of disjoint routes is bounded to the (S, D) minimal cut. The minimal cut of (S, D) is the dimension of the smallest subset of edges necessary to link S to D. The minimal cut is estimated by the neighborhoods of source and destination. A demerit of completely disjoint algorithm is the generation of longer routes because each local cutoff can be applied only once.
An illustration of the modified Dijkstra's algorithm is shown in Figure 2. The number of hops is used as the connection cost metric, f_{
a
}(c) = 2c, and f_{
r
}(c) = 3c. More penalties are assigned to the traversed links. The cost of the links is set to unity initially.
First, the shortest route S → E → F → G → D is determined. Then, the cost functions are applied to increase the cost of the corresponding arcs:

S → E, E → F, F → G, G → D will be modified from 1 to 3 as per f_{
r
}.

S → A and C → G will be altered from 1 to 2 as per f_{
a
}.
Next, the second shortest route S → A → B → C → G → D is determined. Different cost functions can determine numerous multipath sets (linkdisjoint or nodedisjoint) according to the network preferences. Another network topology example is shown in Figure 3.

When f_{
a
}(c) = c, and f_{
r
}(c) = 3c are chosen, the penalty is assigned only to the traversed links, and the two linkdisjoint routes obtained are S → E → A → F → D and S → B → A → H → D.

When f_{
a
}(c) = 2c, and f_{
r
}(c) = 3c are chosen, the penalty is assigned only to the traversed nodes, and the two nodedisjoint routes obtained are S → E → A → F → D and S → B → C → G → H → D.
4.3 Path recovery
Topology detection determines the network topology details with the communication of HELLO and TC messages. This information is stored in the link set, neighbor set, or topology set of the local node. Practically, the topology information base is not competent compared to the real network topology owing to the mobile nature of the ad hoc network.
During the message generation time interval of the HELLO and TC messages, the topology may vary due to nodal movement. The control message can get expired or even get lost due to the possible collision or delay in the control messages. These conditions are the reasons for the variability between the actual network topology and the network topology information base.
Path recovery is used to fulfill the gap between the actual network topology and the network topology information base. First, a node checks whether the next hop in the source path is one of its neighbors. If so, the packet is transmitted normally; otherwise, it is decided that the ‘next hop’ node is not available. Next, the node will recalculate the path and transmit the packet in the new route.
An example of path recovery is given in Figure 4. The packets are routed from source S to destination D. The actual paths are S → E → F → D and S → A → B → G → D. But, the node G displaces out of the transmission range of node B and loses the second path. Now, the link failure cannot be detected immediately by the source node because of the delay in TC messages. So, the source node keeps on transmitting the packets along the same path which are dropped consequently. When path recovery is included, the node B will check upon the incoming packet whether node G is yet one of its neighbors before transmitting the packet according to the primary route. When node G is not one of the neighbors of node B, the former node will recalculate the path to node D, and find B → C → D. Then the incoming packets are transmitted through the new route.
This technique does not introduce much additional delay because path recovery checks only the topology information stored in the local node. It will also greatly enhance the PDR of the network. The delivery ratio of the AOLSR protocol with path recovery is about 50% higher than that without path recovery.
4.4 Loop discovery
Loops in the network are an essential issue in routing because they result in data redundancies and communication latency. Link layer notification (LLN) must be mandatorily discussed for the enhancement of the packet delivery ratio, before handling the problem of loops in the network [20]. The link layer information briefs about the linkage to the available neighboring nodes. This information is additionally used to that of the HELLO message for the maintenance of the neighbor set and MPR selector group. The AOLSR protocol acts on the Acknowledgement (ACK) message from LLN and deletes the related connections from its information base.
Theoretically, the routes produced by Dijkstra's algorithm and the AOLSR protocol are devoid of loops. But, practically due to LLN and path recovery, loops in the network are possible. A node attempts to transmit a packet over a link but does not succeed in the end and so the link layer will give a feedback to the AOLSR protocol to apprise about the link loss. This sort of sudden interruption will require additional executions on the topology information base besides the normal HELLO and TC messages. This implies that other nodes do not know about these modifications immediately. Consequentially, the LLN might result in variable topology information in the various nodes. The inclusion of path recovery enables the modification of the route in intermediate nodes and the loop in the network is temporarily constrained.
An example of loop production is shown in Figure 5. Here, node X is taken as an intermediate node of some former route. The packets with the primary path X → Z arrive at node X and require to be transmitted to node Z. Next, node Z displaces out of the transmission coverage of nodes X and Y, which expires the links X → Z and Y → Z.
The transmission of the incoming packets at node X to node Z will be failed, as a result of which the AOLSR protocol in node X will be accepted by LLN, and the path X → Z is removed from the link set of node X. For node X, although it identifies the link failure of X → Z by LLN, it is tough to detect the failure of Y → Z instantly. This is due to the late removal of link Y → Z because of the high expiry time of NEIGHB _HOLD _PERIOD. Simultaneously, the path recovery process will be triggered and a fresh path X → Y → Z will be determined. The forthcoming packets will be transmitted through this new path and will be rerouted to node Y. These operations are also repeated in node Y. Since node Y cannot identify the link failure of X → Z immediately, the recent route discovered by path recovery is Y → X → Z. This creates a loop as the packet will traverse Y → X → Y. This is only a transient loop existing for several seconds and will diminish when the corresponding link expires. But this sort of temporary loops will hinder the links in the loop and choke the respective transmission area.
To overcome the previous disadvantage, a loop discovery technique based on source routing is applied which does not accumulate much memory overhead. After the process of path recovery, a new route will be estimated from the present node to the destination. This method will utilize the new route when there are no loops in the network; otherwise, it will determine another route according to the modified Dijkstra's algorithm. Suppose no suitable route exists, the packet will be discarded.
Node X will obtain a route X → Y → Z by path recovery. Now, when the packet arrives at node Y, a new route Y → X → Z will be produced because of the connection failure of Y → Z. Node Y will examine the new route with the former primary route X → Y → Z in the packet. The reduction of loops in the network will efficiently decrease the network congestion and endtoend delay.