networkx 2.8.2 Pypi GitHub Homepage
Other Docs
ParametersReturnsBackRef
generic_node_match(attr, default, op)

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

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

default : value | list

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

op : callable | list

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

Returns

match : function

The customized, generic :None:None:`node_match` function.

Returns a comparison function for a generic attribute.

Examples

>>> from operator import eq
... from math import isclose
... from networkx.algorithms.isomorphism import generic_node_match
... nm = generic_node_match("weight", 1.0, isclose)
... nm = generic_node_match("color", "red", eq)
... nm = generic_node_match(["weight", "color"], [1.0, "red"], [isclose, eq])
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

networkx.algorithms.isomorphism.matchhelpers.generic_multiedge_match networkx.algorithms.isomorphism.matchhelpers.generic_node_match

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /networkx/algorithms/isomorphism/matchhelpers.py#261
type: <class 'function'>
Commit: