parser.add_argument("graph",help="Name of the graph to be used.",choices=['checkins-foursquare','checkins-gowalla','checkins-brightkite','friends-foursquare','friends-gowalla','friends-brightkite'])
----------
parser.add_argument("--k",help="Percentage of nodes to be sampled. Needs to be a float between 0 and 1. Default is 0.",default=0,type=float)
`G`:nx.Graph
parser.add_argument("--nrand",help="Number of random graphs. Needs to be an integer. Default is 12",default=12,type=int)
Thegraphtocomputetheomegaindex
parser.add_argument("--niter",help="Approximate number of rewiring per edge to compute the equivalent random graph. Default is 12",default=12,type=int)
parser.add_argument("--processes",help="Number of processes to be used. Needs to be an integer. Default is the number of cores.",default=multiprocessing.cpu_count(),type=int)
`k`:float
parser.add_argument("--seed",help="Seed for the random number generator. Needs to be an integer. Default is 42",default=42,type=int)
parser.add_argument("graph",help="Name of the graph to be used.",choices=['checkins-foursquare','checkins-gowalla','checkins-brightkite','friends-foursquare','friends-gowalla','friends-brightkite'])
parser.add_argument("--k",help="Percentage of nodes to be sampled. Needs to be a float between 0 and 1. Default is 0.",default=0,type=float)
parser.add_argument("--nrand",help="Number of random graphs. Needs to be an integer. Default is 12",default=12,type=int)
parser.add_argument("--niter",help="Approximate number of rewiring per edge to compute the equivalent random graph. Default is 12",default=12,type=int)
parser.add_argument("--processes",help="Number of processes to be used. Needs to be an integer. Default is the number of cores.",default=multiprocessing.cpu_count(),type=int)
parser.add_argument("--seed",help="Seed for the random number generator. Needs to be an integer. Default is 42",default=42,type=int)
parser.add_help=True
args=parser.parse_args()
ifargs.processes>multiprocessing.cpu_count():
print("Number of processes is higher than available. Setting it to default value: all available")
args.processes=multiprocessing.cpu_count()
elifargs.processes<1:
raiseValueError("Number of processes needs to be at least 1")
name=args.graph.split('-')[1]
if'checkins'inargs.graph:
G=create_graph_from_checkins(name)
elif'friends'inargs.graph:
G=create_friendships_graph(name)
G.name=str(args.graph)+" Checkins Graph"
print("\nComputing omega for graph {} with {} nodes and {} edges".format(args.graph,len(G),G.number_of_edges()))
print("Number of processes used: ",args.processes)
print("Number of nodes in the sampled graph: ",G.number_of_nodes())
print("Number of edges in the sampled graph: ",G.number_of_edges())
parser=argparse.ArgumentParser()
returnG_connected
parser.add_argument("graph",help="Name of the graph to be used.",choices=['checkins-foursquare','checkins-gowalla','checkins-brightkite','friends-foursquare','friends-gowalla','friends-brightkite'])
parser.add_argument("--k",help="Percentage of nodes to be sampled. Needs to be a float between 0 and 1",default=0)
if__name__=="__main__":
parser.add_argument("--niter",help="Number of rewiring per edge. Needs to be an integer. Default is 5",default=5)
parser=argparse.ArgumentParser()
parser.add_argument("--nrand",help="Number of random graphs. Needs to be an integer. Default is 5",default=5)
parser.add_argument("graph",help="Name of the graph to be used. Options are 'checkins-foursquare', 'checkins-gowalla', 'checkins-brightkite', 'friends-foursquare', 'friends-gowalla', 'friends-brightkite'")
parser.add_argument("k",help="Percentage of nodes to be sampled. Needs to be a float between 0 and 1")
parser.add_help=True
parser.add_argument("--niter",help="Number of rewiring per edge. Needs to be an integer. Default is 5",default=5)
args=parser.parse_args()
parser.add_argument("--nrand",help="Number of random graphs. Needs to be an integer. Default is 5",default=5)
parser.add_help=True
# the name of the graph is the first part of the input string
args=parser.parse_args()
name=args.graph.split('-')[1]
if'checkins'inargs.graph:
# the name of the graph is the first part of the input string
G=create_graph_from_checkins(name)
name=args.graph.split('-')[1]
elif'friends'inargs.graph:
if'checkins'inargs.graph:
G=create_friendships_graph(name)
G=create_graph_from_checkins(name)
G.name=str(args.graph)+" Checkins Graph"
elif'friends'inargs.graph:
G=create_friendships_graph(name)
# sample the graph
G.name=str(args.graph)+" Checkins Graph"
G_sample=random_sample(G,float(args.k))# function from utils.py, check it out there
Thedatasetsaredownloadedinthe"data"folder.Ifthefolderdoesn't exist, it will be created. If the dataset is already downloaded, it will be skipped. The files are renamed to make them more readable.
Thedatasetsaredownloadedinthe"data"folder.Ifthefolderdoesn't exist, it will be created. If the dataset is already downloaded, it will be skipped. The files are renamed to make them more readable.