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.shared.graphs

module
mis.shared.graphs

Functions

  • calculate_weight — Calculates the total weight of a set of nodes in a given MISInstance

  • is_independent — Checks if the node set is an independent set (no edges between them).

  • remove_neighborhood — Removes a node and all its neighbors from the graph.

calculate_weight (graph: nx.Graph, nodes: list[int]) → float

Calculates the total weight of a set of nodes in a given MISInstance

Parameters

  • graph : nx.Graph — The graph to check.

  • nodes : list[int] — List of node indices.

Returns

  • float — Total weight as a float.

is_independent (graph: nx.Graph, nodes: list[int]) → bool

Checks if the node set is an independent set (no edges between them).

Parameters

  • graph : nx.Graph — The graph to check.

  • nodes : list[int] — The set of nodes.

Returns

  • bool — True if independent, False otherwise.

remove_neighborhood (graph: nx.Graph, nodes: list[int]) → nx.Graph

Removes a node and all its neighbors from the graph.

Parameters

  • graph : nx.Graph — The graph to modify.

  • nodes : list[int] — List of nodes to remove.

Returns

  • nx.Graph — The reduced graph.