D-connecting paths #15
Replies: 3 comments 17 replies
-
It is an interesting but unusual question. So there is no direct way to find them. The question is to find all the paths between X and Y in the moralized ancestral graph which are not using nodes in Z. Unfortunately, |
Beta Was this translation helpful? Give feedback.
3 replies
-
By the way, for your initial question, just a first answer ... may not be correct, but it is the idea : def DFS(g,src,target):
"""
Parameters
-----------------
g: undirected graph
src,target : nodeId
Returns
-----------
List[List[int]] : a list of paths (as list of nodes) from src to target in g.
"""
def recDFS(g,src,target,current,mark,res):
if src==target:
res.append(current)
elif src not in mark:
mark[src]=1
for n in g.neighbours(src):
recDFS(g,n,target,current+[n],mark,res)
del(mark[src])
res=[]
current=[src]
mark={}
recDFS(g,src,target,current,mark,res)
return res For instance : |
Beta Was this translation helpful? Give feedback.
8 replies
-
It would be great if this can be part of pyagrum functions in the future!
…On Thu, May 25, 2023, 3:58 AM Pierre-Henri Wuillemin < ***@***.***> wrote:
This is the generalization of the d-separation(in a DAG)/separation (in an
undirected graph)/C-separation (in a DAG) :
X and Y are separated by Z if all the paths from X to Y in MAG(X+Y+Z)
contains node(s) of Z. (if X and Y are not connected in the MAG mutilated
by Z).
You can find many references to this on internet (
https://arxiv.org/abs/1302.3606v1)
—
Reply to this email directly, view it on GitHub
<#15 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AF3Z3CRWSX6TIBELE6FNKXLXH4GL7ANCNFSM6AAAAAAYNYE4J4>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
@phwuil Do you know if there is a way to output all d-connecting paths from X to Y relative Z given a PDAG in pyagrum once
cSeparation(X, Y, Z)
returns true?Beta Was this translation helpful? Give feedback.
All reactions