def is_matching(G, matching):
 if isinstance(matching, dict):
  matching = matching_dict_to_set(matching)
 return all(((len((set(e1) & set(e2))) == 0) for (e1, e2) in combinations(matching, 2)))

def is_matching ( G , matching ) : if isinstance ( matching , dict ) : matching = matching_dict_to_set ( matching ) return all ( ( ( len ( ( set ( e1 ) & set ( e2 ) ) ) == 0 ) for ( e1 , e2 ) in combinations ( matching , 2 ) ) )
decides whether the given set or dictionary represents a valid matching in g .