Reduce the
CLIQUE problem to the
INDUCED SUBGRAPH 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:
{⟨k,G=⟨V,E⟩⟩∣∃S⊆V:(∣S∣≥k∧∀u,v∈S:(u=v⇒{u,v}∈E))}
- INDUCED SUBGRAPH: given two undirected graphs G1 and G2, is
G1 an induced subgraph of G2? In other words, can the nodes of G1 be
injectively mapped onto the nodes of G2 such that, for any two nodes u,v
of G1, the nodes u,v are connected by an edge in G1 if and only if
their corresponding mapped nodes of G2 are connected by an edge in G2?
More formally, this problem can be defined as the following set:
{⟨G1=⟨V1,E1⟩,G2=⟨V2,E2⟩⟩∣∃M:V1→V2 total and injective:∀u,v∈V1:({u,v}∈E1⇔{M(u),M(v)}∈E2)}
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 self-loop edges,
and the value of in.k is at least 2 and at most the number of nodes of
the graph.
-
out: struct {
g1edges: array of array [2] of string
g1nodes: array of string
g2edges: array of array [2] of string
g2nodes: array of string
}
The output is a pair of undirected graphs, which are described with their lists
of edges out.g1edges and out.g2edges and with their lists of
nodes out.g1nodes and out.g2nodes, respectively. An edge is a
pair of nodes, and each node is represented by either an integer or a string.
The lists of nodes out.g1nodes and out.g2nodes are optional, and
contain nodes of the graphs, that may or may not appear in the corresponding
list of edges. These lists 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 output graphs have self-loop edges, they are taken into account to check
the induced property. Repeated edges are ignored.