HeXtractor is a tool designed to automatically convert selected data in tabular format into a PyTorch Geometric heterogeneous graph. As research into graph neural networks (GNNs) expands, the importance of heterogeneous graphs grows. However, data often comes in tabular form, and manually transforming this data into graph format can be tedious and error-prone. HeXtractor aims to streamline this process, providing researchers and practitioners with a more efficient workflow.
This package has been reviewed and published in the Journal of Open Source Software (JOSS). You can find the paper here.
Wójcik et al., (2025). HeXtractor: Extracting Heterogeneous Graphs from Structured and Textual Data for Graph Neural Networks. Journal of Open Source Software, 10(110), 8057, https://doi.org/10.21105/joss.08057
- Automatic Conversion: Converts tabular data into heterogeneous graphs suitable for GNNs.
- Support for Multiple Formats: Handles various tabular data formats with ease.
- Integration with PyTorch Geometric: Directly creates graphs that can be used with PyTorch Geometric.
- isualization: Utilizes NetworkX and PyVis for graph visualization.
Heterogeneous graphs are crucial in many applications of graph neural networks, yet creating them from tabular data manually is often cumbersome. HeXtractor automates this process, allowing researchers to focus on developing and training their models instead of data preprocessing.
Key Applications:
- Transform single tabular datasets into heterogeneous graph structures.
- Transform multiple tables into a heterogeneous graph.
- Leverage Large Language Models (LLMs) to identify and extract semantic relationships from text, converting them into heterogeneous graph representations.
Python: The primary programming language used for HeXtractor.pandas: Utilized for data manipulation and handling tabular data.PyTorchGeometric: Framework for creating and working with graph neural networks.NetworkX: Used for creating and managing complex graph structures.PyVis: Enables interactive visualization of graphs.
HeXtractor can be installed either from PyPI (recommended for most users) or from source code (recommended for developers or if you need the latest features).
To install the latest version from PyPI run:
pip install hextractorTo install HeXtractor from source, you'll first need to clone the repository:
git clone https://github.com/maddataanalyst/hextractor.git
cd hextractorYou can then install it using either conda or any standard Python virtual environment. We use Poetry as our primary dependency manager because it provides robust dependency resolution, reproducible builds, and better package management.
- If you prefer Conda for environment management:
# Create a new conda environment from the provided file
conda env create -f environment.yml
# Activate the environment
conda activate hextractor
# Install poetry inside the conda environment
pip install poetry
# Install the package with all dependencies
poetry install --with dev --with research- Create and activate a virtual environment using your preferred method:
# Using venv (Python 3.3+)
python -m venv hextractor-env
source hextractor-env/bin/activate # On Windows: hextractor-env\Scripts\activate
# Or using virtualenv
virtualenv hextractor-env
source hextractor-env/bin/activate # On Windows: hextractor-env\Scripts\activate- Install Poetry and the package:
# Install poetry
pip install poetry
# Install the package with all dependencies
poetry install --with dev --with researchRemember to activate your environment (conda or virtual environment) whenever you want to use HeXtractor.
You can find an official, detailed documentation here.
Contributions are welcome, and they are greatly appreciated! Every little bit helps, and credit will always be given.
You can contribute in many ways:
- Reporting bugs;
- Fixing bugs;
- Implementing features;
- Writing documentation;
- Submitting feedback.
Detailed contribution and community guidelines can be found in the CONTRIBUTING.rst file.

