def report_maximize_edges(maximize, file): with open(file) as fp: n = 0 k = 0 for graph in sdp.graphs2015(fp): n += len(graph.edges) k += maximize(graph) print("%.2f%% (%d/%d)" % (k / n * 100, k, n))
def report_graphs(property, file): with open(file) as fp: n = 0 k = 0 for graph in sdp.graphs2015(fp): n += 1 k += property(graph) print("%.2f%% (%d/%d)" % (k / n * 100, k, n))
# Count the number of arcs in an SDP file # Marco Kuhlmann <*****@*****.**> import sdp import sys n = 0 with open(sys.argv[1]) as fp: for graph in sdp.graphs2015(fp): n += len(graph.edges) print(n)