# StellarGraph demos¶

StellarGraph provides numerous algorithms for graph machine learning. This folder contains demos of all of them to explain how they work and how to use them as part of a TensorFlow Keras data science workflow.

The demo notebooks can be run without any installation of Python by using Binder or Google Colab - these both provide a cloud-based notebook environment. The whole set of demos can be opened in Binder or you can click the Binder and Colab badges within each notebook.

## Find algorithms for a task¶

Introduction to StellarGraph and its graph machine learning workflow (with TensorFlow and Keras): GCN on Cora

Predicting attributes, such as classifying as a class or label, or regressing to calculate a continuous number:

For nodes/vertices/entities: node classification

For edges/links/connections: link prediction (includes knowledge graph completion)

For graphs/networks: graph classification

Adjusting predictions scores to be probabilities (for any model): calibration

Interpreting/introspecting models, for node classification: interpretability

Representation learning or computing embedding vectors (including unsupervised tasks):

For nodes/vertices/entities, edges/links/connections and graphs: embeddings

Time series or sequence prediction for nodes within a graph (including spatio-temporal data): time series

Ensembling models to reduce prediction variance: ensembles

Loading data into a

`StellarGraph`

object, with Pandas, NumPy, Neo4j or NetworkX: basicsExperimental: running GraphSAGE or Cluster-GCN on data stored in Neo4j: neo4j connector

## Find a demo for an algorithm¶

Algorithm |
Heterogeneous |
Directed |
Edge weights |
Time-varying, temporal |
Node features |
Inductive |
||||
---|---|---|---|---|---|---|---|---|---|---|

Graph Convolutional Network (GCN) |
see RGCN |
yes |
see T-GCN |
yes |
UnsupervisedSampler, DeepGraphInfomax |
see Cluster-GCN |
||||

Cluster-GCN |
yes |
yes |
yes |
yes |
||||||

Relational GCN (RGCN) |
multiple edges types |
yes |
yes |
yes |
||||||

Temporal GCN (T-GCN), implemented as GCN-LSTM |
node features |
time series, sequence |
||||||||

Graph ATtention Network (GAT) |
yes |
yes |
yes |
UnsupervisedSampler, DeepGraphInfomax |
||||||

Simplified Graph Convolution (SGC) |
yes |
yes |
yes |
|||||||

Personalized Propagation of Neural Predictions (PPNP) |
yes |
yes |
yes |
UnsupervisedSampler, DeepGraphInfomax |
||||||

Approximate PPNP (APPNP) |
yes |
yes |
yes |
UnsupervisedSampler, DeepGraphInfomax |
||||||

GraphWave |
via embedding vectors |
via embedding vectors |
||||||||

Attri2Vec |
yes |
yes |
||||||||

GraphSAGE |
see HinSAGE |
yes |
||||||||

HinSAGE |
yes |
yes |
yes |
yes |
||||||

Node2Vec |
via embedding vectors, keras layer, gensim |
|||||||||

Metapath2Vec |
yes |
via embedding vectors |
||||||||

Continuous-Time Dynamic Network Embeddings |
yes |
via embedding vectors |
yes |
|||||||

Watch Your Step |
via embedding vectors |
|||||||||

ComplEx |
multiple edges types |
yes |
via embedding vectors |
yes |
||||||

DistMult |
multiple edges types |
yes |
via embedding vectors |
yes |
||||||

Deep Graph CNN |
yes |
yes |

See the root README or each algorithm’s documentation for the relevant citation(s).

## Download the demos¶

You can run download a local copy of the demos using the `curl`

command below:

```
curl -L https://github.com/stellargraph/stellargraph/archive/master.zip | tar -xz --strip=1 stellargraph-master/demos
```

The dependencies required to run most of our demo notebooks locally can be installed using one of the following:

Using pip:

`pip install stellargraph[demos]`

Using conda:

`conda install -c stellargraph stellargraph`

## Table of contents¶

- StellarGraph basics
- Model calibration
- Connector
- Unsupervised representation learning
- Node representation learning with attri2vec
- Node representation learning with Deep Graph Infomax
- Unsupervised graph classification/representation learning via distances
- Node representation learning with GraphSAGE and UnsupervisedSampler
- Node representations with GraphWave
- Node2Vec representation learning with Stellargraph components
- Node representation learning with Metapath2Vec
- Node representation learning with Node2Vec
- Node representation learning with Watch Your Step

- Ensemble learning
- Graph classification
- Interpretability of node classification results
- Link prediction
- Link prediction via inductive node representations with attri2vec
- Knowledge graph link prediction with ComplEx
- Link prediction with Continuous-Time Dynamic Network Embeddings (CTDNE)
- Knowledge graph link prediction with DistMult
- Link prediction with GCN
- Link prediction with GraphSAGE
- Link prediction with Heterogeneous GraphSAGE (HinSAGE)
- Link prediction with Metapath2Vec
- Link prediction with Node2Vec

- Node classification
- Node classification via node representations with attri2vec
- Node classification with Cluster-GCN
- Node classification with directed GraphSAGE
- Node classification with Graph ATtention Network (GAT)
- Semi-supervised node classification via GCN, Deep Graph Infomax and fine-tuning
- Node classification with Graph Convolutional Network (GCN)
- Inductive node classification and representation learning using GraphSAGE
- Node classification with GraphSAGE
- Node classification with Node2Vec using Stellargraph components
- Node classification with Node2Vec
- Node classification with weighted Node2Vec
- Node classification with Personalised Propagation of Neural Predictions (PPNP) and Approximate PPNP (APPNP)
- Node classification with Relational Graph Convolutional Network (RGCN)
- Node classification with Simplified Graph Convolutions (SGC)

- Graphs with time series and sequence data
- StellarGraph internal development