#%autoindent import sys import os sys.path.append(os.path.abspath("Lib/")) from betweennesslib import Betweenness from lslib import read_link_stream if len(sys.argv)!=3: sys.stderr.write("Usage: %s input_file n\n"%(sys.argv[0])) sys.stderr.write("where input_file describes a link stream L=(T,V,E) and n gives the number of time points per node.\n") sys.stderr.write("Output: a line of the form t v b for each v in V and each time t in T with timestep |T|/n, with b the betweenness of (t,v) in L.\n") sys.exit() L = read_link_stream(open(sys.argv[1])) nb_points = float(sys.argv[2]) increment = (L.omega-L.alpha)/nb_points for v in sorted(L.V): t = L.alpha while t <= L.omega: b = Betweenness(L,(t,v)) sys.stdout.write("%g %s %g\n"%(t,v,b)) sys.stdout.flush() last_t = t t += increment # if str(last_t)!=str(L.omega): # t = L.omega # b = Betweenness(L,(t,v)) # sys.stdout.write("%g %s %g\n"%(t,v,b)) # sys.stdout.flush()