IntechOpen Book PDF
IntechOpen Book PDF
Chapter 1
Abstract
Wireless sensor network is a collection of autonomous devices called sensor nodes which
sense the environmental factors such as temperature, pressure, humidity, moisture etc. The
nodes sense the data, process it and transmit to the other nodes within their transmission
range through radio propagation. Energy minimization in wireless sensor networks is a
significant problem since the nodes are powered by a small battery of limited capacity. In
case of networks with several thousand nodes, the simulation of algorithms can be very
slow. The parallel computing model provides significantly faster simulation time for larger
networks. Parallel processing involves executing the program instructions by dividing them
among multiple processors with the objective of reducing the running time. So, we propose
algorithms for the range assignment problem in wireless sensor networks using the parallel
processing techniques. We also discuss the complexity of the proposed algorithms and
significance of the parallel processing techniques in detail. The proposed techniques will
be useful for implementing the distributed algorithms in WSNs.
1. Introduction
i i
i i
i i
u r r
bb
b
b
b
b
b b
b
b
b
b
b
b
b
b
b
b
b
b u u
r r
(a) One dimension (a) Two dimension (a) Three dimension
Figure 1.
Radio coverage in different dimensional networks
dist (u, v) is the Euclidean distance between u and v and α is the distance range gradient
or path loss coefficient which depends on various environmental factors and generally lies
between 2 and 6 [6]. In this chapter, the terms range and power are used interchangeably.
In reality, some problems use mathematical models which describe the problem in a
systematic way and enables us to solve the problem efficiently. Graphs can be used to model
many relations and represent many physical problems in the real world. A WSN is modeled
as an undirected graph to solve the energy minimization problems. In this model, a vertex
of the undirected graph represents a node and the edge joining two vertices represents the
communication link between the nodes. The nodes are deployed on a Euclidean plane and
each pair of two nodes is associated to the Euclidean distance between the nodes. Each
node is located by its x and y coordinates and the distance function is used to find the
Euclidean distance between any two nodes x and y, and is denoted by w xy which is given
q 2
by w xy = (x1 − x2 ) 2 + y1 − y2 .
Figure 2, illustrates the graph theoretic modeling of a WSN with four sensor nodes
v1 , v2 , v3 , and v4 . In this Figure, 2.(a) shows a network of four nodes with their respective
transmission ranges and its asymmetric and symmetric versions are shown in 2.(b) and
2.(c), respectively [7]. There is an edge between two vertices in symmetric graph if and
only if it is bidirectional. A network is said to be bidirectional if and only if each edge
is bidirectional and there exists a bidirectional path between every pair of two nodes of
the network. Since the signal transmitted by a sensor node must be acknowledged by the
receiver node, the bidirectional links are given preference.
i i
i i
i i
Introduction
v1 v2 v2 v1 v2
v1
v4 v3
v4 v3 v4 v3
(a) The nodes and their (b) Asymmetric topology (c) Symmetric topology
transmission range
Figure 2.
Illustration of graph theoretic modeling
The total range of the graph which is the sum of the ranges of all the vertices of G is given
by R (G) = Σi=1n R (v ). Figure 3 is presented to illustrate the range assignment of a WSN. In
i
this Figure, 3.(a) shows a spanning tree of eleven vertices along with weights assigned to
the edges and 3.(b) shows the range values assigned to the vertices as the maximum of all
its adjacent edge weights in the spanning tree, as given in Eq. 1.
Minimum range assignment problem in a WSN is to assign transmission range to the
nodes of the network such that the resultant subgraph H satisfies the specified constraints
and the total range of the network, i.e., R (H) is minimized [8]. Let H be a spanning subgraph
of the given graph G = (V, E, w), RH (v) be the range assigned to vertex v ∈ V (H) as given
in Eq. 1 and R (H) be total range of the subgraph H. For various problems considered in
this chapter, our interest is to find a spanning tree with minimum range.
v5 Vertex Range
v1
v4
4 v1 2
2 5 v2 3
v6 v3 4
8 6 v4 8
v2 v7 v10 v5 5
v6 6
2 v7 6
3 v8 5
v9
5 v9 3
v11
v3 3 v10 2
4 v8 v11 8
(a) Reduced Topology of eleven vertices (b) Range assignment
Figure 3.
Illustration of range assignment
i i
i i
i i
Chen et al. [9] studied the problem of strong connectivity in multi hop packet radio
networks and proposed a 2-approximation algorithm which initially considers an undirected
Minimum Spanning Tree (MST) and later establishes the bidirectional connectivity. Strong
Minimum Energy Topology problem (SMET) in a WSN is studied by Cheng et al. [10], in
which the objective is to assign transmission range to the nodes of the network such that
the total range of the network is minimized and the reduced topology is connected. The
authors have proved that the SMET problem is NP-complete and proposed two algorithms
namely: Minimum Spanning Tree (MST) based Heuristic which is of 2-approximation ratio
and an Incremental Power Greedy Heuristic and performed the simulation to show that the
Incremental Power Greedy Heuristic performs better than the MST Heuristic. Formulation
of the SMET problem is as follows:
Large scale WSNs such as environmental monitoring systems produce large amount of
data in the order of Peta bytes. The challenges in this case are storage and computation as
the sensors are constrained by their resources which are scarcely available [11]. If the large
amount of data is processed centrally, all data needs to be transmitted to a central server
using multi hop transmissions which leads to high computational cost. One of the best ways
to avoid such problem is to exploit the advantages of the distributed storage and parallel
processing. Instead of transmitting data to a central server, data is stored and processed
in network which reduces the computational cost. In this process, the computational task
is decomposed into many small tasks, and the computation is executed in parallel by the
distributed sensors.
Sullivan et al. [12] proposed a set of new parallel algorithms for a tree decomposition-
based approach to solve the maximum weighted independent set problem. Independent set
problem for a given graph is to find a subset of vertices with maximum cardinality such that
no two vertices in the graph are adjacent to each other. Maximum Weighted independent
set problem in which, the vertices are assigned weights, is to find an independent set with
maximum weight [13]. Zhu et al. [14] proposed parallel algorithm for the hierarchical-based
protocol for WSNs based on the Low-Energy Adaptive Clustering Hierarchy (LEACH)
algorithm in order to improve the routing efficiency of the networks. Authors have
implemented the algorithms using the parallel processing technique and showed that this
technique has increased the overall performance. Lounis et al. [15] presented a new model for
parallel computing of energy consumption in WSNs, and implemented on GPU architecture.
Through simulation, authors showed that the proposed model provides simulation times
significantly faster than that of the sequential model for large networks and for long
simulations.
Androni et al. [16] gave algorithms for geometric graph problems in the modern
parallel models. The authors found a (1 + ) approximation algorithm for a Geometric
Minimum Spanning tree (MST) problem. In geometric MST, set of n points are plotted on
a low dimension space such as Rd and other bounded metric spaces, in which weights
of the edges are the distances between their endpoints. Authors also gave a general
algorithmic framework that also applies to Earth-Mover Distance and the transportation
cost problem. Katsigiannis et al. [17] presented a Helper Threading scheme for parallelizing
the Kruskal’s algorithm [18] which is used for finding a Minimum Spanning Forest (MSF).
The implementation employs one main thread, which executes the serial algorithm, and
several helper threads, that run in parallel and reduce the work of the main thread.
i i
i i
i i
Related work
In this chapter, we discuss the parallel processing techniques for the range assignment
problem for simple connectivity. We propose algorithms for this problem using parallel
processing techniques and determine the complexity. The proposed algorithms initially
find an MST and assign range to each vertex of the network based on its range in the
Euclidean MST. We find the Euclidean MST using well known algorithms: Prim’s and
Kruskal’s and later we assign the range using parallel processing technique for both the
cases. We also discuss the complexity of the proposed algorithms in detail for both the
algorithms.
Simulation is an act of imitating operation of real world process or system over time [19].
The simulation is performed on a model which represents the system. It is known that
simulations closely reflects accurate behavior of the system. Simulations help in evaluating
the algorithm before investing on the physical hardware.
2. Related work
Finding a Euclidean MST is an important problem in Graph Theory and there are
several algorithms in the literature [20]. MST problems have significant applications in
computer and communication network design, as well as indirect applications in fields such
as computer vision and cluster analysis [21]. Parallelization of Prim’s algorithm is studied
by Deo and Yoo [22] and the proposed algorithms used shared memory computers. Gonina
et al. [23] studied the parallel implementation of the Prims’s algorithm for finding the MST
of dense graphs. Authors presented the simulation results which demonstrate the advantage
of proposed algorithms.
Vladimir et al. [24] studied serial variants of Prim’s and Kruskal’s algorithm and
presented their parallelization, targeting message passing parallel machine with distributed
memory. Authors have considered large graphs and presented experimental results which
show that Prim’s algorithm is a good choice for dense graphs while Kruskal’s algorithm
is better for sparse graphs. Authors have proposed algorithms based on the sequential
algorithms of Prim and Kruskal, targeting message passing parallel machine with distributed
memory.
2 The proposed algorithm which uses the Prim’s algorithm has a running time of
O k + O n log k and the one which uses the Kruskal’s algorithm has a running time of
n
2
O nk + O n2 log k where n is the number of vertices and k is the number of partitioned
subsets of V such that each subset has nk consecutive vertices and their edges. In this section,
we discuss the parallel processing algorithms for computing Euclidean MST using both
Prim’s and Kruskal’s algorithms separately. In both the algorithms, each processor gets a
subset of vertices from the given set of vertices to process.
The considered input for the parallelization of both Prim’s and Kruskal’s algorithm by
Vladimir et al. [24] is an undirected simple graph with weights assigned to the edges. For
our research the input considered is a complete graph along with edge weights, where the
edge weights are the Euclidean distance between the nodes.
Prim’s algorithm starts from an arbitrary vertex and then grows the subtree by choosing
a new vertex from the set of unvisited vertices and adding it to the subtree in each iteration.
The Prim’s algorithm runs until the number of edges becomes n − 1 orall the vertices
are added to the subtree. The complexity of the Prim’s algorithm is O n2 where n is the
number of verties of the given graph. In this algorithm, the input considered is an undirected
graph with n vertices and m edges along with the edge weights in which weight of edge uv
is denoted by w (uv).
i i
i i
i i
The weights are represented using the adjacency matrix which is defined as follows:
(
if vi vj ∈ E
w vi vj
aij = (2)
0 otherwise.
Prim’s algorithm is implemented using the auxiliary array d of length n which stores
the weights from each vertex to the MST. The lightest weight edge is chosen from d and
is added to MST in each iteration and the array d is updated accordingly. The main loop
of the Prim’s algorithm can not be parallelized since the minimum edge weights incident
to MST change in each iteration. So, only two steps are parallelized: finding a minimum
weight edge that connects a new vertex not in MST to avertex in MST and updating the
2
array d. The complexity of the proposed algorithm is O nk + O n log k where n is the
Kruskal’s algorithm finds a minimum weighted edge which connects two components
in the forest in each iteration i.e., it grows multiple trees in parallel. Initially, Kruskal’s
algorithm creates a forest considering each vertex as a tree and next it sorts all the edges.
Each time a minimum weighted edge is chosen and added to the forest if it connects
two different trees else it is discarded. This process is repeated until the forest becomes
a spanning tree. The complexity of the proposed algorithm is O (m log n) where m is the
number of edges and n is the number of vertices.
Similar to the Prim’s algorithm, we have adjacency matrix which stores the weights
between the vertices, and each processor is assigned a subset of vertices. In parallelization
of Kruskal’s algorithm, each processor sorts the edges of its vertices according to their
weights. At each process, a local MST is found using Kruskal’s algorithm and finally, all the
n2
local MST’s are merged. The complexity of the proposed algorithm is O k +O n2 log k
where n is the number of vertices and k is the number of processors.
In this section, we present the proposed algorithms for range assignment problem
using parallel processing techniques. The proposed algorithms adopt the algorithms for
parallelization of both Prim’s and Krushkal’s algorithms by Loncar et al. [24]. In this
environment, the nodes are deployed on a Euclidean plane and each pair is associated with
the Euclidean distances between those nodes. Since a WSN is modeled as an undirected
graph along with a weight function, the input for these algorithms is a complete graph
G = (V, E, w) where the weight function is as explained in section 1. The range assigned to
a vertex v is denoted by R (v).
Objective of this problem is to find a spanning tree such that the total range of the
spanning tree is minimized. In the proposed algorithms, we initially find the spanning tree
of the given complete graph and assign the range to the vertices based on their range in the
Euclidean MST using parallel processing. We propose two algorithms: one using the Prim’s
algorithm and the other using the Kruskal’s algorithm. We also compute the complexity of
the proposed algorithm in both the cases. The list of notations used in this chapter are given
in Table 1.
i i
i i
i i
Table 1.
List of notations
Notation Explanation
V Set of vertices
E Set of edges
n Number of nodes
w (uv) Euclidean distance between u and v
R (v) Range of vertex v
d Auxiliary array
P The set of processors
pi ith processor
k Number of processors
T Resultant spanning tree
Let G = (V, E, w) be the given complete graph. In this algorithm initially, we find a
spanning tree by parallelizing the Prim’s algorithm and range is assigned to the vertices
based on their range in the MST by using parallel processing. The formulation of the
problem is as follows:
Problem: Parallel Algorithm for Range assignment using Prim’s algorithm (PARA-Prim’s)
Input: A complete graph G = (V, E, w), where w is a weight function and P the set of
processors
Objective: To find a spanning tree such that the total energy is minimized, using parallel
processing
In the proposed algorithm, we consider a complete graph and the number of processors
as input and compute a spanning tree which minimizes the total range. In this algorithm, we
partition the vertcies into k groups and each processor gets nk consecutive vertices and their
edges. Each processor also contains auxiliary array d of the vertices which maintains the
distances of the vertices to the MST. Let Vi and di be the set of vertices and the auxiliary
array of the processor pi , respectively.
Each process finds a minimum weighted edge which connects the MST with vertices of
the set Vi and sends to the leader processor using all-to-one reduction. The leader processor
selects one with the minimum weight among all the received edges, adds it to MST and
broadcasts to all the processors. Processors mark the vertices connected to MST and update
their auxiliary array d and this process is repeated until all the vertices are added to the
subtree.
Next, we assign range to the vertices in the following way: for a vertex, each process
finds the farthest vertex to it in the MST and sends the distance between them to the leader
processor using all-to-one reduction. Later, leader processor selects one with maximum
edge weight among all the received edge weights and that weight is assigned as range to the
vertex v. This process of range assignment is repeated for all the vertices. The sequence of
steps is presented in Algorithm 1.
2
Theorem 1.1 [24] The parallelization of Prim’s algorithm takes O nk + O n log k
running time where n is the number of nodes and k is the number of processors.
i i
i i
i i
Algorithm 1: PARA-Prim’s
1 begin
2 Let |P| = k, |V| = n, T = φ, j = 1, Visited [i] = 0 for i = 1 to n
3 for i = 1 to k do
4 pi = {vj , vj+1 , . . . , vj+ n }
k
5 j = nk + 1
6 end
7 while |V (T) | < n − 1 do
8 for i = 1 to k do
9 for j = 1 to nk do
10 min = ∞
11 for k = 1 to nk do
12 if pi [j] , pi [k] && visited [pi [j]] , 0 && w pi [j] pi [k] < min
then
13 e [i] = pi [j] pi [k]
14 end
15 end
16 end
17 end
18 for i = 1 to kdo
19 if w e [i] < w (emin ) then
20 emin = uv = ei
21 end
22 end
23 if Visited [u] = 0 || Visited [v] = 0 then
24 T = T ∪ {emin }
25 Visited [v] = 1
26 update the corresponding d [v]
27 end
28 for i = 1 to n do
29 for j = 1 to k do
30 max [i] = 0
31 for k = 1 to nk do
32 if vi , pj [k] && vi pj [k]∈ T && w vi pj [k] > max then
33 max [i] = w vi pj [k]
34 end
35 end
36 end
37 max = max [1]
38 for i = 1 to k do
39 if max [i] > max then
40 max = max [i]
41 end
42 end
43 R [vi ] = max
44 end
45 end
46 return T, R
47 end
i i
i i
i i
2
Theorem 1.2 The algorithm PARA-Prim’s takes O nk + O n log k running time,
Problem: Parallel Algorithm for Range assignment using Kruskal’s algorithm (PARA-
Kruskal’s)
Input: A complete graph G = (V, E, w), where w is a weight function and P the set of
processors
Objective: To find a spanning tree such that the total energy is minimized, using parallel
processing
The sequence of steps for the above explained procedure is presented in Algorithm 2
named PARA-Kruskal’s.
2
Theorem 1.3 [24] The parallelization of Kruskal’s algorithm takes O nk +O n2 log k
Proof: From Theorem 1.3, 2itis clear that, the running time of the parallelization of
Kruskal’s algorithm is O nk + O n2 log k . Next, we do the range assignment to the
vertices based on its range in the MST formed by parallelizing the Kruskal’s algorithm.
From Theorem 21.3,
it is clear that the running time of the range assignment forall2 the
vertices is O k . So, the running time of the PARA-Kruskal’s algorithm is O nk +
n
O n2 log k .
i i
i i
i i
Algorithm 2: PARA-Kruskal’s
1 begin
2 Let |P| = k, |V| = n
3 Follow the steps from 3 to 5 of Algorithm 1
4 for i = 1 to k do
5 Ti = Φ
6 Let Ei be the set of all edges of the vertices of pi
7 Sort the edges of Ei according to their edge weights
8 while |V (Ti ) < nk − 1 do
9 for j = 1 to nk do
10 min = ∞
11 for k = 1 to nk do
12 if w pi [j] pi [k] < minthen
13 min = w pi [j] pi [k]
14 a = pi [j]
15 b = pi [k]
16 end
17 end
18 end
19 if Ti ∪ {ab} is acyclic then
20 Ti = Ti ∪ {ab}
21 end
22 end
23 end
24 for i = 1 to k − 1 do
25 Let A be the set of all edges of Ti
26 Let B be the set of all edges of Ti+1
27 pi sends A to pi+1
28 pi+1 finds T as a new local MST from A ∪ B
29 end
30 Repeat the steps from 28 to 44 of Algorithm 1
31 return T, R
32 end
respectively. For WSNs with large number of sensor nodes, this complexity is quite
high which can be improved by using parallel processing techniques. Simulation
can be performed on hardware that supports multiple cores in order to realize the
improvements over serial programming environments. The complexities of the range
assignment problem using Prim’s
2 algorithm and Kruskal’s
2 algorithm by employing parallel
processing techniques are O k + O n log k and O k + O n log k , respectively. So,
n n 2
10
i i
i i
i i
Conclusions
5. Conclusions
In this research, we have studied the range assignment problem by employing parallel
processing techniques of both Prim’s and Kruskal’s algorithms. The complexity of the
proposed two algorithms is discussed in detail and it is shown that complexity can be
improved by using parallel processing techniques for larger networks. It is an interesting
problem to study variations of range assignment problems using parallel processing
techniques. The implementation of the proposed algorithms can be realized using CUDA
programming which supports programming GPU with multiple cores.
Abbreviations
11
i i
i i
i i
Author details
[email protected]
address† These authors contributed equally
IntechOpen
© 2019 The Author(s). License IntechOpen. This chapter is distributed under the terms of
the Creative Commons Attribution License (http://creativecommons. org/licenses/by/3.0),
which permits unrestricted use, distribution, and reproduction in any medium, provided the
original work is properly cited.
12
i i
i i
i i
Conclusions
References
[3] Lloyd, E. L., Liu, R., Marathe, M. V., [12] Sullivan, B. D., Weerapurage, D., &
Ramanathan, R., & Ravi, S. S. (2005). GroÃńr, C. (2013, May). Parallel
Algorithmic aspects of topology control algorithms for graph optimization using
problems for ad hoc networks. Mobile tree decompositions. In 2013 IEEE
Networks and applications, 10(1-2), 19-34. International Symposium on Parallel &
Distributed Processing, Workshops and
[4] West, D. B. (1996). Introduction to Phd Forum (pp. 1838-1847). IEEE.
graph theory (Vol. 2). Upper Saddle River,
NJ: Prentice hall. [13] Minty, G. J. (1980). On maximal
independent sets of vertices in claw-free
[5] Santi, P. (2005). Topology control in graphs. Journal of Combinatorial Theory,
wireless ad hoc and sensor networks. ACM Series B, 28(3), 284-304.
computing surveys (CSUR), 37(2),
164-194. [14] Zhu, Y., Yao, Q., George, G., Wu, S.,
& Zhang, C. (2012). Parallel LEACH
[6] Carmi, P., & Chaitman-Yerushalmi, L. Algorithm for Wireless Sensor Networks.
(2015, December). On the minimum cost In Proceedings of the International
range assignment problem. In International Conference on Parallel and Distributed
Symposium on Algorithms and Processing Techniques and Applications
Computation (pp. 95-105). Springer, (PDPTA) (p. 1). The Steering Committee
Berlin, Heidelberg. of The World Congress in Computer
Science, Computer Engineering and
[7] Calinescu, G., & Wan, P. J. (2003, Applied Computing (WorldComp).
October). Range assignment for high
connectivity in wireless ad hoc networks. [15] Lounis, M., Bounceur, A., Laga, A., &
In International Conference on Ad-Hoc Pottier, B. (2015, June). GPU-based
Networks and Wireless (pp. 235-246). parallel computing of energy consumption
Springer, Berlin, Heidelberg. in wireless sensor networks. In 2015
European conference on networks and
[8] Fuchs, B. (2008). On the hardness of communications (EuCNC) (pp. 290-295).
range assignment problems. Networks: An IEEE.
International Journal, 52(4), 183-195.
[16] Andoni, A., Nikolov, A., Onak, K., &
[9] Chen, W. T., & Huang, N. F. (1989). The Yaroslavtsev, G. (2014, May). Parallel
strongly connecting problem on multihop algorithms for geometric graph problems.
packet radio networks. IEEE Transactions In Proceedings of the forty-sixth annual
on Communications, 37(3), 293-295. ACM symposium on Theory of computing
(pp. 574-583). ACM.
[10] Cheng, X., Narahari, B., Simha, R.,
Cheng, M. X., & Liu, D. (2003). Strong [17] Katsigiannis, A., Anastopoulos, N.,
minimum energy topology in wireless Nikas, K., & Koziris, N. (2012, May). An
13
i i
i i
i i
approach to parallelize Kruskal’s algorithm [21] Graham, R. L., & Hell, P. (1985). On
using helper threads. In 2012 IEEE 26th the history of the minimum spanning tree
International Parallel and Distributed problem. Annals of the History of
Processing Symposium Workshops & PhD Computing, 7(1), 43-57.
Forum (pp. 1601-1610). IEEE.
[22] Deo, N., & Yoo, Y. B. (1981). Parallel
[18] Cormen, T. H., Leiserson, C. E., Algorithms for the Minimun Spanning Tree
Rivest, R. L., & Stein, C. (2009). Problem. Computer Science Department,
Introduction to algorithms. MIT press. Washington State University.
[19] Sobeih, A., Hou, J. C., Kung, L. C., Li, [23] Gonina, E., & KalÃľ, L. V. (2007).
N., Zhang, H., Chen, W. P., ... & Lim, H. Parallel PrimâĂŹs algorithm on dense
(2006). J-Sim: a simulation and emulation graphs with a novel extension. 2007.
environment for wireless sensor networks.
IEEE Wireless Communications, 13(4), [24] LonÄŊar, V., & Åăkrbic, S. (2012,
104-119. November). Parallel implementation of
minimum spanning tree algorithms using
[20] Rosen, K. H. (2017). Handbook of MPI. In 2012 IEEE 13th International
discrete and combinatorial mathematics. Symposium on Computational Intelligence
Chapman and Hall/CRC. and Informatics (CINTI) (pp. 35-38). IEEE.
14
i i
i i