r
i,j
=
d
i,j
±
d
i,j
100
×
ε
r
(2)
If some WSN algorithms are to be investigated and theirs
performance
compared,
they
should
be
tested
under
the
identical conditions. Hence, it is recommended to use the
identical set of the networks graphs that should have different
topologies
(grid,
random,
Lshape,
Tshape),
scales
(ten
nodes up to thousands nodes) and node degrees (8 up to 26
neighbors per node). For the storing of all prepared networks,
the
struct
function can be used.
%STORE
someName=struct();
someName.network(:,:,1)=network_1;
save(’file.mat’,’someName’);
%LOAD
load file.mat;
network_1=someName.network(:,:,1);
In the previous paragraph we have mention that range of the
node degree should be between 8 and 26. This range was taken
from the work of Bettstetter [2] and Xue and Kumar [14].
They investigated the required
R
radio range and average node
degree
m
(average number of neighbors) to ensure the con
nectivity of network. They stated that network is connected if
for every pair of nodes there exists onehop link or one multi
hop link respective. Results of these works showed that node
degree in WSNs considered for probability of the connectivity
greater than 0 has range of
<
8
,
26
>
(see Fig. 1). Thus,
this node degree range was implemented into the network
models so that for each network size
N
=
50
,
100
,
400
nodes, ten degrees models were implemented, creating the set
of 30 networks with different network size and degrees. This
network database together with the demonstration Matlab files
can be found in [10].
III. R
OUTING IN
A
D
H
OC
N
ETWORK
The data routing in wireless sensor network is realized on
the links comparison base. The considered links between a
sender and a receiver can be compared in terms of the length,
link quality or residual energy of the node pairs. Nevertheless,
the path with the smallest investigated value is selected as the
route for the data delivery. For the discovering of the optimal
0
2
4
6
8
10
12
14
16
18
20
22
24
26
28
30
0
20
40
60
80
100
Average node degree []
→
Probability of connectivity [%]
→
Fig. 1.
Probability of connected network for 802.15.4 radio range (redrawn
from [4]).
Algorithm:
E=createNbrTable
1:
row
=1;
2: for all node pairs
3:
x
=abs(
x
i

x
j
);
4:
y
=abs(
y
i

y
j
);
5:
dist
=sqrt(
x
2
+
y
2
);
6:
if
dist
i,j
<
R
;
7:
plot([
x
i
, x
j
],[
y
i
, y
j
];
%
draw edge
8:
E(
row
,1)=
ID
i
;
9:
E(
row
,2)=
ID
j
;
10:
E(
row
,3)=
dist
i
, j
;
11:
row
+ +
;
⇓
E
matrix
ID
i
ID
j
dist
i,j
1
2
15.65
1
3
9.21
1
8
21.54
2
1
15.65
2
8
11.12
.
.
.
.
.
.
.
.
.
Fig. 2.
Pseudocode of layout visualization and
E
matrix definition.
E
matrix
is illustrated bellow code.
route between two nodes in the
graph
data structure, a Matlab
implementation of Dijkstra’s algorithm can be used. The
Dijkstra’s algorithm is implemented within a
grShortPath
function that is included in
grTheory
Matlab toolbox [8].
[dSP,sp
i,j
]=grShortPath(E,ID
i
,ID
j
);
The
grShortPath
function takes a
E
matrix of neighbors,
source
i
and destination
j
node as an input arguments. It
returns a
dSP
matrix with the shortest path between all
node pairs in the network. Furthermore, it returns an
sp
vectors with the nodes constituting the shortest path between
nodes
i, j
. The
E
matrix must have an exact form for the