Graph.edges_where_predicate

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

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

Parameters:
predicatecallable

The condition you want to evaluate. The callable takes 2 parameters: an edge identifier (tuple of node identifiers) and edge attributes, and should return True or False.

databool, optional

If True, yield the edge attributes in addition to the edge attributes.

Yields:
tuple[hashable, hashable] | tuple[tuple[hashable, hashable], dict[str, Any]]

If data is False, the next edge identifier (u, v). If data is True, the next edge identifier and its attributes as a ((u, v), attr) tuple.

Examples

>>>