Changed max_edge in example/plot_rag.py

This commit is contained in:
Vighnesh Birodkar
2014-06-28 11:06:30 +05:30
parent f71ad51f57
commit dd67b3fce7
3 changed files with 11 additions and 19 deletions
+1 -1
View File
@@ -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
-------
+4
View File
@@ -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