Skip to main content

A library for building scalable graph neural networks in TensorFlow.

Project description

TensorFlow GNN

This is an early (alpha) release to get community feedback. It's under active development and we may break API compatibility in the future.

NOTE: 2023/01/11: Release 0.4.1 was yanked due to a broken merge that passed through our tests. Release 0.4.0 still works, and we are working on a new release, stay tuned.

TensorFlow GNN is a library to build Graph Neural Networks on the TensorFlow platform. It contains the following components:

  • A high-level Keras-style API to create GNN models that can easily be composed with other types of models. GNNs are often used in combination with ranking, deep-retrieval (dual-encoders) or mixed with other types of models (image, text, etc.)

  • GNN API for heterogeneous graphs. Many of the graph problems we approach at Google and in the real world contain different types of nodes and edges. Hence the emphasis in heterogeneous models.

  • A well-defined schema to declare the topology of a graph, and tools to validate it. It describes the shape of its training data and serves to guide other tools.

  • A GraphTensor composite tensor type which holds graph data, can be batched, and has efficient graph manipulation functionality available.

  • A library of operations on the GraphTensor structure:

    • Various efficient broadcast and pooling operations on nodes and edges, and related tools.

    • A library of standard baked convolutions, that can be easily extended by ML engineers/researchers.

    • A high-level API for product engineers to quickly build GNN models without necessarily worrying about its details.

  • A set of tools used to convert graph datasets and sample from large graphs.

  • An encoding of graph-shaped training data on file, as well as a library used to parse this data into a data structure your model can extract the various features.

This library is an OSS port of a Google internal library used in a broad variety of contexts, on homogeneous and heterogeneous graphs, and in conjunction with other scalable graph mining tools.

For more details, please see our documentation. For background and discussion, please see O. Ferludin et al.: TF-GNN: Graph Neural Networks in TensorFlow, 2022 (full citation below).

Installation Instructions

Latest available pip wheel.

pip install tensorflow_gnn

Installation from source.

A virtual environment is highly recommended.

  1. Clone tensorflow_gnn

    $> git clone https://github.com/tensorflow/gnn.git tensorflow_gnn

  2. Install TensorFlow

    TF-GNN currently uses tf.ExtensionTypes, which is a feature of TensorFlow 2.7. As such, you will need to install TensorFlow build, following the instructions here: https://www.tensorflow.org/install/pip.

    $> pip install tensorflow

  3. Install Bazel

    Bazel is required to build the source of this package. Follow the instructions here to install Bazel for your OS: https://docs.bazel.build/versions/main/install.html

  4. Install tensorflow_gnn

    $> cd tensorflow_gnn && python3 -m pip install .

Citation

When referencing this library in a paper, please cite the TF-GNN paper:

@article{tfgnn,
  author  = {Oleksandr Ferludin and Arno Eigenwillig and Martin Blais and
             Dustin Zelle and Jan Pfeifer and Alvaro Sanchez{-}Gonzalez and
             Sibon Li and Sami Abu{-}El{-}Haija and Peter Battaglia and
             Neslihan Bulut and Jonathan Halcrow and
             Filipe Miguel Gon{\c{c}}alves de Almeida and Silvio Lattanzi and
             Andr{\'{e}} Linhares and Brandon Mayer and Vahab Mirrokni and
             John Palowitch and Mihir Paradkar and Jennifer She and
             Anton Tsitsulin and Kevin Villela and Lisa Wang and David Wong and
             Bryan Perozzi},
  title   = {{TF-GNN:} Graph Neural Networks in TensorFlow},
  journal = {CoRR},
  volume  = {abs/2207.03522},
  year    = {2022},
  url     = {http://arxiv.org/abs/2207.03522},
}

Project details


Download files

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

Source Distribution

tensorflow-gnn-0.5.0rc0.tar.gz (407.7 kB view details)

Uploaded Source

Built Distribution

tensorflow_gnn-0.5.0rc0-py3-none-any.whl (560.5 kB view details)

Uploaded Python 3

File details

Details for the file tensorflow-gnn-0.5.0rc0.tar.gz.

File metadata

  • Download URL: tensorflow-gnn-0.5.0rc0.tar.gz
  • Upload date:
  • Size: 407.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.15

File hashes

Hashes for tensorflow-gnn-0.5.0rc0.tar.gz
Algorithm Hash digest
SHA256 4f5134404ffd9fb5ef132f8da597e540043053e2bede067711c2f1eefe5b0c7c
MD5 aabfe0922f4aa7181eaaf2aa8dc63120
BLAKE2b-256 7cdc9c8915e92d5c05445b85aa93b19b979d81b8b34c68cb63fb5023cf53010a

See more details on using hashes here.

File details

Details for the file tensorflow_gnn-0.5.0rc0-py3-none-any.whl.

File metadata

File hashes

Hashes for tensorflow_gnn-0.5.0rc0-py3-none-any.whl
Algorithm Hash digest
SHA256 9773f5639c652f67270b68cd390cf378fb0cb7281f47346f903c49b352809096
MD5 c589d26a027101dd4c9e59518ee30ba1
BLAKE2b-256 c9449cf02aba482351435601243abbf15da963e507e3922da9c41032f2a90133

See more details on using hashes here.

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