R igraph ancestors python
问题 I have a network like in the diagram. In python there is the ancestors function. When i use it on node 5, it will provide list of nodes 1,2 and 3. what is an equivalent function in igraph R? I tried subcomponent but it didn't work for me. Also my actual network is quiet long and I don't want to use parent or child function as I don't know degree in every case 回答1: The R function is neighborhood with mode="in" : http://igraph.org/r/doc/neighborhood.html E.g. g1 <- graph(c(1,4, 1,2, 1,3, 3,2, 2