def _connected_by_alternating_paths(G, matching, targets):
 return {v for v in G if _is_connected_by_alternating_path(G, v, matching, targets)}

def _connected_by_alternating_paths ( G , matching , targets ) : return { v for v in G if _is_connected_by_alternating_path ( G , v , matching , targets ) }
returns the set of vertices that are connected to one of the target vertices by an alternating path in g .