Skip to main content
. 2015 Feb 4;15(2):3540–3564. doi: 10.3390/s150203540

Algorithm 3 Exception handling algorithm

Input: all nodes' neighborhood N; error location permutation S'.
Output: node location permutation S.
1. k = the number of S'; n = the actual node number
2. delete the last element of S' in the Ns' (k−1)
3. If Ns' (k−1) is null then
4.  break;
5. else
6. S' (k) = the first element of Ns' (k−1); delete S' (k − 1) in N
7. end if
8. while Ns' (k) is not empty do
9. S'(k + 1) = the first element of Ns' (k−1)
10.  delete S' (k) in N
11. k = k + 1
12. end while
13. k' = the number of the new ordering S'
14. If k' = = n then
15. S (1) = S' (n), use Algorithm 1 to derive the ordering S
16.    If S is the reversion of S' then
17.      S = S'
18.    else
19.      S = null
20.    end if
21. else if nk' = = 1 then
22.  turn to Algorithm 2
23. else
24. S = null
25. end if