def ignore_intervention_entirely_assumption(x, y, z, w, g): g_xbar = g.prune_edges_to(x) w_ancestors = find_ancestors(set(w), g.make_arcs_from()) zw = set(vertex for vertex in z if vertex not in w_ancestors) g_xbar_zwbar = g_xbar.prune_edges_to(zw) arcs_from = g_xbar_zwbar.make_arcs_from() return (y and z and not is_d_connected(y, z, set(w) | set(x), arcs_from))
def is_d_connected(x, y, z, arcs_from): initial_paths = [SearchPath(0, vertex, vertex, 0, 0) for vertex in x] z_ancestors = find_ancestors(z, arcs_from) is_blocked = make_blocked_predicate(z, z_ancestors) expand = make_expand(arcs_from, is_blocked) has_reached_goal = make_goal_test(y) extract_state = lambda path : path.extract_state() result = search(initial_paths, expand, has_reached_goal, extract_state) return result['reached_goal']
def is_d_connected(x, y, z, arcs_from): initial_paths = [SearchPath(0, vertex, vertex, 0, 0) for vertex in x] z_ancestors = find_ancestors(z, arcs_from) is_blocked = make_blocked_predicate(z, z_ancestors) expand = make_expand(arcs_from, is_blocked) has_reached_goal = make_goal_test(y) extract_state = lambda path: path.extract_state() result = search(initial_paths, expand, has_reached_goal, extract_state) return result['reached_goal']