Skip to content

Results are limited to Maximum Independent Set v0.1.9

Product news
You are reading Maximum Independent Set v0.1.9, an older version of this documentation. Go to the latest version (v0.3.2)

mis.pipeline.kernelization

module
mis.pipeline.kernelization

Classes

class
BaseKernelization (graph: nx.Graph)

Bases : BasePreprocessor, abc.ABC

Shared base class for kernelization.

Methods

  • preprocess

  • rebuild — Rebuild a MIS solution to the original graph from a partial MIS solution on the reduced graph obtained by kernelization.

  • is_independent — Determine if a set of nodes represents an independent set within a given graph.

  • is_subclique — Determine whether a list of nodes represents a clique within the graph, i.e. whether every pair of nodes is connected.

  • is_isolated — Determine whether a node is isolated, i.e. this node + its neighbours represent a clique.

method
preprocess () → nx.Graph

method
rebuild (partial_solution: set[int]) → set[int]

Rebuild a MIS solution to the original graph from a partial MIS solution on the reduced graph obtained by kernelization.

method
is_independent (nodes: list[int]) → bool

Determine if a set of nodes represents an independent set within a given graph.

Returns

  • bool — True if the nodes in nodes represent an independent set within graph. False otherwise, i.e. if there's at least one connection between two nodes of nodes

method
is_subclique (nodes: list[int]) → bool

Determine whether a list of nodes represents a clique within the graph, i.e. whether every pair of nodes is connected.

method
is_isolated (node: int) → bool

Determine whether a node is isolated, i.e. this node + its neighbours represent a clique.

class
Kernelization (graph: nx.Graph)

Bases : BaseKernelization

Apply well-known transformations to the graph to reduce its size without compromising the result.

This algorithm is adapted from e.g.

https://schulzchristian.github.io/thesis/masterarbeit_demian_hespe.pdf

Methods

method
preprocess () → nx.Graph

Apply all rules, exhaustively, until the graph cannot be reduced further, storing the rules for rebuilding after the fact.

method
apply_rule_isolated_node_removal (isolated: int) → None

method
search_rule_isolated_node_removal () → None

Remove any isolated node (see is_isolated for a definition).

method
apply_rule_node_fold (v: int, u: int, x: int) → None

method
search_rule_node_fold () → None

If a node V has exactly two neighbours U and X and there is no edge between U and X, fold U, V and X and into a single node.

method
aux_search_confinement (neighbors_S: set[int], S: set[int]) → tuple[int, int, set[int]]

method
apply_rule_unconfined (v: int) → None

method
unconfined_loop (v: int, S: set[int], neighbors_S: set[int]) → bool

method
search_rule_unconfined_and_diamond () → None

method
fold_twin (u: int, v: int, v_prime: int, neighbors_u: list[int]) → None

method
find_twin (v: int) → int | None

Find a twin of a node, i.e. another node with the same neighbours.

method
apply_rule_twin_independent (v: int, u: int, neighbors_u: list[int]) → None

method
apply_rule_twin_has_dependency (v: int, u: int, neighbors_u: list[int]) → None

method
search_rule_twin_reduction () → None

If a node has exactly 3 neighbours and a twin (another node with the exact same neighbours), we can merge the 5 nodes.

class
BaseRebuilder ()

Bases : abc.ABC

The pre-processing operations attempt to remove edges and/or vertices from the original graph. Therefore, when we build a MIS for these reduced graphs (the "partial solution"), we may end up with a solution that does not work for the original graph.

Each rebuilder corresponds to one of the operations that previously reduced the size of the graph, and is charged with adapting the MIS solution to the greater graph.

Methods

method
rebuild (partial_solution: set[int]) → None

class
RebuilderIsolatedNodeRemoval (isolated: int)

Bases : BaseRebuilder

Methods

method
rebuild (partial_solution: set[int]) → None

class
RebuilderNodeFolding (v: int, u: int, x: int, v_prime: int)

Bases : BaseRebuilder

Methods

method
rebuild (partial_solution: set[int]) → None

class
RebuilderUnconfined ()

Bases : BaseRebuilder

Methods

method
rebuild (partial_solution: set[int]) → None

class
RebuilderTwinIndependent (v: int, u: int, w_0: int, w_1: int, w_2: int, v_prime: int)

Bases : BaseRebuilder

Invariants

  • U has exactly 3 neighbours W0, W1, W2;
  • V has exactly the same neighbours as U;
  • there is no self-loop around U or V (hence U and V are not neighbours);
  • there is no edge between W1, W2, W3;
  • V' is the node obtained by merging U, V, W1, W2, W3.

Methods

method
rebuild (partial_solution: set[int]) → None

class
RebuilderTwinHasDependency (v: int, u: int)

Bases : BaseRebuilder

Invariants

  • U has exactly 3 neighbours;
  • V has exactly the same neighbours as U;
  • there is no self-loop around U;
  • there is at least one connection between two neighbours of U.

Methods

method
rebuild (partial_solution: set[int]) → None