def gen_graphs(args, dl, vgae):
    adj_orig = dl.adj_orig
    assert (adj_orig.diagonal().sum() == 0)
    if args.gae:
        pickle.dump(adj_orig, open(f'graphs/{args.dataset}_graph_0_gae.pkl', 'wb'))
    else:
        pickle.dump(adj_orig, open(f'graphs/{args.dataset}_graph_0.pkl', 'wb'))
    pickle.dump(dl.features_orig, open(f'graphs/{args.dataset}_features.pkl', 'wb'))
    features = dl.features.to(args.device)
    for i in range(args.gen_graphs):
        with torch.no_grad():
            A_pred = vgae(features)
        A_pred = torch.sigmoid(A_pred).detach().cpu()
        r = get_scores(dl.val_edges, dl.val_edges_false, A_pred, dl.adj_label)
        adj_recon = A_pred.numpy()
        np.fill_diagonal(adj_recon, 0)
        if args.gae:
            filename = f'graphs/{args.dataset}_graph_{(i + 1)}_logits_gae.pkl'
        else:
            filename = f'graphs/{args.dataset}_graph_{(i + 1)}_logits.pkl'
        pickle.dump(adj_recon, open(filename, 'wb'))
def gen_graphs(args, dl, vgae):
    adj_orig = dl.adj_orig
    assert (adj_orig.diagonal().sum() == 0)
    if args.gae:
        pickle.dump(adj_orig, open(f'graphs/{args.dataset}_graph_0_gae.pkl', 'wb'))
    else:
        pickle.dump(adj_orig, open(f'graphs/{args.dataset}_graph_0.pkl', 'wb'))
    pickle.dump(dl.features_orig, open(f'graphs/{args.dataset}_features.pkl', 'wb'))
    features = dl.features.to(args.device)
    for i in range(args.gen_graphs):
        with torch.no_grad():
            A_pred = vgae(features)
        A_pred = torch.sigmoid(A_pred).detach().cpu()
        r = get_scores(dl.val_edges, dl.val_edges_false, A_pred, dl.adj_label)
        adj_recon = A_pred.numpy()
        np.fill_diagonal(adj_recon, 0)
        if args.gae:
            filename = f'graphs/{args.dataset}_graph_{(i + 1)}_logits_gae.pkl'
        else:
            filename = f'graphs/{args.dataset}_graph_{(i + 1)}_logits.pkl'
        pickle.dump(adj_recon, open(filename, 'wb'))