What is the most efficient way to find the ancestors (parents) of a particular node?
You can find the “in” and “out” components of a node using the subcomponent
function, e.g. G.subcomponent(v, mode=ig.IN)
. This functions returns all nodes that can reach the node v
(when using ig.IN
) or all nodes that can be reached by node v
(when using ig.OUT
).