{ } Raw JSON

bundles / skimage 0.26.1rc0.dev0+git20260530.b607368ff / skimage / graph / _rag / RAG / merge_nodes

function

skimage.graph._rag:RAG.merge_nodes

source: /dev/scikit-image/src/skimage/graph/_rag.py :157

Signature

def   merge_nodes ( self src dst weight_func = <function min_weight at 0x0000> in_place = True extra_arguments = None extra_keywords = None )

Summary

Merge node src and dst.

Extended Summary

The new combined node is adjacent to all the neighbors of src and dst. weight_func is called to decide the weight of edges incident on the new node.

Parameters

src, dst : int

Nodes to be merged.

weight_func : callable, optional

Function to decide the attributes of edges incident on the new node. For each neighbor n for src and dst, weight_func will be called as follows: weight_func(src, dst, n, *extra_arguments, **extra_keywords). src, dst and n are IDs of vertices in the RAG object which is in turn a subclass of networkx.Graph. It is expected to return a dict of attributes of the resulting edge.

in_place : bool, optional

If set to True, the merged node has the id dst, else merged node has a new id which is returned.

extra_arguments : Sequence, optional

The sequence of extra positional arguments passed to weight_func.

extra_keywords : dictionary, optional

The dict of keyword arguments passed to the weight_func.

Returns

id : int

The id of the new node.

Notes

If in_place is False the resulting node has a new id, rather than dst.

Aliases

  • skimage.graph.RAG.merge_nodes