All Projects → xgfs → Deepwalk C

xgfs / Deepwalk C

Licence: mit
DeepWalk implementation in C++

Projects that are alternatives of or similar to Deepwalk C

Rgl
RGL is a framework for graph data structures and algorithms in Ruby.
Stars: ✭ 279 (+217.05%)
Mutual labels:  graph, graph-algorithms
Competitive coding
This repository contains some useful codes, techniques, algorithms and problem solutions helpful in Competitive Coding.
Stars: ✭ 393 (+346.59%)
Mutual labels:  graph, graph-algorithms
Ngraph.graph
Graph data structure in JavaScript
Stars: ✭ 295 (+235.23%)
Mutual labels:  graph, graph-algorithms
Grakn
TypeDB: a strongly-typed database
Stars: ✭ 2,947 (+3248.86%)
Mutual labels:  graph, graph-algorithms
Lightgraphs.jl
An optimized graphs package for the Julia programming language
Stars: ✭ 611 (+594.32%)
Mutual labels:  graph, graph-algorithms
Graph Data Science
Source code for the Neo4j Graph Data Science library of graph algorithms.
Stars: ✭ 251 (+185.23%)
Mutual labels:  graph, graph-algorithms
Communities
Library of community detection algorithms and visualization tools
Stars: ✭ 348 (+295.45%)
Mutual labels:  graph, graph-algorithms
Hgp Sl
Hierarchical Graph Pooling with Structure Learning
Stars: ✭ 159 (+80.68%)
Mutual labels:  graph, graph-algorithms
Swiftgraph
A Graph Data Structure in Pure Swift
Stars: ✭ 588 (+568.18%)
Mutual labels:  graph, graph-algorithms
Littleballoffur
Little Ball of Fur - A graph sampling extension library for NetworKit and NetworkX (CIKM 2020)
Stars: ✭ 505 (+473.86%)
Mutual labels:  graph, graph-algorithms
Yfiles For Html Demos
Contains demo sources for the JavaScript diagramming library yFiles for HTML
Stars: ✭ 202 (+129.55%)
Mutual labels:  graph, graph-algorithms
Leaderboardx
A tool for building graphs quickly
Stars: ✭ 13 (-85.23%)
Mutual labels:  graph, graph-algorithms
Quiver
A reasonable library for modeling multi-graphs in Scala
Stars: ✭ 195 (+121.59%)
Mutual labels:  graph, graph-algorithms
Javascript Datastructures Algorithms
📚 collection of JavaScript and TypeScript data structures and algorithms for education purposes. Source code bundle of JavaScript algorithms and data structures book
Stars: ✭ 3,221 (+3560.23%)
Mutual labels:  graph, graph-algorithms
Libgrape Lite
🍇 A C++ library for parallel graph processing 🍇
Stars: ✭ 169 (+92.05%)
Mutual labels:  graph, graph-algorithms
Vivagraphjs
Graph drawing library for JavaScript
Stars: ✭ 3,442 (+3811.36%)
Mutual labels:  graph, graph-algorithms
Data Structures
Common data structures and algorithms implemented in JavaScript
Stars: ✭ 139 (+57.95%)
Mutual labels:  graph, graph-algorithms
Sparkling Graph
SparklingGraph provides easy to use set of features that will give you ability to proces large scala graphs using Spark and GraphX.
Stars: ✭ 139 (+57.95%)
Mutual labels:  graph, graph-algorithms
C Sharp Algorithms
📚 📈 Plug-and-play class-library project of standard Data Structures and Algorithms in C#
Stars: ✭ 4,684 (+5222.73%)
Mutual labels:  graph, graph-algorithms
Fxgraphalgorithmsimulator
Visualizes specific Graph Algorithms like BFS, DFS, MST etc. on interactive user input graphs.
Stars: ✭ 22 (-75%)
Mutual labels:  graph, graph-algorithms

deepwalk-c

DeepWalk implementation in C++. DeepWalk uses short random walks to learn representations for vertices in unweighted graphs.

Installation and usage

For C++ executable:

cd src && make;

should be enough on most platforms. If you need to change the default compiler (i.e. to Intel), use:

make CXX=icpc

Intel® FMA availability is crucial for performance of the implementation, meaning the processor Haswell (2013). You will get a warning on runtime if your processor does not support it.

Usage

Usage: deepwalk [OPTIONS]

Options:
  -input PATH                    Input file in binary CSR format
  -output PATH                   Output file, written in binary
  -threads INT                   Number of threads to use (default 1)
                                   Note: hyperthreading helps as well
  -dim INT                       DeepWalk parameter d: dimensionality of
                                   embeddings (default 128)
  -nwalks INT                    DeepWalk parameter gamma: number of walks per
                                   node (default 80)
  -walklen INT                   DeepWalk parameter t: length of random walk
                                   from each node(default 80)
  -window INT                    DeepWalk parameter w: window size (default 10)
  -nprwalks INT                  Implementation parameter w: number of random
                                   walks for HSM tree (default 100)
  -lr FLOAT                      Initial learning rate
  -seed INT                      Sets the random number generator seed to INT
  -verbose INT                   Controls verbosity level in [0,1,2], 0 meaning
                                   nothing will be displayed, and 2 mening
                                   training progress will be displayed.

Graph format

This implementation uses a custom graph format, namely binary compressed sparse row (BCSR) format for efficiency and reduced memory usage. Converter for three common graph formats (MATLAB sparse matrix, adjacency list, edge list) can be found in the root directory of the project. Usage:

$ convert-bcsr --help
Usage: convert-bcsr [OPTIONS] INPUT OUTPUT

  Converter for three common graph formats (MATLAB sparse matrix, adjacency
  list, edge list) can be found in the root directory of the project.

Options:
  --format [mat|edgelist|adjlist]
                                  File format of input file
  --matfile-variable-name TEXT    variable name of adjacency matrix inside a
                                  .mat file.
  --undirected / --directed       Treat graph as undirected.
  --sep TEXT                      Separator of input file
  --help                          Show this message and exit.
  1. --format adjlist for an adjacency list, e.g:

     1 2 3 4 5 6 7 8 9 11 12 13 14 18 20 22 32
     2 1 3 4 8 14 18 20 22 31
     3 1 2 4 8 9 10 14 28 29 33
     ...
    
  2. --format edgelist for an edge list, e.g:

     1 2
     1 3
     1 4
     ...
    
  3. --format mat for a Matlab MAT file containing an adjacency matrix (note, you must also specify the variable name of the adjacency matrix --matfile-variable-name)

Why

Official implementation of DeepWalk is not maintained. To reproduce the results, one would need to install very old scipy and gensim versions. That confuses researchers and other people wanting to tinker with the code. Also, Cython word2vec implementation is known to scale worse with the number of cores.

Implementation differences

Even though the algorithm claims to be 'online', hierarchical softmax tree must be constructed from the random walk corpora prior to training. Here, we run a serie of random walks and count vertex statistics to initialize the hierarchical softmax tree. The original strategy can be used by compiling with the INIT_HSM=2 flag.

Performance

Measured on i7-5930k. Blogcatalog graph (n=10312) with default parameters (gamma=80, t=80, d=128, w=10):

Version 6 threads 12 threads
Original (cython) 395.41s 480.13s
This (c++) 137.34s 112.32s

Keep in mind that the original DeepWalk implementation keeps all the walks either in memory or on disk! Another benchmark with parameter set from node2vec paper (gamma=10, t=40, d=128, w=10) (meaning >16x less training data):

Version 6 threads 12 threads
Original (cython) 27.28s 32.24s
This (c++) 8.34s 6.84s

Citing

If you find DeepWalk useful in your research, we ask that you cite the original paper:

@inproceedings{Perozzi:2014:DOL:2623330.2623732,
    author = {Perozzi, Bryan and Al-Rfou, Rami and Skiena, Steven},
    title = {DeepWalk: Online Learning of Social Representations},
    booktitle = {Proceedings of the 20th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining},
    series = {KDD '14},
    year = {2014},
    isbn = {978-1-4503-2956-9},
    location = {New York, New York, USA},
    pages = {701--710},
    numpages = {10},
    url = {http://doi.acm.org/10.1145/2623330.2623732},
    doi = {10.1145/2623330.2623732},
    acmid = {2623732},
    publisher = {ACM},
    address = {New York, NY, USA},
    keywords = {deep learning, latent representations, learning with partial labels, network classification, online learning, social networks},
}

Contact

echo "%[email protected]=<2=<>5.27" | tr '#-)/->' '_-|'

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].