NetworkX

Previous topic

networkx.LabeledDiGraph.adjacency_iter

Next topic

networkx.LabeledDiGraph.has_node

Quick search

networkx.LabeledDiGraph.nbunch_iter

LabeledDiGraph.nbunch_iter(nbunch=None)

Return an iterator of nodes contained in nbunch that are also in the graph.

Parameters:

nbunch : list, iterable

A container of nodes that will be iterated through once (thus it should be an iterator or be iterable). Each element of the container should be a valid node type: any hashable type except None. If nbunch is None, return all edges data in the graph. Nodes in nbunch that are not in the graph will be (quietly) ignored.

Notes

When nbunch is an iterator, the returned iterator yields values directly from nbunch, becoming exhausted when nbunch is exhausted.

To test whether nbunch is a single node, one can use “if nbunch in self:”, even after processing with this routine.

If nbunch is not a node or a (possibly empty) sequence/iterator or None, a NetworkXError is raised. Also, if any values returned by an iterator nbunch is not hashable, a NetworkXError is raised.