ml4co_kit.task.graph.mvc

Minimum Vertex Cover (MVC).

MVC is to find the smallest subset of vertices in an undirected graph such that every edge in the graph is incident to at least one vertex in this subset.

Classes

MVCTask(node_weighted, precision)

class ml4co_kit.task.graph.mvc.MVCTask(node_weighted: bool = False, precision: ~numpy.float32 | ~numpy.float64 = <class 'numpy.float32'>)[source]

Bases: GraphTaskBase

check_constraints(sol: ndarray) bool[source]

Check if the solution is valid.

evaluate(sol: ndarray, check_constr: bool = True) floating[source]

Evaluate the given solution. To be implemented by subclasses.

render(save_path: Path, with_sol: bool = True, figsize: tuple = (5, 5), pos_type: str = 'kamada_kawai_layout', node_color: str = 'darkblue', sol_node_color: str = 'orange', node_size: int = 20, edge_color: str = 'darkblue', edge_alpha: float = 0.5, edge_width: float = 1.0)[source]

Render the MVC problem instance with or without solution.