mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-18 12:40:14 +08:00
Changed max_edge in example/plot_rag.py
This commit is contained in:
@@ -17,7 +17,7 @@ def min_weight(g, src, dst, n):
|
||||
src, dst : int
|
||||
The verices in `g` to be merged.
|
||||
n : int
|
||||
A neighbor of `src` or `dst` or both
|
||||
A neighbor of `src` or `dst` or both.
|
||||
|
||||
Returns
|
||||
-------
|
||||
|
||||
@@ -23,10 +23,14 @@ def test_rag_merge():
|
||||
|
||||
gc = g.copy()
|
||||
|
||||
# We merge nodes and ensure that the minimum weight is chosen
|
||||
# when there is a conflict.
|
||||
g.merge_nodes(0, 2)
|
||||
assert g.edge[1][2]['weight'] == 10
|
||||
assert g.edge[2][3]['weight'] == 30
|
||||
|
||||
# We specify `max_edge` as `weight_func` as ensure that maximum
|
||||
# weight is chosen in case on conflict
|
||||
gc.merge_nodes(0, 2, weight_func=max_edge)
|
||||
assert gc.edge[1][2]['weight'] == 20
|
||||
assert gc.edge[2][3]['weight'] == 40
|
||||
|
||||
Reference in New Issue
Block a user