def timings(): N_range = [5, 10, 30, 50, 100, 200, 500, 1000, 10000] N_range = [5, 10, 30, 50, 100, 200] df = pd.DataFrame({}, columns=["N", "time"]) for N in N_range: print N G = nx.fast_gnp_random_graph(N, 10./N) start_time = time() kplexAlg(G, 2) run_time = time()-start_time print run_time df.loc[len(df)] = [N, run_time] df = df.set_index("N") print df
def analyzeNetwork(G, k=2, filename=None): # Get kplexes if filename and isfile(filename): kplexesMax = pickle.load(open(filename)) else: _, kplexesMax = kplexAlg(G, k, verbose=True) if filename: pickle.dump(kplexesMax, open(filename, 'wb')) print "List of {}-plexes".format(k) print kplexesMax # get histogram for size of kplex kplexSizes = map(len, kplexesMax) plt.hist(kplexSizes)