graphs.matching_min_vertex_cover

  • Author: Manuel Di Lullo (https://github.com/manueldilullo)

  • Description: Approximization algorithm for minimum vertex cover problem.

    Matching Approach. Uses graphs represented with an adjacency list

URL: https://mathworld.wolfram.com/MinimumVertexCover.html URL: https://www.princeton.edu/~aaa/Public/Teaching/ORF523/ORF523_Lec6.pdf

Functions

get_edges(→ set)

Return a set of couples that represents all of the edges.

matching_min_vertex_cover(→ set)

APX Algorithm for min Vertex Cover using Matching Approach

Module Contents

graphs.matching_min_vertex_cover.get_edges(graph: dict) set

Return a set of couples that represents all of the edges. @input: graph (graph stored in an adjacency list where each vertex is

represented as an integer)

@example: >>> graph = {0: [1, 3], 1: [0, 3], 2: [0, 3], 3: [0, 1, 2]} >>> get_edges(graph) {(0, 1), (3, 1), (0, 3), (2, 0), (3, 0), (2, 3), (1, 0), (3, 2), (1, 3)}

graphs.matching_min_vertex_cover.matching_min_vertex_cover(graph: dict) set

APX Algorithm for min Vertex Cover using Matching Approach @input: graph (graph stored in an adjacency list where each vertex

is represented as an integer)

@example: >>> graph = {0: [1, 3], 1: [0, 3], 2: [0, 3, 4], 3: [0, 1, 2], 4: [2, 3]} >>> matching_min_vertex_cover(graph) {0, 1, 2, 4}