# Automated Methodology for Dependability Evaluation of Wireless Visual Sensor Networks
## 4 Proposed Methodology
### Routing Analysis  
Admitting that visual nodes are able to monitor the minimum coverage area, the resulting visual information must reach the sink. This task is managed by the protocol, which imposes a set of communication rules in order to optimize aspects like power consumption, overhead, throughput and delivered messages. This way, the routing analysis defines the possible connections between nodes based on the selected strategy of routing protocol and nodes position.  
These connections are mapped into an adjacency matrix \(Adj\), which consists of a square matrix that represents an abstraction of the network topology. Each position \(Adj_{ij}\) of the matrix represents the binary relation between the nodes associated to that position. That way, if there is a link connection between nodes \(i\) and \(j\), then \(Adj_{ij}=1\), otherwise \(Adj_{ij}=0\). It is important to notice that \(Adj_{ij}=Adj_{ji}\)\(\forall i,j\). Figure 8 shows the network arrangement for different routing strategies. Notice that a different selection of routing strategy preserves the same node positions but generates different topological arrangements, which leads to a different adjacency matrix.  
Algorithm 4 details how to proceed with the routing analysis, starting by creating the adjacency matrix, based on an identity matrix with dimension equal to the number of nodes (Line 2). This means that each node is connected with itself. Then, the adjacency matrix will be updated according to the selected routing strategy. If the selected strategy is DIRECT, a connection between each sensor node and the sink will be created, as shown in Line 7. For that, it is supposed that each node has enough radio transmission power to directly communicate to the sink using the DIRECT strategy. On the other hand, if the selected strategy is the FLOODING, a connection between two sensor nodes \(i\) and \(j\) will be created (Line 14) if the distance between them is less than or equal to their radio communication range, i.e, if \(d(i,j)\leq R_{c}\) (Line 13). In this case, it is important to remember that a given node will probably communicate with the sink through a sequence of message re-transmissions. Therefore, it can be considered a smaller radio communication range, which implies that each node can reduce its radio power, generating a smaller power consumption and a slower battery discharging.  
```
Data:Adj = Routing(strategy, \(R_{c}\), nodes[]); Input:Strategy of routing protocol, Radio range, List of all nodes and its parameters. Output:Adjacency matrix of network.
1\(nNodes\) = size(\(nodes\)); \(Adj\) = eye(\(nNodes\)); // Identity Matrix with dimension \(nNodes\times nNodes\) switchstrategydo
2 caseDIRECTdo
3 // Index 1 is reserved for the sink node for\(i\gets 2\)to\(nNodes\)do
4\(Adj\)(1,\(i\)) = 1; \(Adj\)(i,1) = 1;
5
6 end for
7
8 end for
9
10 caseFLODINGdo
11 for\(i\gets 1\)to\(nNodes\)do
12 for\(j\gets i\)to\(nNodes\)do
13 if\(d(nodes[i],nodes[j])\leq R_{c}\)then
14\(Adj(i,j)\) = 1; \(Adj(j,i)\) = 1;
15
16 end if
17
18 end for
19
20 end for
21
22 end for
23
24 end for
```  
**Algorithm 4**Routing