checking the example provided in the documentation: https://scikit-image.org/docs/dev/auto_examples/segmentation/plot_rag_merge.html#sphx-glr-auto-examples-segmentation-plot-rag-merge-py
I can not understand well what the variable merge_func function does. In example2 it even does nothing and everything seems to work well.
Probably it should have a different name. This is why this functionality is in future: to enable us to experiment with the interface.
merge_func
is a function that takes in the graph and two nodes being merged, and updates the destination node accordingly. In the first example, the information about the graph is stored in the nodes, so the new node needs to be updated. In the second example, all relevant information is in the graph edges, so we don't need to do anything to the new node when it is merged.
weight_func
is the equivalent function for edges: given two nodes being merged and a neighbor of the newly formed node, what are the attributes of the new edge?
My suggestion for the future based on your question is:
edge_merge_func
and node_merge_func
None
so that users don't have to provide them even if they do nothing.I hope all that makes sense!