Skip to content

[Model] Kernel #885

@isPANN

Description

@isPANN

Motivation

KERNEL (GT57) from Garey & Johnson, A1.1. Given a directed graph, find a kernel: an independent and absorbing set. A kernel is a set V' of vertices such that no two vertices in V' are connected by an arc, and every vertex outside V' has an arc to some vertex in V'. NP-complete (Chvátal 1973) via reduction from 3-Satisfiability. Kernels generalize stable matchings and appear in game theory (winning positions in combinatorial games), logic (stable extensions of argumentation frameworks), and cooperative game theory.

Associated rules:

Definition

Name: Kernel
Reference: Garey & Johnson, Computers and Intractability, A1.1 GT57; Chvátal 1973

Mathematical definition:

INSTANCE: Directed graph G = (V,A).
QUESTION: Does G have a kernel, i.e., is there a set V' ⊆ V such that (1) no two vertices in V' are joined by an arc of A, and (2) for every vertex u ∈ V − V' there is a vertex v ∈ V' such that (u,v) ∈ A?

Condition (1) says V' is independent in the directed sense; condition (2) says V' is absorbing (every non-member has an out-neighbor in V').

Variables

  • Count: |V| (one per vertex)
  • Per-variable domain: {0, 1} (binary: in the kernel or not)
  • Meaning: Whether each vertex is included in the kernel. The selected set must be independent (no arcs between selected vertices) and absorbing (every non-selected vertex has an arc to some selected vertex).

Schema (data type)

Type name: Kernel
Variants: none

Field Type Description
graph DirectedGraph The directed graph G = (V,A)

Notes:

  • This is a feasibility (decision) problem: Value = Or.
  • Key getter methods: num_vertices() (= |V|), num_arcs() (= |A|), delegated from DirectedGraph.
  • Uses the existing DirectedGraph type in src/topology/directed_graph.rs.
  • Self-loops should be excluded.

Complexity

  • Decision complexity: NP-complete (Chvátal, 1973; transformation from 3-Satisfiability). Not every digraph has a kernel — deciding existence is the NP-complete part.
  • Best known exact algorithm: O*(2^n) by brute-force subset enumeration. No sub-2^n exact algorithm is known for general digraphs.
  • Concrete complexity expression: "2^num_vertices" (for declare_variants!)
  • Tractable cases: Every directed acyclic graph (DAG) has a unique kernel, computable in polynomial time. Every digraph with no odd directed cycle has a kernel (Richardson's theorem).
  • References:
    • V. Chvátal (1973). "On the computational complexity of finding a kernel." Report CRM-300, Centre de Recherches Mathématiques, Université de Montréal.

Extra Remark

Full book text:

INSTANCE: Directed graph G = (V,A).
QUESTION: Does G contain a kernel, i.e., is there a subset V' ⊆ V such that no two vertices in V' are joined by an arc of A and such that, for every vertex u ∈ V − V', there is a vertex v ∈ V' such that (u,v) ∈ A?

Reference: [Chvátal, 1973]. Transformation from 3-SATISFIABILITY.
Comment: Every directed acyclic graph has a kernel. Solvable in polynomial time for DAGs.

How to solve

  • It can be solved by (existing) bruteforce. (Enumerate all 2^|V| subsets; check independence and absorption.)
  • It can be solved by reducing to integer programming.
  • Other:

Example Instance

Positive instance:
V = {0, 1, 2, 3, 4}, A = {(0,1), (0,2), (1,3), (2,3), (3,4), (4,0), (4,1)}

Kernel: V' = {0, 3}

  • Independence: no arc (0,3) or (3,0) in A ✓
  • Absorption:
    • vertex 1 ∉ V': arc (1,3) ∈ A, 3 ∈ V' ✓
    • vertex 2 ∉ V': arc (2,3) ∈ A, 3 ∈ V' ✓
    • vertex 4 ∉ V': arc (4,0) ∈ A, 0 ∈ V' ✓

Answer: YES — {0, 3} is the unique kernel (1 out of 32 subsets).

Near-miss candidates:

  • {0, 4}: arc (4,0) ∈ A violates independence ✗
  • {1, 3}: arc (1,3) ∈ A violates independence ✗
  • {0}: vertex 1 has no arc to {0} (only (1,3)), violates absorption ✗

Negative instance:
Remove arc (4,0) from the positive example: A' = {(0,1), (0,2), (1,3), (2,3), (3,4), (4,1)}.
Now vertex 4 has only arc (4,1). For absorption, 4 must have an arc to some kernel member. But vertex 1 cannot be in the kernel together with 3 (arc (1,3) violates independence), and without vertex 0 in the kernel, vertex 4 has no arc to any valid kernel member. Exhaustive search confirms no kernel exists. Answer: NO.

Python validation script
from itertools import combinations

def find_kernels(n, arcs):
    arc_set = set(arcs)
    kernels = []
    for size in range(n + 1):
        for subset in combinations(range(n), size):
            s = set(subset)
            indep = all((u,v) not in arc_set for u in s for v in s if u != v)
            if not indep: continue
            absorb = all(
                any((u,v) in arc_set for v in s)
                for u in range(n) if u not in s
            )
            if absorb:
                kernels.append(s)
    return kernels

# Positive
arcs_pos = [(0,1),(0,2),(1,3),(2,3),(3,4),(4,0),(4,1)]
k_pos = find_kernels(5, arcs_pos)
assert k_pos == [{0, 3}]
print(f"Positive: {len(k_pos)} kernel(s): {k_pos}")

# Negative (remove (4,0))
arcs_neg = [(0,1),(0,2),(1,3),(2,3),(3,4),(4,1)]
k_neg = find_kernels(5, arcs_neg)
assert len(k_neg) == 0
print(f"Negative: {len(k_neg)} kernels (correct)")

Metadata

Metadata

Assignees

No one assigned

    Labels

    GoodAn issue passed all checks.modelA model problem to be implemented.

    Type

    No type

    Projects

    Status

    Done

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions