Code Monkey home page Code Monkey logo

segk's Introduction

Learning Structural Node Representations using Graph Kernels

Code for the paper Learning Structural Node Representations using Graph Kernels.

Requirements

Code is written in Python 3.6 and requires:

  • grakel 0.1b7
  • scikit-learn 0.21

Basic Usage

To run SEGK on Barbell graph, execute the following command from the project home directory:
python segk.py --path-to-edgelist datasets/barbell.edgelist --path-to-output-file embeddings/barbell.txt

Hyperparameters

The following three hyperparameters can be specified:

  • radius: the maximum radius of the neighborhood subgraphs
  • dim: the dimensionality of the generated embeddings
  • kernel: the employed graph kernel (either the shortest path kernel or the weisfeiler lehman kernel)

Input

The supported input format is an edgelist where the endpoints are separated by the space character:

node1_id node2_id

Output

The output file contains n lines (where n is the number of nodes of the graph) as follows:

node_id dim1 dim2 ... dimd

where dim1, ... , dimd is the d-dimensional representation learned by SEGK.

Experiments

In the project home directory, there are four jupyter notebooks that reproduce the experiments presented in the paper.

Cite

Please cite our paper if you use this code:

@article{nikolentzos2019learning,
  title={Learning Structural Node Representations using Graph Kernels},
  author={Nikolentzos, Giannis and Vazirgiannis, Michalis},
  journal={IEEE Transactions on Knowledge and Data Engineering},
  year={2019}
}

segk's People

Contributors

giannisnik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

qtguo

segk's Issues

No licence

Hi!

I'm doing research into network mining and node embeddings. I would like to use your SEGK algorithm as part of a benchmark suite for node embedding models.

However, I believe I am not legally entitled to use the code in this repo for any purpose since it is missing a licence.

Would you have the possibility to add a licence so that I can use your code and cite your paper?

Best,
Ciwan

Index Error: tuple index out of range

When running the algorithm on some of the graphs, I've encountered such error

Traceback (most recent call last):
  File "lib/segk/segk.py", line 108, in <module>
    main()
  File "lib/segk/segk.py", line 103, in main
    embeddings = segk(nodes, edgelist, args.radius, args.dim, args.kernel)

  File "lib/segk/segk.py", line 64, in segk
    Gs.append(Graph(edges, node_labels=node_labels))

  File "/home/ubuntu/RL/env/lib/python3.6/site-packages/grakel/graph.py", line 162, in __init__
    edge_labels)

  File "/home/ubuntu/RL/env/lib/python3.6/site-packages/grakel/graph.py", line 231, in build_graph
    self._import_adjacency(g)

  File "/home/ubuntu/RL/env/lib/python3.6/site-packages/grakel/graph.py", line 940, in _import_adjacency
    if n != adjacency_matrix.shape[1]:

IndexError: tuple index out of range

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.