Skip to content
StellarGraph - Machine Learning on Graphs
Branch: develop
Clone or download
Latest commit cb6aabc Apr 18, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.buildkite
.github
demos Updated notebook to address reviewer comments. Apr 18, 2019
docs Hotfix/gcn-doc (#341) Mar 12, 2019
stellargraph Returned value for A after raising to the k-th power is now a scipy.s… Apr 3, 2019
tests Black formatting. Apr 15, 2019
.gitignore add vim swp files and session (#369) Apr 18, 2019
.readthedocs.yaml
AUTHORS
CHANGELOG.md
CONTRIBUTING.md update CLA requirement Mar 26, 2019
CONTRIBUTORS Update CONTRIBUTORS Mar 15, 2019
LICENSE
MANIFEST.in Added MANIFEST.in and CONTRIBUTING.md, changed setup.py and README.md Aug 22, 2018
README.md
requirements.txt
setup.py Increased minimum Keras version required to 2.2.3 Mar 11, 2019
stellar-graph-banner.png run imageoptim on banner image (#370) Apr 18, 2019

README.md

StellarGraph Machine Learning library logo

StellarGraph Machine Learning Library

Table of Contents

Introduction

StellarGraph is a Python library for machine learning on graph-structured (or equivalently, network-structured) data.

Graph-structured data represent entities, e.g., people, as nodes (or equivalently, vertices), and relationships between entities, e.g., friendship, as links (or equivalently, edges). Nodes and links may have associated attributes such as age, income, and time when a friendship was established, etc. StellarGraph supports analysis of both homogeneous networks (with nodes and links of one type) and heterogeneous networks (with more than one type of nodes and/or links).

The StellarGraph library implements several state-of-the-art algorithms for applying machine learning methods to discover patterns and answer questions using graph-structured data.

The StellarGraph library can be used to solve tasks using graph-structured data, such as:

  • Representation learning for nodes and edges, to be used for visualisation and various downstream machine learning tasks;
  • Classification and attribute inference of nodes or edges;
  • Link prediction.

We provide examples of using StellarGraph to solve such tasks using several real-world datasets.

Guiding Principles

StellarGraph uses the Keras library and adheres to the same guiding principles as Keras: user-friendliness, modularity, and easy extendability. Modules and layers of StellarGraph library are designed so that they can be used together with standard Keras layers and modules, if required. This enables flexibility in using existing or creating new models and workflows for machine learning on graphs.

Getting Started

To get started with StellarGraph you'll need data structured as a homogeneous or heterogeneous graph, including attributes for the entities represented as graph nodes. NetworkX is used to represent the graph and Pandas or Numpy are used to store node attributes.

Detailed and narrated examples of various machine learning workflows on network data, supported by StellarGraph, from data ingestion into graph structure to inference, are given in the demos directory of this repository.

Installation

StellarGraph is a Python 3 library and requires Python version 3.6 to function (note that the library uses Keras with the Tensorflow backend, and thus does not currently work in python 3.7). The required Python version can be downloaded and installed from python.org. Alternatively, use the Anaconda Python environment, available from anaconda.com.

The StellarGraph library can be installed in one of two ways, described next.

Install StellarGraph using pip:

To install StellarGraph library from PyPi using pip, execute the following command:

pip install stellargraph

Some of the examples require installing additional dependencies as well as stellargraph. To install these dependencies using pip, execute the following command:

pip install stellargraph[demos]

Install StellarGraph from Github source:

First, clone the StellarGraph repository using git:

git clone https://github.com/stellargraph/stellargraph.git

Then, cd to the StellarGraph folder, and install the library by executing the following commands:

cd stellargraph
pip install -r requirements.txt
pip install .

Running the examples

See the README in the demos directory for more information about the examples and how to run them.

Algorithms

The StellarGraph library currently includes the following algorithms for graph machine learning:

  • GraphSAGE [1]

    • Supports supervised as well as unsupervised representation learning, node classification/regression, and link prediction for homogeneous networks. The current implementation supports multiple aggregation methods, including mean, maxpool, meanpool, and attentional aggregators.
  • HinSAGE

    • Extension of GraphSAGE algorithm to heterogeneous networks. Supports representation learning, node classification/regression, and link prediction/regression for heterogeneous graphs. The current implementation supports mean aggregation of neighbour nodes, taking into account their types and the types of links between them.
  • GAT

    • Graph ATtention Network algorithm [4] for homogeneous graphs. The implementation supports representation learning and node classification for homogeneous graphs.
  • GCN

    • Graph Convolutional Network algorithm [5] for homogeneous graphs. The implementation supports representation learning and node classification for homogeneous graphs.
  • SGC

    • Simplified Graph Convolutional network algorithm [6] for homogeneous graphs. The implementation supports representation learning and node classification for homogeneous graphs.
  • Node2Vec [2]

    • Unsupervised representation learning for homogeneous networks, taking into account network structure while ignoring node attributes. The node2vec algorithm is implemented by combining StellarGraph's random walk generator with the word2vec algorithm from Gensim. Learned node representations can be used in downstream machine learning models implemented using Scikit-learn, Keras, Tensorflow or any other Python machine learning library.
  • Metapath2Vec [3]

    • Unsupervised, metapath-guided representation learning for heterogeneous networks, taking into account network structure while ignoring node attributes. The implementation combines StellarGraph's metapath-guided random walk generator and Gensim word2vec algorithm. As with node2vec, the learned node representations (node embeddings) can be used in downstream machine learning models to solve tasks such as node classification, link prediction, etc, for heterogeneous networks.

Getting Help

Documentation for StellarGraph can be found here.

Discourse Community

Feel free to ask questions and discuss problems on the StellarGraph Discourse forum.

CI

buildkite integration

Pipeline is defined in .buildkite/pipeline.yml

Docker images

  • Tests: Uses the official python:3.6 image.
  • Style: Uses black from the stellargraph docker hub organisation.

Citing

StellarGraph is designed, developed and supported by CSIRO's Data61. If you use any part of this library in your research, please cite it using the following BibTex entry

@misc{StellarGraph,
  author = {CSIRO's Data61},
  title = {StellarGraph Machine Learning Library},
  year = {2018},
  publisher = {GitHub},
  journal = {GitHub Repository},
  howpublished = {\url{https://github.com/stellargraph/stellargraph}},
}

References

  1. Inductive Representation Learning on Large Graphs. W.L. Hamilton, R. Ying, and J. Leskovec arXiv:1706.02216 [cs.SI], 2017. (link)

  2. Node2Vec: Scalable Feature Learning for Networks. A. Grover, J. Leskovec. ACM SIGKDD International Conference on Knowledge Discovery and Data Mining (KDD), 2016. (link)

  3. Metapath2Vec: Scalable Representation Learning for Heterogeneous Networks. Yuxiao Dong, Nitesh V. Chawla, and Ananthram Swami. ACM SIGKDD International Conference on Knowledge Discovery and Data Mining (KDD), 135–144, 2017 (link)

  4. Graph Attention Networks. P. Velickovic et al. ICLR 2018 (link)

  5. Graph Convolutional Networks (GCN): Semi-Supervised Classification with Graph Convolutional Networks. Thomas N. Kipf, Max Welling. International Conference on Learning Representations (ICLR), 2017 (link)

  6. Simplifying Graph Convolutional Networks. F. Wu, T. Zhang, A. H. de Souza, C. Fifty, T. Yu, and K. Q. Weinberger. arXiv:1902.07153. (link)

You can’t perform that action at this time.