You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/gensearch.jl
+20Lines changed: 20 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -76,10 +76,30 @@ function descendants(g, X, veto = no_veto)
76
76
returngensearch(g, X, (pe, ne, v, w) -> ne == RIGHT &&!veto(pe, ne, v, w))
77
77
end
78
78
79
+
"""
80
+
bayesball(g, X, S = Set{eltype(g)}())
81
+
82
+
Return the set of vertices d-connected to the set of vertices X given set of vertices S in dag g.
83
+
"""
79
84
functionbayesball(g, X, S =Set{eltype(g)}(), veto = no_veto)
80
85
returngensearch(g, X, (pe, ne, v, w) ->!veto(pe, ne, v, w) && (pe == INIT || (v in S && pe == RIGHT && ne == LEFT) || (!(v in S) &&!(pe == RIGHT && ne == LEFT))))
81
86
end
82
87
88
+
89
+
"""
90
+
bayesball_graph(g, X, S = Set{eltype(g)}())
91
+
92
+
Return an undirected graph `b` containing edges for possible moves of the
93
+
Bayes ball. Vertex `i` of `g` is vertex `2i-1` of `b`
94
+
if entered forward, `2i` if entered backward.
95
+
"""
96
+
functionbayesball_graph(g, X, S =Set{eltype(g)}())
97
+
ι(e, i) = e == RIGHT ?2i-1:2i
98
+
edges = Pair{Int,Int}[]
99
+
CausalInference.gensearch(g, X, (pe, ne, v, w) -> (pe == INIT || (v in S && pe == RIGHT && ne == LEFT) || (!(v in S) &&!(pe == RIGHT && ne == LEFT))) && (push!(edges, ι(pe, v)=>ι(ne, w)); true))
0 commit comments