causaldag.classes.dag.DAG.parents_of¶
-
DAG.parents_of(nodes: Union[Hashable, Set[Hashable]]) → Set[Hashable][source]¶ Return all nodes that are parents of the node or set of nodes
nodes.Parameters: nodes – A node or set of nodes. See also
Examples
>>> import causaldag as cd >>> g = cd.DAG(arcs={(1, 2), (2, 3)}) >>> g.parents_of(2) {1} >>> g.parents_of({2, 3}) {1, 2}