<jupyter_start><jupyter_text>randomly sample edges that are not there<jupyter_code>desired_num_samples = 1000

all_indices = range(len(G.vs))

nonexistant_edge_list = []

start_time = time.time()
while len(nonexistant_edge_list) < desired_num_samples:
    # randomly select a pair of vertices
    rand_pair = np.random.choice(all_indices, size=2, replace=False)
    
    # check if there is currently an edge between the two vertices
    edge_check = G.es.select(_between=([rand_pair[0]], [rand_pair[1]]))
    
    # if edge does not exist add it to the list
    if len(edge_check) == 0: 
       
        # order the vertices by time
        if G.vs[rand_pair[0]]['year'] <= G.vs[rand_pair[1]]['year']:
            ing_id = rand_pair[1]
            ed_id = rand_pair[0]
        else:
            ing_id = rand_pair[0]
            ed_id = rand_pair[1]
            
        nonexistant_edge_list.append((ing_id, ed_id))
total_runtime = time.time() - start_time

print 'total_runtime %1.5f' % (total_runtime/desired_num_samples)

print 'len nonexistant_edge_list %d' % len(nonexistant_edge_list)
print 'estimated time to get to 500000 samples: %1.5f min' % (((total_runtime/desired_num_samples) * 500000)/60)<jupyter_output>estimated time to get to 500000 samples: 37.65709 min
{'fraction_non_alphanumeric': 0.1075353218210361, 'fraction_numerical': 0.03532182103610675, 'mean_word_length': 3.458041958041958, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '499915', 'license': 'MIT', 'n_tokens_mistral': 468, 'n_tokens_neox': 438, 'n_words': 104, 'path': 'explore/Iain/sample_complement.ipynb', 'repo_name': 'wethepeopleonline/law-net', 'size': '1274'}