The Energy Efficient Test Assignment without reciprocal tests (EETA) algorithm builds the testing graph *D* by taking into account the total energy cost needed for the sensors to execute all the tests of the connection assignment. To this purpose, EETA defines *C*_{i,j} as the energy cost spent by the sensors *v*_{
i
} and *v*_{
j
} when the sensor *v*_{
i
} executes a test over the sensor *v*_{
j
}.

Initially, EETA initializes set *V*_{
D
} as the set of sensors in region *R*. Considering the division in four quadrant of the WSN, also *R* results divided in four quadrants accordingly. As a result also the sensors in set *V*_{
D
} can be considered split into four subsets, each corresponding to a quadrant. Specifically, we define *Q*_{
i
} (with 0≥*i*≤3) as the set of sensors positioned in quadrant *i* and selected for the connection assignment. Thus, we have *V*_{
D
}=*Q*_{0}∪*Q*_{1}∪*Q*_{2}∪*Q*_{3}, with *Q*_{
i
}⊂*V*_{
i
}.

In order to satisfy the conditions stated in Sect. 3, each of the *Q*_{
i
} must be composed of at least *t* sensors (with the sensors of *T* included). With *t* sensors in each quadrant, each sensor can be tested by *t* others (*c*2) and the number of sensors that participate to the diagnosis is sufficient to satisfy (*c*1), once we have 4*t*≥2*t*+1. As long as the testing strategy tries to diminish the number of sensors in *V*_{
D
}, we have *n*=4*t*, the minimum *n* required in our heuristic. Furthermore, the distance to *R*_{
c
}, the center of region *R*, is also taken into account to choose the sensors in *V*_{
D
}.

Note that the initial selection of *V*_{
D
} may not be sufficient to ensure that *t* sensors per quadrant are chosen, hence, in this case, other sensors outside *R* should be added to *V*_{
D
}. However, in cases where the region *R* is near the border of the network, it may not be possible to have at least *t* sensors in each quadrant. In order to guarantee the number of testers per quadrant, the center *R*_{
c
} of the region *R* is then shifted toward the center of the network and *R* is enlarged accordingly.

The total energy cost spent by the tests made by the sensors present in quadrant *i* is defined as , i.e., ∀(*v*_{
i
},*v*_{
j
})∈*E*_{
D
}∣*v*_{
i
}∈*Q*_{
i
} and . We also define the total energy cost spent by all tests made by *D* as *C*_{
T
}(*D*). Thus, we have . The selection of sensors of *V*_{
D
} is made to minimize the total energy consumption by tests between sensors.

For the diagnosis to be possible, condition (*c*2) must be fulfilled. As |*Q*_{
i
}|=*t*, we can conclude that a sensor *v*_{
k
}∈*Q*_{
i
} will test all sensors present in , i.e., *E*_{
D
}={(*v*_{
k
},*v*_{
l
}) ∀ *v*_{
k
}∈*Q*_{
i
} and for *i*=0,…,3}.

It should be observed that edge (*v*_{
i
},*v*_{
j
})∈*E*_{
D
} may not exist initially in *E*, i.e., the sensor *v*_{
i
} may not be on the transmission range of the sensor *v*_{
j
}. In order to make possible that the sensor *v*_{
i
} tests *v*_{
j
} it is necessary that the transmission range of *v*_{
j
} be tuned. So the sink asks the sensors that are not neighbors of their testing sensors, i.e., that make and edge in *E*_{
D
}, to augment their transmission ranges (i.e., the transmission power) in order to enable the test. The underlying assumption is that the network is dense and large and *t* is relatively small with respect to the network density so that the cases in which a sensor must augment its transmission power is unlikely to happen.

