causaldag.classes.ancestral_graph.AncestralGraph.neighbors_of¶
-
AncestralGraph.
neighbors_of
(nodes: Union[Hashable, Set[Hashable]]) → Set[Hashable][source]¶ Return the neighbors of the node or set of nodes
nodes
.Parameters: nodes – Nodes. Examples
>>> import causaldag as cd >>> g = cd.AncestralGraph(directed={(1, 3), (2, 3)}, undirected={(1, 4), (2, 5)}) >>> g.neighbors_of(1) {4} >>> g.neighbors_of({1, 2}) {4, 5}