a novel algorithm to solve vertex cover problem

International Journal of Advanced Computational Engineering and Networking, ISSN (p): 2320-2106,
Volume – 1, Issue – 1, Mar-2013
A NOVEL ALGORITHM TO SOLVE VERTEX COVER PROBLEM
1
GURLEEN SINGH, 2GEETANJALI SHARMA & 3PRABHDEEP SINGH
P.I.T Kapurthala, India
Email: [email protected], [email protected], [email protected]
Abstract: Vertex cover problem relates to real time application as in any routing algorithm to find a router that controls
whole path which is defined by vertex cover problem only. Vertex Cover contains phases of covering and non-covering
edges. There are various Polynomial time algorithms designed for vertex cover problem but it is bit difficult to find any
perfect polynomial time algorithms. Greedy, Clever Greedy, Genetic and Alom Algorithms are analysed in this paper and
Comparison among these algorithms is also shown and shows that Alom algorithm is performed better then all algorithms
with respect to performance and complexity. There are some problems exists in Alom Algorithm which are to be improved
so a new algorithm is proposedfor vertex cover problem which can work efficiently then Alom algorithm in case of
performance and complexity.
Keywords: Minimum vertex cover, greedy, clever greedy, genetic, branch and bound, alom algorithm.
I. INTRODUCTION
vertices V such that S  V, for each edge (u,v)
 either uS or vS, or both.
