Returns a comparison function for a generic attribute.
The value(s) of the attr(s) are compared using the specified operators. If all the attributes are equal, then the constructed function returns True.
Parameters : | attr : string | list
default : value | list
op : callable | list
|
---|---|
Returns : | match : function
|
Examples
>>> from operator import eq
>>> from networkx.algorithms.isomorphism.matchhelpers import close
>>> from networkx.algorithms.isomorphism import generic_node_match
>>> nm = generic_node_match('weight', 1.0, close)
>>> nm = generic_node_match('color', 'red', eq)
>>> nm = generic_node_match(['weight', 'color'], [1.0, 'red'], [close, eq])