MAXCLIQUE Problem Solved Using SQL

This paper aims to show that SQL queries can be used to solve a well-known combinatorial optimization problem, the Maximum Clique Problem (MAXCLIQUE). This problem arises in many real world applications as computer vision and pattern recognition or coding theory to mention some of them. A clique of a graph is a complete subgraph, i.e., a graph where every pair of vertices is an edge. The MAXCLIQUE problem searches for the clique of the largest cardinality in a graph (the one with the greatest number of nodes). We propose a model based on SQL queries to solve this problem. We test our models in 62 random instances. Results show that the use of simple queries can yield solutions for th e MAXCLIQUE problem in an easy and accessible form. KeywordsOptimization; MAXCLIQUE; SQL query. I. I NTRODUCTION Combinatorial optimization is a branch of applied mathematics and computer science that is used to solve problems like circuit design [1], scheduling [2], software testing [3], [4] and many other problems related with real world applications. A lot of problems presented in combinatorial optimization are best understood when they are abstracted i n mathematical structures like graphs. Graph theory is the fie ld of mathematics and computer sciences that studies all the aspects related with graphs. The importance of studying the combinatorial optimization problems is the wide applicati on it has in real world problems. One of the basic problems in graph theory is the MAXIMUM CLIQUE problem (MAXCLIQUE). This problem can be defined as the search of a complete subgraph of maximum cardinality, i.e. it contains the maximum number of vertice s. Applications of this problem arises in coding theory [5], computer vision and pattern recognition [6], fault diagnos is [7] and protein structure similarity [8]. Several methods have been used to solve the MAXCLIQUE problem. In the literature can be found exact and non-exact approaches. A survey about this problem can be found in [9]. Most of the techniques used to solve the MAXCLIQUE problem rely in the use of a high level procedural language like C [10], [11]. In this paper we propose two models to solve this problem using a well known non-procedural data access sublanguage, the Structured Query Language (SQL) [12]. SQL is easy to use and allows the users to express the desired results of a query in a high-level data sublanguage. To the best of our knowledge, there is no reported approach that uses SQL queries to solve MAXCLIQUE instances. Moreover, we found no approach that solves any combinatorial optimization problem using SQL queries. The simplicity of the SQL language and the availability of database manager systems that allow the use of SQL motivate us to design a new approach that, based on SQL queries, could solve instances of the MAXCLIQUE problem. Basically, we present a query model which can be used to determine if a given graph has a clique of size k or smaller. The model was tested in a set of random generated instances. The rest of the paper is organized as follows: section 2 presents the notation and formal definition of the MAXCLIQUE problem. Section 3 describes the optimization model based on SQL that solves this problem. Section 4 shows the experimental design used to test the proposed solution. Section 5 presents the conclusions derived from the results obtained when solving MAXCLIQUE instances through SQL queries. II. M AXIMUM CLIQUE PROBLEM In this section we give a formal definition for the MAXCLIQUE problem. After that, we show the solution of an instance of the MAXCLIQUE problem. Finally, we end the section analyzing the search space of the problem. A. Formal Definition of the Maximum Clique Problem (MAXCLIQUE) A graphG = (V,E) is described by a set V of nodes and a setE of edges (or links between pair of nodes). The number of nodes of the set V represents the order of the graphG (denoted by|G|). A graphG is calledcliquewhen every pair of nodesi, j ∈ V , where i 6= j, is an edge 83 DBKDA 2011 : The Third International Conference on Advances in Databases, Knowledge, and Data Applications Copyright (c) IARIA, 2011 ISBN:978-1-61208-115-1 (i, j) ∈ E. The size of a clique is its order. From now on, a clique will be denoted by K and its size by|K|. The MAXCLIQUE problem can be defined as follows: given a graphG, which subgraphK ⊆ G is the clique with the maximum possible cardinality |K|? The set of subgraphs of G that answers this question is defined by the Equation 1. The subgraph K is any of the subgraphs of G found inK all . K all = {K : K ⊆ G, |K| = max{|K| : K ⊆ G}} (1) B. Example of a MAXCLIQUE instance Following the definition already given, an instance of the MAXCLIQUE problem is a graphG. Figure 1 shows an instance of the MAXCLIQUE problem. This instance has 5 nodes and 5 edges.