causaldag.classes.dag.DAG.indegree_of

DAG.indegree_of(node: Hashable) → int[source]

Return the indegree of node.

Parameters:node – The node.

See also

outdegree_of()

Returns:The number of parents of node.
Return type:int

Example

>>> import causaldag as cd
>>> g = cd.DAG(arcs={(1, 2), (1, 3), (2, 3)})
>>> g.indegree_of(1)
0
>>> g.indegree_of(2)
2