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