diff --git a/generate_theoric_random_graph.py b/generate_theoric_random_graph.py index b6f83f2d01b716f364683a884e9bb0282a5309b9..d2e1d91adb577c8ce8010545ce86bc3cbd0c066c 100644 --- a/generate_theoric_random_graph.py +++ b/generate_theoric_random_graph.py @@ -1,5 +1,5 @@ # coding = utf-8 - +import os import networkx as nx import argparse @@ -9,6 +9,11 @@ import random import copy from tqdm import tqdm +# COMMAND PARSING +parser = argparse.ArgumentParser() +parser.add_argument("output_dir") +args = parser.parse_args() + def generate_sbm_prob_matrix(nb_of_blocks,prob_btw_block=0.1): M = np.zeros((nb_of_blocks,nb_of_blocks)) np.fill_diagonal(M,[random.random() for i in range(nb_of_blocks)]) @@ -19,8 +24,11 @@ def generate_sbm_prob_matrix(nb_of_blocks,prob_btw_block=0.1): M[j,i] = prob_btw_block return M + GRAPH_SIZE = [50,75,100] -OUTPUT_DIR = "data/theoric_graph_1/" +OUTPUT_DIR = args.output_dir +if os.path.exist(OUTPUT_DIR): + raise FileExistsError("Output directory does not exists !") parameters = { "planted_partition_graph": { @@ -35,7 +43,7 @@ parameters = { }, "fast_gnp_random_graph": { "n": GRAPH_SIZE, - "p": [0.1,0.4,0.6,0.8] + "p": [0.1,0.4,0.6] }, "random_powerlaw_tree_sequence": { # configuration_model "n": GRAPH_SIZE, @@ -43,12 +51,12 @@ parameters = { }, "random_geometric_graph": { "n": GRAPH_SIZE, - "radius": [0.1,0.2,0.4,0.8] + "radius": [0.1,0.4,0.6] }, "waxman_graph": { "n": GRAPH_SIZE, - "beta": [0.1,0.4,0.8], - "alpha": [0.1,0.4,0.8] + "beta": [0.1,0.4,0.6], + "alpha": [0.1,0.4,0.6] }, "geographical_threshold_graph": { "n": GRAPH_SIZE,