rustworkx.PyDiGraph.find_node_by_weight#
- PyDiGraph.find_node_by_weight(obj, /)#
Find node within this graph given a specific weight
This algorithm has a worst case of O(n) since it searches the node indices in order. If there is more than one node in the graph with the same weight only the first match (by node index) will be returned.
- Parameters:
obj – The weight to look for in the graph.
- Returns:
the index of the first node in the graph that is equal to the weight. If no match is found
None
will be returned.- Return type:
int