Block.vertices_where_predicate

Block.vertices_where_predicate(predicate, data=False)

Get vertices 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: the vertex identifier and the vertex attributes, and should return True or False.

databool, optional

If True, yield the vertex attributes in addition to the vertex identifiers.

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

If data is False, the next vertex that matches the condition. If data is True, the next vertex and its attributes.