networkx.DiGraph.predecessors

DiGraph.predecessors(n)[source]

Returns an iterator over predecessor nodes of n.

A predecessor of n is a node m such that there exists a directed edge from m to n.

Parameters:n (node) – A node in the graph
Raises:NetworkXError – If n is not in the graph.

See also

successors()