Even in normal life if there is plan for a birthday
party then a person is searched who can send
invitation to all guests so there exists a searching
looking for minimum person to contact or in language
graph searching for vertex cover .The vertex cover
problem is a NP complete class problem in terms of
complexity. So the solution should be polynomial
time but as polynomial time depends on input size
and as increase size its complexity increases. Due to
NP class problem this problem mainly attracts
researcher towards it. Other main reason is
it’srelevant to real world applications.
In this papervariousalgorithms of vertex cover
problem with its flow chartand pseudo codes are
discussed. In Paperthere is also comparison between
these Algorithms and results which one is best of all.
For best comparison only one graph is used and
implementing various algorithms on it with finding
its complexity. This paper consists of various
segments, in first segment vertex problem is
elaborated and then explain minimum vertex cover
problem is explained. Section III discuss greedy
algorithm than clever greedy. After this genetic
algorithm is explained .afterexplaining these 3
algorithm branch and bound, alom algorithm is
systematically elaborated.Purpose of this paper is
proposing a new algorithm which is little bit different
from Alom algorithm and gives a better throughput
and complexity is also less for it. VERTEX COVER
PROBLEMAs for representing any route in networks
or for various representation in computer architecture
Graphs are majorly used. But for control purposes it’s
hard to apply concentration on every node, so to
reduce problem vertex cover came into light. In
vertex cover mainly that vertices are include whose
set can control whole paths of graph. In mathematical
language.Consider a undirected graph G= (V, E).
Where V and E represents vertex and edges
respectively. A vertex cover is a subset S of
II. MINIMUM VERTEX COVER
Minimum Vertex cover is a set of vertices having all
its edges traversed with the minimum number of
vertices. It is a subset V’ V, number of vertices in
vertex cover gives its size. Paper mainly concentrates
on problem to find minimum size of vertex cover that
is called an optimal vertex cover. There are two forms
of minimum vertex cover: Decision and
Optimization. In 1st one the verification is done to
analyze the vertex cover of a specified size. In
optimization problem the job is to find the minimum
size vertex cover. For exemplification of minimum
vertex cover speculate the problem of installing
cameras on traffic lights to cover each road on a map
, where lights representing vertex and roads as edges
and job is to install the minimum number of cameras
so every road has at least one camera on its either
end. In this paper the optimization technique is used
as the minimum size vertex cover is analyzed.
III. ALGORITHMS
A. Greedy Algorithm
Greedy algorithm is a procedure of solving the
optimization problems. It proceeds gradually at each
step. It follows the problem solving heuristic of
selecting the locally optimal solution at each stage,
ignoring the globally optimal one. In minimum vertex
cover problem the given objective function is
minimized. Local optimal choice is made in the
desire to find the global optimal solution. Greedy
algorithm never amends its opted choice for the
vertex cover problem. This is the fundamental
anomaly in this technique. This algorithm is
delineating as the imprudent.
Primitively the set of chosen vertex set is vacant.
Then the optimal node for selection is covered, and
virtually all adjacent edges are removed from the
A Novel Algorithm To Solve Vertex Cover Problem
60
International Journal of Advanced Computational Engineering and Networking, ISSN (p): 2320-2106,
graph, duly adjacent vertices are inquired for
selection. The steps are repeated until a minimum
vertex cover is found.
4.
5.
Flow Chart: - I
Steps:1. Initialize vertex cover C=0 and E=0, V= No.
Of vertex.
V={A, B,C, D,E}
2. Calculate degree d(A)=2, d(B)=4, d(C)=3,
d(D)=2,d(E)=3.
3. Select B
6.
7.
8.
Volume – 1, Issue – 1, Mar-2013
C={B}
,
E={BA,BC,BE,BD} ,
V={A,C,D,E}
d(A)=1, d(C)=2, d(D)=1, d(E)=2.
Select C
C={B,C} , E={ BA,BC,BE,BD, CA,CE},
V={A,D,E}.
d(A)=0, d(D)=1, d(E)=1.
Select D
C={B,C,D}, E={ BA,BC,BE,BD, CA,CE ,
DE} , V={A,E}.
As E=No. of Edges so Complete.
Here for perfect order maximum degree vertex is
selected first. Due to this whole vertex are not
traversed only maximum ones are selected causes
short and best vertex selection.
B. Clever Greedy Algorithm
This is also as simple as greedy algorithm to solve
optimization problem but little bit different from it.
Start
Start
Initialize all vertices set as V
and c[10]=) and E[10]=0
Initialize all vertices set as V and
c[10]= ф and E[10]= ф
Find Max d(V)
Find degree of each vertex d(V)
Yes
Two Vertices
have same
degree?
Find MAX d(V)
Select max(V) and enter it into C
No
Select max(V) enters it in C
Delete the edges from V and put it in
E, delete v from V
Select any one vertex
and enters it in C
Delete edges from V and put
it in E, delete v fromV
Search for local optimal MAX degree
No
No
Is E= Total No.
of edges ?
Is E= Total
No. Of
Edges ?
Yes
Yes
Stop
Stop
Example:-
A
Example:A
Figure. I
Flow Chart:B - II
D
Figure. II
C
B
C
E
D
A Novel Algorithm To Solve Vertex Cover Problem
61
E
International Journal of Advanced Computational Engineering and Networking, ISSN (p): 2320-2106,
Steps:1. Initialize vertex cover C=0 and E=0, V= No.
Of vertex.
V={A, B,C, D,E}
2. Calculate degree d(A)=2, d(B)=4, d(C)=3,
d(D)=2,d(E)=3.
3. Select B
C={B}
,
E={BA,BC,BE,BD} ,
V={A,C,D,E}
4. d(A)=1, d(C)=2, d(D)=1, d(E)=2.
5. Select C
C={B,C} , E={ BA,BC,BE,BD, CA,CE},
V={A,D,E}.
6. d(A)=0, d(D)=1, d(E)=1.
7. Select D
C={B,C,D}, E={ BA,BC,BE,BD, CA,CE ,
DE} , V={A,E}.
8. As E=No. Of Edges so Complete.
C. Genetic Algorithm.
Genetic Algorithm mainly emphasis on randomly
generate population of individual. There are three
operators on which it mainly works:
1. Selection: It selects individuals and
generates population from it.
2. Crossover: Various combinations between
selected individual are form with predefine
probability of crossover.
3. Mutation: It forms various combinations by
changing Chromosomes.
Volume – 1, Issue – 1, Mar-2013
Flow Chart: - III
Star
Initialize all vertices
set as V and c[10]=)
and E[10]=0 and
select any two
Draw table (VT) and
find d(V) for all v is in
V and frequency of v
Construct Edge table
(ET) and Show
connection of every
Find vertex from VT
have max N(V) and
find if N(v1)<N(v2)
Are
Two
Vertice
s have
Similarly in this Algorithm two sets are selected
before (selection) and then various combinations are
applied on it (crossover). Various conditions form
new population/sets (mutation) called vertex cover
set.
Y
N
N
o
Is
N(v1)<
N(v2)?
Yes
Select N(v) as a vertex
Select
N(v1) as
Delete edges
connected to
vertex v and
N
Are all
edges
are
Ye
s
Stop
A Novel Algorithm To Solve Vertex Cover Problem
62
Select any
one vertex
and enters it
International Journal of Advanced Computational Engineering and Networking, ISSN (p): 2320-2106,
Figure. III
While backtracking all the covered nodes are
reinserted in the graph. Subsets of the nodes which
gave legitimate vertex covers are determined and the
least one in size is minimum vertex cover. In the
worst case, the complexity of branch & bound is
upper bounded by the total nodes in graph. i.e. 2n .
Branch and bound marks the vertices either covered
or uncovered at each step. It backtracks if optimal
solution is not found. The algorithm ceases when a
authentic vertex cover is found or all possible
solutions
have
passed.
A
Example:-
C
B
D
Volume – 1, Issue – 1, Mar-2013
E
Steps:1. Generate
solution
set
randomly
P1={A,B,C,D} , P2={A,C,E,D}.
2. Vertex Table
F (v) = Frequency (v) = Number of times
vertex appeared in P1 or P2.
N (v) =degree (v)
Flow Chart:-IV
Start
Initialize all vertices set as V and
c[10]=0 and E[10]=0
TABLE I
Vertex Table
Vertex
F(v)
N(v)
A
2
2
B
1
4
C
2
3
D
2
2
E
1
3
3. TABLE IIEdge Table
Vertex
A
B
C
B
A
C
D
E
C
A
B
E
D
B
E
E
B
C
D
Select vertex from group of vertices yet
not be selected
delete all adjacent edges and put it in E
Backtrack
Is E= Total
No. Of Edges
?
Yes
4. TABLE III HVX
VERTEX F(v) N(v) Run
1
{B}
A
2
3
1
B
1
4
0
C
2
3
2
D
2
2
1
E
1
3
2
Run
2
{B,C}
0
0
0
1
1
Run 3
{B,C,E}
No
All vertices
selected as first
vertex ?
0
0
0
0
0
yes
From all set of solutions select
minimum solution
Move or run until value becomes 0. As in run 3 all
value become 0 so need to move further and result is
Vertex cover={B,C,E}
D. Branch and Bound Algorithm
Branch and bound algorithm is a type of complete
algorithm, which gives the certainty to find the best
solution or the optimal solution of various
optimization problems. It follows the recursive
procedure to explore the whole configuration space
about the presence or the absence of a node. For the
presence and absence of a node, there are two
possibilities, one is to select the node for vertex cover
and the other is to reject the concerned node.
Virtually a node that is covered and all its adjacent
edges are removed from the graph. Recursion process
explores the graph and it backtracks if no edge is left
to be removed or the bounding condition is reached.
Stop
A
Example:
Figure: IV
C
B
D
A Novel Algorithm To Solve Vertex Cover Problem
63
E
International Journal of Advanced Computational Engineering and Networking, ISSN (p): 2320-2106,
Steps:1. Initialize vertex cover = 0 and edge
set={AB,BC,BE,BD,BE,DE}.
2. Select any vertex say A
Figure: V
Volume – 1, Issue – 1, Mar-2013
greedy is select max degree node having one distinct
node.
Flow Chart:- V
Start
A
Initialize all vertices set as
V and c[10]=) and
C
B
E
D
Calculate degree of
every vertex of graph
Edge set={AB,AC}
A
Select B
Figure: VI
C
B
Two
Vertices
have
N
From it is
one
vertexhav
ea
N
Select
ye
E
D
Edge set={AB,AC,BD,BE,BC}
3.
select E
A
Select any
ye
Figure: VII
C
B
Select node
Delete edges out
D
E
Edge set={ AB,AC,BD,BE,BC ,ED,EC}
4.
5.
1st
vertex
A
B
C
D
E
Is No
edge is
remainin
N
All edges are completed so vertex
cover={A,B,E}.
Similarly go through all solutions, selected
first vertex as B,C,D,E respectively.
And various solutions can be found
TABLE IVVertex Cover Table
2nd
3rd
4th
vertex
vertex
vertex
B
E
E
C
E
D
B
E
B
A
B
C
y
Stop
Example:-
Vertex
Cover
A,B,E
B,E,C
C,E,D,B
D,E,B,A
E,B,C
A
Figure: VIII
C
B
D
Branch and Bound algorithm back tracks if the total
number of edges is not traversed. VC selecting 4
vertices in Vertex cover is minimal solution and of 3
vertices is minimum solution.
E. Alom Algorithm
Alom Algorithm is better than greedy and genetic
Algorithm because it gives best solution. It takes
more time but provides better and efficient vertex
cover result then before ones. This Algorithm selects
maximum degree vertex first but condition extra then
E
Steps:1. Initialize vertex cover = 0 and edge
set={AB,BC,BE,BD,BE,DE}.
2. Calculate degree
d(A)=2,d(B)=4,d(C)=3,d(D)=2,d(E)=3.
3. Select B
A Novel Algorithm To Solve Vertex Cover Problem
64
International Journal of Advanced Computational Engineering and Networking, ISSN (p): 2320-2106,
A
Figure:- IX
Figure:-X
6.
7.
C
B
Edge set={ED}
d(E)=1, d(D)=1
select E
E
D
4.
5.
Select C
Edge set=0
C
All edges are
cover={B,C,E}.
E
D
V. OUR PROPOSED ALGORITHM
= 10
0
[ ][ ] ← ∗
← +1
0
[ ][ ] == ℎ
[ ][ ] ← 0
[ ][ ] ← 0
ℎ
()
← 0,
←0
0
←0
0
[ ][ ] ==
←
←
+1
+1
[]←
== 0 ℎ
max ←
[0]
[] ℎ
<
←
[]
0
==
[] ℎ
_
[ + +] ← 1
0
←0
0
[
_
< max ℎ
==
ℎ
= 0.
[ + +] ←
_
0
[
_
[
[ ][
5.
6.
E
D
8.
4.
C
Figure:-XI
A
B
3.
A
B
Edge set={AC,CE,ED}
(A)=1, d(C)=2, d(E)=2, d(D)=2
Algorithm 1: Vertex_cover(int,int *)
Input : int v and int *q
Output: finds vertex cover
1.
← 0, ← 0, ← 0,
2.
0
Volume – 1, Issue – 1, Mar-2013
[ ]][ ] ==
0
==
_
[ ] ℎ
← +1
.
[]
_
_
[ ]][ ] ==
[ ]][ ] ← 0
[ ]] ← 0
[ + +] ← .
Algorithm 2 : Main
Input : Adjacency matrix
Output: Finds minimal vertex cover for given graph
1.
[
][
]
2.
[0][0]
∗ =&
3.
0
_
(, )
A Novel Algorithm To Solve Vertex Cover Problem
65
completed
so
vertex
International Journal of Advanced Computational Engineering and Networking, ISSN (p): 2320-2106,
[4]
CONCLUSION
This paper discussed greedy, branch and bound,
clever greedy, genetic and alom algorithm of
minimum vertex cover problem and working of these
algorithm are also explained. As Branch and Bound
and Alom Algorithm gives optimal solution but its
complexity is high and Clever Greedy is not fit when
nodes are not interconnected with ever other, this new
Algorithm removes all above problems and gives an
optimal solution with less complexity and best, in all
types of graph possible .
REFERENCES
[1]
[2]
[3]
Volume – 1, Issue – 1, Mar-2013
R. Arakaki, and L. Lorena, “A Constructive Genetic
Algorithm for the Maximal Covering Location Problem”, in
Proceedings of Metaheuristics International Conference,
2001, pp 13-17.
[5] S. Kirkpatrick, C. D. Gelatt, and M. P. Vecchi,” Optimization
by simulated annealing. Science”, 1983.
[6] K.Hartmann and M.Weigt, “Phase Transitions in
Combinatorial Optimization Problems”. Wiley-VCH,
Weinheim, 2005.
[7] K. Sastry. “Evaluation-relaxation schemes for genetic and
evolutionary algorithms”. Master’s thesis, University of
Illinois at Urbana-Champaign, Department of General
Engineering, Urbana, IL, 2001. Also IlliGAL Report No.
200,2004.
[8] M.Chleb and J.Chleb, “Crown reductions for the Minimum
Weighted Vertex Cover problem” Electronic Colloquium on
Computational Complexity, Report No. 101 (2004).
[9] R.Yehuda and S.Even, “A Linear time approximation
algorithm for the wighted vertex cover problem”,
J.Algorithms- 2 , 198-203,1981
[10] R.Hassin and A.Levin, “The minimum generalized vertex
cover problem”, Proc. ESA2003,289-303, 2003
[11] R.Yehuda and S. Even. “A local-ratio theorem for
approximating the weighted vertex cover proble”. Annals of
Discrete Mathematics, 25:27–45, 1985.
[12] M.Mezard, G.Parisi, and R.Zecchina. “Analytic and
algorithmic solution of random satisfiability problems”.
Science, 297:812, 2002.
K.Kumar, N.Maaroju and D.Garg, “ Complete Algorithms
on Minimum Vertex Cover”, CIIT International Journal of
Artificial Intelligent Systems and Machine Learning, 2009.
T. H. Cormen, C. E. Leiserson, R. L. Rivest, and C.
Stein, “Introduction to Algorithms. McGraw-Hill”,2001.
R.Hassin and A.Levin, “The minimum generalized vertex
cover problem”, ACM Transactions on Algorithms, Volume
2, 2006.

A Novel Algorithm To Solve Vertex Cover Problem
66