Spektral
Graph Neural Networks with Keras and Tensorflow 2.
Install / Use
/learn @danielegrattarola/SpektralREADME
Welcome to Spektral
Spektral is a Python library for graph deep learning, based on the Keras API and TensorFlow 2. The main goal of this project is to provide a simple but flexible framework for creating graph neural networks (GNNs).
You can use Spektral for classifying the users of a social network, predicting molecular properties, generating new graphs with GANs, clustering nodes, predicting links, and any other task where data is described by graphs.
Spektral implements some of the most popular layers for graph deep learning, including:
- Graph Convolutional Networks (GCN)
- Chebyshev convolutions
- GraphSAGE
- ARMA convolutions
- Edge-Conditioned Convolutions (ECC)
- Graph attention networks (GAT)
- Approximated Personalized Propagation of Neural Predictions (APPNP)
- Graph Isomorphism Networks (GIN)
- Diffusional Convolutions
and many others (see convolutional layers).
You can also find pooling layers, including:
- MinCut pooling
- DiffPool
- Top-K pooling
- Self-Attention Graph (SAG) pooling
- Global pooling
- Global gated attention pooling
- SortPool
Spektral also includes lots of utilities for representing, manipulating, and transforming graphs in your graph deep learning projects.
See how to get started with Spektral and have a look at the examples for some templates.
The source code of the project is available on Github.
Read the documentation here.
If you want to cite Spektral in your work, refer to our paper:
Graph Neural Networks in TensorFlow and Keras with Spektral<br> Daniele Grattarola and Cesare Alippi
Installation
Spektral is compatible with Python 3.6 and above, and is tested on the latest versions of Ubuntu, MacOS, and Windows. Other Linux distros should work as well.
The simplest way to install Spektral is from PyPi:
pip install spektral
To install Spektral from source, run this in a terminal:
git clone https://github.com/danielegrattarola/spektral.git
cd spektral
python setup.py install # Or 'pip install .'
To install Spektral on Google Colab:
! pip install spektral
New in Spektral 1.0
The 1.0 release of Spektral is an important milestone for the library and brings many new features and improvements.
If you have already used Spektral in your projects, the only major change that you need to be aware of is the new datasets API.
This is a summary of the new features and changes:
- The new
GraphandDatasetcontainers standardize how Spektral handles data. This does not impact your models, but makes it easier to use your data in Spektral. - The new
Loaderclass hides away all the complexity of creating graph batches. Whether you want to write a custom training loop or use Keras' famous model-dot-fit approach, you only need to worry about the training logic and not the data. - The new
transformsmodule implements a wide variety of common operations on graphs, that you can nowapply()to your datasets. - The new
GeneralConvandGeneralGNNclasses let you build models that are, well... general. Using state-of-the-art results from recent literature means that you don't need to worry about which layers or architecture to choose. The defaults will work well everywhere. - New datasets: QM7 and ModelNet10/40, and a new wrapper for OGB datasets.
- Major clean-up of the library's structure and dependencies.
- New examples and tutorials.
Contributing
Spektral is an open-source project available on Github, and contributions of all types are welcome. Feel free to open a pull request if you have something interesting that you want to add to the framework.
The contribution guidelines are available here and a list of feature requests is available here.
Related Skills
claude-opus-4-5-migration
81.9kMigrate prompts and code from Claude Sonnet 4.0, Sonnet 4.5, or Opus 4.1 to Opus 4.5
model-usage
332.9kUse CodexBar CLI local cost usage to summarize per-model usage for Codex or Claude, including the current (most recent) model or a full model breakdown. Trigger when asked for model-level usage/cost data from codexbar, or when you need a scriptable per-model summary from codexbar cost JSON.
TrendRadar
49.7k⭐AI-driven public opinion & trend monitor with multi-platform aggregation, RSS, and smart alerts.🎯 告别信息过载,你的 AI 舆情监控助手与热点筛选工具!聚合多平台热点 + RSS 订阅,支持关键词精准筛选。AI 智能筛选新闻 + AI 翻译 + AI 分析简报直推手机,也支持接入 MCP 架构,赋能 AI 自然语言对话分析、情感洞察与趋势预测等。支持 Docker ,数据本地/云端自持。集成微信/飞书/钉钉/Telegram/邮件/ntfy/bark/slack 等渠道智能推送。
mcp-for-beginners
15.6kThis open-source curriculum introduces the fundamentals of Model Context Protocol (MCP) through real-world, cross-language examples in .NET, Java, TypeScript, JavaScript, Rust and Python. Designed for developers, it focuses on practical techniques for building modular, scalable, and secure AI workflows from session setup to service orchestration.
