Skip to main content

Graph Neural Network Tensorflow implementation

Project description

This repo contains a Tensorflow implementation of the Graph Neural Network model.



The GNN framework requires the packages tensorflow, numpy, scipy.

To install the requirements you can use the following command

pip install -U -r requirements.txt

Install the latest version of GNN:

pip install gnn

For additional details, please see Install.

Simple usage example

import gnn.GNN as GNN
import gnn.gnn_utils
import Net as n

# Provide your own functions to generate input data
inp, arcnode, nodegraph, labels = set_load()

# Create the state transition function, output function, loss function and  metrics
net = n.Net(input_dim, state_dim, output_dim)

# Create the graph neural network model
g = GNN.GNN(net, input_dim, output_dim, state_dim)


for j in range(0, num_epoch):
    g.Train(inp, arcnode, labels, count, nodegraph)

    # Validate
    print(g.Validate(inp_val, arcnode_val, labels_val, count, nodegraph_val))


To cite the GNN implementation please use the following publication:

Rossi, A., Tiezzi, M., Dimitri, G.M., Bianchini, M., Maggini, M., & Scarselli, F. (2018).
"Inductive–Transductive Learning with Graph Neural Networks",
In Artificial Neural Networks in Pattern Recognition (pp.201-212).
Berlin : Springer-Verlag.


  title={Inductive--Transductive Learning with Graph Neural Networks},
  author={Rossi, Alberto and Tiezzi, Matteo and Dimitri, Giovanna Maria and Bianchini, Monica and Maggini, Marco and Scarselli, Franco},
  booktitle={IAPR Workshop on Artificial Neural Networks in Pattern Recognition},

To cite GNN please use the following publication:

F. Scarselli, M. Gori,  A. C. Tsoi, M. Hagenbuchner, G. Monfardini,
"The Graph Neural Network Model", IEEE Transactions on Neural Networks,
vol. 20(1); p. 61-80, 2009.


  title={The Graph Neural Network Model},
  author={Franco Scarselli and Marco Gori and Ah Chung Tsoi and Markus Hagenbuchner and Gabriele Monfardini},
  journal={IEEE Transactions on Neural Networks},


Released under the 3-Clause BSD license (see LICENSE.txt):

Copyright (C) 2004-2019 Matteo Tiezzi
Matteo Tiezzi <>
Alberto Rossi <>

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release. See tutorial on generating distribution archives.

Built Distribution

gnn-1.1.9-py3-none-any.whl (11.3 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page