def gen_PALE(s,c, seed=1, ppi=None): name_s = str(s).replace("0.","") name_c = str(c).replace("0.","") networkx_dir = ppi+'/graphsage' outdir = ppi+'/semi-synthetic/PALE-s{}-c{}-seed{}'.format(name_s, name_c, seed) semiSynthetic = SemiSynthetic(networkx_dir, outdir+"-1", outdir+"-2", seed=seed) semiSynthetic.generate_PALE_synthetic(s,c)
def gen_REGAL(d, ppi, p_change_feats=None, seed=1): name_d = str(d).replace("0.","") networkx_dir = ppi+'/graphsage' if p_change_feats is not None: outdir = ppi+'/semi-synthetic/REGAL-d{}-pfeats{}-seed{}/'.format(name_d, str(p_change_feats).replace("0.",""), seed) else: outdir = ppi + '/REGAL-d{}-seed{}/'.format(name_d, seed) semiSynthetic = SemiSynthetic(networkx_dir, outdir, seed = seed) semiSynthetic.generate_random_clone_synthetic(0, d, p_change_feats=p_change_feats)
from input.semi_synthetic import SemiSynthetic from input.fully_synthetic import FullySynthetic import numpy as np n_nodes = [1000, 2000, 5000, 10000, 20000] ks = [20,60,100,200,350] for n in n_nodes: for k in ks: #np.random.seed(123) outdir="../dataspace/graph/fully-synthetic/small-world-n{}-k{}-p5-seed123/".format(n, k) FullySynthetic.generate_small_world_graph(outdir,n_nodes=n,k_neighbors=k, p_edge_modify=0.5, feature_dim=16) semiSynthetic = SemiSynthetic(outdir+'/graphsage',outdir+'/random-d01') semiSynthetic.generate_random_clone_synthetic(0, 0.01)
def gen_randomclone(origin_dir, a,d): semiSynthetic = SemiSynthetic( origin_dir+"/graphsage", origin_dir+"/random-a{}-d{}".format(str(a).replace("0.",""), str(d).replace("0.",""))) semiSynthetic.generate_random_clone_synthetic(a,d)
# def shuffle_graph(nc, seed): # dirr = FULLY+"smallworld-n1000-k10-p5-nc"+str(nc)+'-seed'+str(seed) +'/random-d01' # command = [ # 'python', # 'utils/shuffle_graph.py', # '--input_dir', # dirr, # '--out_dir', # dirr+'--1' # ] # p = subprocess.Popen(command) # p.communicate() # command = [ # 'rm', # '-r', # dirr # ] # p = subprocess.Popen(command) # p.communicate() # command = ['mv', dirr+'--1', dirr] # p = subprocess.Popen(command) # p.communicate() for seed in range(100, 150): for nc in [1, 2, 3, 4, 5, 6]: out_dir = generate_graph(nc, seed) networkx_dir = out_dir + "/graphsage" semiSynthetic = SemiSynthetic(networkx_dir, out_dir + "/random-d01") semiSynthetic.generate_random_clone_synthetic(0, 0.01)