Skip to content
/ WalkRNN Public

Randomly walk over graphs to generate language model inputs

License

Notifications You must be signed in to change notification settings

dtylor/WalkRNN

Repository files navigation

WalkRNN

A utility module for experimenting with graph embeddings for use in language models. See paper at http://viXra.org/abs/1910.0362

Usage

from utilities import *
from module import *

# Load graph from csv
Gkern = load_graph_kernel_graph("./examples/data/AIDS")
y = load_graph_kernel_labels("./examples/data/AIDS")

#Learn structural signatures of each node in networkx property graph and apply to node as an attribute
#Then transform into a format prepared for WalkRNN
G, current_vocab_size = transform_graph(Gkern, params={'num_kmeans_clusters': 4, "num_pca_components": 6, "num_batch":500, 'num_att_kmeans_clusters': 5})

# Generate 20 walks from each node
walks = walk_as_string(G, componentLabels = y, params={'num_walks': 20, 'walk_length': 30})

See Demonstration.ipynb for more details

Testing

Run python3 -m unittest test.py

License

This project is licensed under the MIT License - see the LICENSE.md file for details.

Third party libraries used include:

      graphwave
      Copyright 2018 contributors at Stanford
      https://github.com/snap-stanford/graphwave
      MIT License

      node2vec
      Copyright (c) 2016 Aditya Grover
      https://github.com/aditya-grover/node2vec
      MIT License

      fast.ai
      Copyright 2017 onwards, fast.ai, Inc.
      https://github.com/fastai/fastai
      Apache License, Version 2.0

Third party dataset downloaded from this site: https://ls11-www.cs.tu-dortmund.de/staff/morris/graphkerneldatasets

About

Randomly walk over graphs to generate language model inputs

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published