Warning

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

numerical_node_match

numerical_node_match(attr, default, rtol=1e-05, atol=1e-08)

Returns a comparison function for a numerical node attribute.

The value(s) of the attr(s) must be numerical and sortable. If the sorted list of values from G1 and G2 are the same within some tolerance, then the constructed function returns True.

Parameters :

attr : string | list

The numerical node attribute to compare, or a list of numerical node attributes to compare.

default : value | list

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

rtol : float

The relative error tolerance.

atol : float

The absolute error tolerance.

Returns :

match : function

The customized, numerical \(node_match\) function.

Examples

>>> import networkx.algorithms.isomorphism as iso
>>> nm = iso.numerical_node_match('weight', 1.0)
>>> nm = iso.numerical_node_match(['weight', 'linewidth'], [.25, .5])