This site uses cookies only for the purpose of identifying user sessions.
This is required to properly register actions.
CLIQUE $\leq$ HALFCLIQUE
Reduce the
CLIQUE problem to the
HALFCLIQUE problem.
These problems are defined as follows:
 CLIQUE: given a natural $k$ and an undirected graph $G$, is there a
subset $S$ of nodes with size at least $k$ such that any two distinct nodes of
$S$ are connected by an edge in $G$?
More formally, this problem can be defined as the following set:
$\{ \langle k,G=\langle V,E\rangle\rangle \mid \exists S\subseteq V: (S\geq k\;\wedge\;\forall u,v\in S: (u\neq v\;\Rightarrow\;\{u,v\}\in E)) \}$
 HALFCLIQUE: given an undirected graph $G$, is there a subset $S$ of nodes
with at least half of the nodes such that any two distinct nodes of $S$ are connected
by an edge in $G$?
More formally, this problem can be defined as the following set:
$\{ G=\langle V,E\rangle \mid \exists S\subseteq V: (S\geqV/2\;\wedge\;\forall u,v\in S: (u\neq v\;\Rightarrow\;\{u,v\}\in E)) \}$
The input and output of the reduction conform to the following data types:

in: struct {
k: int
numnodes: int
edges: array of array [2] of int
adjacents: array of array of int
adjacencymatrix: array of array of int
}
The input is a natural number in.k and an undirected graph. The graph is
given by means of four different kinds of information: the number of nodes
in.numnodes, the list of edges in.edges, for each node the list
of its adjacent nodes in.adjacents, and the adjacency matrix
in.adjacencymatrix. The nodes are integers between $1$ and
in.numnodes, and thus, the $0$’th position of in.adjacents does
not contain useful data and should be ignored; for any other position $p$,
in.adjacents[p] is the list of nodes adjacent to $p$. For the same
reason, the $0$’th row and column of in.adjacencymatrix do not contain
useful data and should be ignored; for any other row $r$ and column $c$,
in.adjacencymatrix[r][c] is $0$ when there is no edge between the nodes
$r$ and $c$, and $1$ otherwise.
Note: The input graph has at least $2$ nodes, no repeated edges, nor selfloop edges,
and the value of in.k is at least $2$ and at most the number of nodes of
the graph.

out: struct {
edges: array of array [2] of string
nodes: array of string
}
The output is an undirected graph, which is
described with the list of edges out.edges and with the list of nodes
out.nodes. An edge is a pair of nodes, and each node is represented by
either an integer or a string. The list of nodes out.nodes is optional,
and contains nodes of the graph, that may or may not appear in the list of
edges. This list of nodes could be useful, for example, for including the nodes
that are not connected to any other node, if this is considered necessary.
Note: If the graph of the output has an odd number of vertices, then it can not contain a halfclique.
Repeated edges and selfloop edges are ignored.
Authors: Carles Creus, Nil Mamano
/
Documentation: