How to use the node2vec.src.main.config function in node2vec

To help you get started, we’ve selected a few node2vec examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github JiaxuanYou / graph-generation / main_0.py View on Github external
# from node2vec.src.main import *
import node2vec.src.main as nv



if __name__ == '__main__':

    # model configuration
    # hidden_size = 16 # hidden vector size for a single GRU layer
    input_size = 4  # embedding vector size for each node
    # embedding_size = 3+14 # the number of embedding vocabulary
    n_layers = 1
    # train configuration
    # lr = 0.01
    ############# node2vec config###############
    args = nv.config(dimension=input_size)
    ############################################

    # clean logging directory
    if os.path.isdir("logs"):
        shutil.rmtree("logs")
    # configure("logs/logs_toy", flush_secs=1)

    # clean saving directory
    if not os.path.exists("saves"):
        os.makedirs("saves")

    # Generate Graph
    # G = nx.karate_club_graph()
    G = nx.LCF_graph(14, [5, -5], 7)
    graphdataset = GraphDataset(G, shuffle_neighbour=False)
    # run node2vec
github JiaxuanYou / graph-generation / main_1.py View on Github external
from sklearn.decomposition import PCA






# model configuration
# hidden_size = 16 # hidden vector size for a single GRU layer
input_size = 128 # embedding vector size for each node
# embedding_size = 3+14 # the number of embedding vocabulary
n_layers = 1
# train configuration
# lr = 0.01
############# node2vec config###############
args = nv.config(dimension=input_size, walk_length = 80, num_walks = 10, window_size = 2)
############################################

# clean logging directory
if os.path.isdir("logs"):
    shutil.rmtree("logs")
configure("logs/logs_toy", flush_secs=1)

# clean saving directory
if not os.path.exists("saves"):
    os.makedirs("saves")

# Generate Graph
G = nx.karate_club_graph()
# G = nx.LCF_graph(14,[5,-5],7)
# G = nx.LCF_graph(20,[-9,-9],10)