Warning

This documents an unmaintained version of NetworkX. Please upgrade to a maintained version and see the current NetworkX documentation.

categorical_multiedge_match

categorical_multiedge_match(attr, default)[source]

Returns a comparison function for a categorical edge attribute.

The value(s) of the attr(s) must be hashable and comparable via the == operator since they are placed into a set([]) object. If the sets from G1 and G2 are the same, then the constructed function returns True.

Parameters:

attr : string | list

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

default : value | list

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

Returns:

match : function

The customized, categorical \(edge_match\) function.

Examples

>>> import networkx.algorithms.isomorphism as iso
>>> nm = iso.categorical_multiedge_match('size', 1)
>>> nm = iso.categorical_multiedge_match(['color', 'size'], ['red', 2])