Graph.nodes_where_predicate

Graph.nodes_where_predicate(predicate, data=False)[source]

Get nodes for which a certain condition or set of conditions is true using a lambda function.

Parameters
  • predicate (callable) – The condition you want to evaluate. The callable takes 2 parameters: key, attr and should return True or False.

  • data (bool, optional) – Yield the nodes and their data attributes. Default is False.

Yields
  • key (hashable) – The next node that matches the condition.

  • 2-tuple – The next node and its attributes, if data=True.

Examples

>>>