def to_vertex_cover(G, matching):
 (L, R) = bipartite_sets(G)
 unmatched_vertices = (set(G) - set(matching))
 U = (unmatched_vertices & L)
 Z = _connected_by_alternating_paths(G, matching, U)
 return ((L - Z) | (R & Z))

def to_vertex_cover ( G , matching ) : ( L , R ) = bipartite_sets ( G ) unmatched_vertices = ( set ( G ) - set ( matching ) ) U = ( unmatched_vertices & L ) Z = _connected_by_alternating_paths ( G , matching , U ) return ( ( L - Z ) | ( R & Z ) )
returns the minimum vertex cover corresponding to the given maximum matching of the bipartite graph g .