Пример #1
0
# Heuristic:
# 1. 
#(random) split Nv = B union R with n(v) >= 154.
#2.
#Precolor the edges from v to Nv and those induced by B and R,
#as described above. This precolors 42 + about (231-154),
#or almost 120 edges.
#3.
#Make a SAT instance alpha for this precoloring.= GNR(127, 3)

G = GNR(127,3)

nv = int(sys.argv[1]) # THIS SHOULD BE 157 as per SPR's comments
print >> sys.stderr, "Searching for split"
start = time.time()
v, bags, B, R, T, pcmap = G.find_candidate_rb_split(nv, target = 21, delta = 0.9, random_vertex_selection = False, exhaustive = True)
end = time.time()
print >> sys.stdout, str((end - start) * 1000) + "ms"
print >> sys.stderr, str((end - start) * 1000) + "ms"
print >> sys.stdout, str(v)
print >> sys.stdout, str(B)
print >> sys.stdout, str(R)
print >> sys.stderr, str(v)
print >> sys.stderr, str(B)
print >> sys.stderr, str(R)
print >> sys.stderr, "Split found!"

# Categorization
triangles, classes, counts = define_triangle_classes(G.graph, v, B, R, T, pcmap)
print "Num triangles: " + str(triangles)
print "Counts: " + str(counts)