In order to permit that the selection of sensors in each quadrant makes the reduction of *C*_{
T
}(*D*) possible, an initial heuristic is used. At first, the sensors in *T* are selected for each of the quadrants in which they are positioned, since those sensors must participate to the testing procedure. Thus, we define *T*_{
i
} as the set of sensors of *T* geographically positioned in quadrant *i*. The cardinality of *T*_{
i
} is equal to *t*_{
i
}. Thus, we have *T*_{
i
}⊂*Q*_{
i
} and . Considering the energy model presented in this work, the energy cost needed for the execution of a test grows polynomially with the geographic distance between the sensors. Thus, if sensors that are geographically near are selected for *V*_{
D
}, we have a higher probability of generating a testing graph *D* with a value of *C*_{
T
}(*D*) that is reduced.

The initial selection of sensors in *V*_{
D
} is thus based on the distance of the sensors to a common point, *R*_{
c
} in this case. Based on this principle, *Q*_{
i
} is initially formed by the *t*_{
i
} sensors of *T*_{
i
} and the *t*−*t*_{
i
} sensors of the quadrant *i* geographically nearer from *R*_{
c
}. Thus, *V*_{
D
} is formed mainly by sensors near to *R*_{
c
}. Figure 3 shows an example of the definition of the set *V*_{
D
}. Black bullets represent sensors that belong to *V*_{
D
}. It should be observed that the simple strategy of picking up any initial set of *t* sensors does not lead to an optimal solution.

Even though the initial heuristic has the goal of selecting the nearest sensors to the point *R*_{
c
}, it should be observed that a sensor *v*_{
k
}∈*T*_{
i
} may be farther from *R*_{
c
} than a sensor *v*_{
l
}∈(*V*_{
i
}−*Q*_{
i
}). Nevertheless, every sensor *v*∈*T* must participate to the diagnosis procedure, regardless of its distance to the point *R*_{
c
}.

Although the sensors selected by the initial heuristic are the nearest from the center of *R*, farther sensors may be less distant from the majority of sensors present in their predecessor and successor quadrants, and may produce smaller test costs. This case can be seen in Figs. 4 and 5. In the example of the figures, the exchange of a sensor farther from *R*_{
c
} than another, but nearer from the majority of the chosen sensors in the neighbor quadrants may diminish *C*_{
T
}(*D*). In order to evaluate the possible sets of sensors that guarantee a minor value for *C*_{
T
}(*D*) than that obtained by the initial heuristic, an algorithm is executed.

Consider the sensors *v*_{
k
}∈*V*_{
i
} and *v*_{
l
}∈*V*_{
i
}. The sensor *v*_{
k
} is defined as the sensor farthest from *R*_{
c
} that belongs to *Q*_{
i
}, and *v*_{
l
} is defined as the sensor geographically nearest to the sensor *v*_{
k
}, and farther from *R*_{
c
} than *v*_{
k
}, so that *v*_{
l
}∉*Q*_{
i
}. In other words, *v*_{
l
} is the sensor nearest from *R*_{
c
} that was not selected for *Q*_{
i
}. The algorithm consists in verifying if the exchange of any sensor *v*_{
n
}∈*Q*_{
i
} by the sensor *v*_{
l
} produces a reduction in *C*_{
T
}(*D*). The exchange that produces the higher reduction in *C*_{
T
}(*D*) is performed. The process is repeated searching for other possible exchanges and is finished once the exchange of a sensor *v*_{
n
}∈*Q*_{
i
} by any sensor *v*_{
l
}∉*Q*_{
i
} does not generate a reduction in *C*_{
T
}(*D*).

This process is performed in all of the quadrants, one quadrant at a time, i.e., at first the possible exchanges are verified in quadrant 0, until no exchange is performed, then the process is initiated in quadrant 1, and so on. The strategy is finished when there is no exchange in any of the four quadrants.

Although the quadrants may be visited more than once in the searching for possible exchanges, the strategy is finite once at some point every farther sensor will produce a higher cost. It is also clear that this heuristic iterates at most a number of times equal to the number of the sensors in the network.