Cool--this works perfectly now :-) Unfortunately, it's actually slower :P Most of the slowest part is in the removing doubles section. Some of the costliest calls: #takes 0.04 seconds inner = np.inner(ns, v1s - some_point) #0.0840001106262 sum_1 = sum.reshape((len(sum), 1)).repeat(len(sum), axis = 1) #0.0329999923706 sum_2 = sum.reshape((1, len(sum))).repeat(len(sum), axis = 0) #0.0269999504089 comparison_sum = (sum_1 == sum_2) #0.0909998416901 diff_1 = diff.reshape((len(diff), 1)).repeat(len(diff), axis = 1) #0.0340001583099 diff_2 = diff.reshape((1, len(diff))).repeat(len(diff), axis = 0) #0.0269999504089 comparison_diff = (diff_1 == diff_2) #0.0230000019073 same_edges = comparison_sum * comparison_diff #0.128999948502 doublet_count = same_edges.sum(axis = 0) Ian