generic_edge_match(attr, default, op)

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.

attrstring | list

The edge attribute to compare, or a list of edge attributes to compare.

defaultvalue | list

The default value for the edge attribute, or a list of default values for the edge attributes.

opcallable | list

The operator to use when comparing attribute values, or a list of operators to use when comparing values for each attribute.


The customized, generic edge_match function.


>>> from operator import eq
>>> from networkx.algorithms.isomorphism.matchhelpers import close
>>> from networkx.algorithms.isomorphism import generic_edge_match
>>> nm = generic_edge_match("weight", 1.0, close)
>>> nm = generic_edge_match("color", "red", eq)
>>> nm = generic_edge_match(["weight", "color"], [1.0, "red"], [close, eq])