numerical_node_match#
- numerical_node_match(attr, default, rtol=1e-05, atol=1e-08)[source]#
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:
- attrstring | list
The name of the numerical node attribute to compare, or a list of numerical node attributes to compare.
- defaultvalue | list
If
attris a string, the default numerical value for that attribute. Otherwise, a list of same length asattrwith default values for each attribute.- rtolfloat
The relative error tolerance.
- atolfloat
The absolute error tolerance.
- Returns:
- matchfunction
The customized, numerical
node_matchfunction.
Examples
>>> import networkx.algorithms.isomorphism as iso >>> nm = iso.numerical_node_match("weight", 1.0) >>> nm = iso.numerical_node_match(["weight", "linewidth"], [0.25, 0.5])