from mlabwrap import mlab v = mlab.test(4) print v
j = node_mapping_count node_mapping_count += 1 #f.write("{0}\t{1}\t{2}\n".format(i,j,e[2][2])) f.write("{0}\t{1}\t1\n".format(i,j)) f.close() mlab.readin('filename.txt','miska') HCS = [] todo = [array(range(1,node_mapping_count))] bad = [] while len(todo) > 0: cur = todo.pop() print >> sys.stderr, "running matlab on size {0}.....".format(len(cur)) answer = mlab.test('miska',cur) if answer[0][0]==-1: print >> sys.stderr, "bad bunch of size {0}!".format(len(cur)) bad.append(list(cur)) # elif answer[0][0] > len(cur)*.9: # is a highly connected subgraph # HCS.append(list(cur)) # print >> sys.stderr, "cut {0} is HCS".format(len(cur)) else: set1 = answer[0][1:] set2 = array(list(set(list(cur)).difference(set(list(set1))))) if len(set1) > SMALLEST_SUBGRAPH_SIZE: todo.append(set1) else: HCS.append(list(set1)) if len(set2) > SMALLEST_SUBGRAPH_SIZE: todo.append(set2)