Skip to content
Snippets Groups Projects
Commit ac750057 authored by Fize Jacques's avatar Fize Jacques
Browse files

Add args to generate_theoric_random_graph.py

parent 2240661f
No related branches found
No related tags found
No related merge requests found
# coding = utf-8 # coding = utf-8
import os
import networkx as nx import networkx as nx
import argparse import argparse
...@@ -9,6 +9,11 @@ import random ...@@ -9,6 +9,11 @@ import random
import copy import copy
from tqdm import tqdm 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): def generate_sbm_prob_matrix(nb_of_blocks,prob_btw_block=0.1):
M = np.zeros((nb_of_blocks,nb_of_blocks)) M = np.zeros((nb_of_blocks,nb_of_blocks))
np.fill_diagonal(M,[random.random() for i in range(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): ...@@ -19,8 +24,11 @@ def generate_sbm_prob_matrix(nb_of_blocks,prob_btw_block=0.1):
M[j,i] = prob_btw_block M[j,i] = prob_btw_block
return M return M
GRAPH_SIZE = [50,75,100] 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 = { parameters = {
"planted_partition_graph": { "planted_partition_graph": {
...@@ -35,7 +43,7 @@ parameters = { ...@@ -35,7 +43,7 @@ parameters = {
}, },
"fast_gnp_random_graph": { "fast_gnp_random_graph": {
"n": GRAPH_SIZE, "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 "random_powerlaw_tree_sequence": { # configuration_model
"n": GRAPH_SIZE, "n": GRAPH_SIZE,
...@@ -43,12 +51,12 @@ parameters = { ...@@ -43,12 +51,12 @@ parameters = {
}, },
"random_geometric_graph": { "random_geometric_graph": {
"n": GRAPH_SIZE, "n": GRAPH_SIZE,
"radius": [0.1,0.2,0.4,0.8] "radius": [0.1,0.4,0.6]
}, },
"waxman_graph": { "waxman_graph": {
"n": GRAPH_SIZE, "n": GRAPH_SIZE,
"beta": [0.1,0.4,0.8], "beta": [0.1,0.4,0.6],
"alpha": [0.1,0.4,0.8] "alpha": [0.1,0.4,0.6]
}, },
"geographical_threshold_graph": { "geographical_threshold_graph": {
"n": GRAPH_SIZE, "n": GRAPH_SIZE,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment