Added testcase

This commit is contained in:
Vighnesh Birodkar
2014-06-19 02:50:24 +05:30
parent a6c9a5a2a7
commit abcb9cf2ef
5 changed files with 34 additions and 33 deletions
+3 -2
View File
@@ -5,14 +5,15 @@ def threshold_cut(label, rag, thresh):
#print [rag.edges_iter(data = True)]
to_remove = [(x,y) for x,y,d in rag.edges_iter(data = True) if d['weight'] >= thresh]
print "edges to remove",len(to_remove)
#print "edges to remove",len(to_remove)
rag.remove_edges_from(to_remove)
#print "to remove", to_remove
comps = nx.connected_components(rag)
out = np.copy(label)
print "comps",len(comps)
#print "comps",len(comps)
for i, nodes in enumerate(comps) :