Skip to main content

MLX-graphs

Documentation

MLX-graphs is a library for Graph Neural Networks (GNNs) built upon Apple's MLX.

Work in progress 🚧

We just started the development of this lib, with the aim to integrate it within ml-explore.

The lib follows the Message Passing Neural Network (MPNN) architecture to build arbitrary GNNs on top of it, similarly as in PyG.

Installation (build from source)

To build and install mlx-graphs from source start by cloning the github repo

git clone git@github.com:TristanBilot/mlx-graphs.git && cd mlx-graphs

Create a new virtual environment and install the requirements

pip install -e .

Usage

Graph data model

A graph is defined by a set of (optional) attributes

  1. edge_index: an array of size [2, num_edges] which specifies the topology of the graph. The i-th column in edge_index defines the source and destination nodes of the i-th edge
  2. node_features: an array of size [num_nodes, num_node_features] defining the features associated to each node (if any). The i-th row contains the features of the i-th node
  3. edge_features: an array of size [num_edges, num_edge_features] defining the features associated to each edge (if any). The i-th row contains the features of the i-th edge
  4. graph_features: an array of size [num_graph_features] defining the features associated to the graph itself

We adopt the above convention across the entire library both in terms of shapes of the attributes and the order in which they're provided to functions.

Contributing

Installing test, dev, benchmaks, docs dependencies

Extra dependencies are specified in the pyproject.toml. To install those required for testing, development and building documentation, you can run any of the following

pip install -e '.[test]'
pip install -e '.[dev]'
pip install -e '.[benchmarks]'
pip install -e '.[docs]'

For dev purposes you may want to install the current version of mlx via pip install mlx @ git+https://github.com/ml-explore/mlx.git

Testing

We encourage to write tests for all components. CI is currently not in place as runners with Apple Silicon are required. Please run pytest to ensure breaking changes are not introduced.

Pre-commit hooks (optional)

To ensure code quality you can run pre-commit hooks. Simply install them by running

pre-commit install

and run via pre-commit run --all-files.

Note: CI is in place to verify code quality, so pull requests that don't meet those requirements won't pass CI tests.

Why running GNNs on my Mac?

By leveraging Apple Silicon, running GNNs enjoys accelerated GPU computation ⚡️ and unified memory architecture. This eliminates device data transfers and enables leveraging all available memory to store large graphs directly on your Mac's GPU.

Why contributing?

We are at an early stage of the development of the lib, which means your contributions can have a large impact! Everyone is welcome to contribute, just open an issue 📝 with your idea 💡 and we'll work together on the implementation ✨.

Metadata

Release files for mlx-graphs 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mlx-graphs 0.0.1
File Size Uploaded
mlx-graphs-0.0.1.tar.gz 23.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mlx-graphs 0.0.1
File Interpreter ABI Platform
mlx_graphs-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 51.9 kB

Release files / mlx-graphs-0.0.1.tar.gz

Download URL mlx-graphs-0.0.1.tar.gz
Size 23.1 kB
Tags Source
SHA-256 checksum
How to use checksums
abed18f2f54811848e2c0b5b00f0e0f69b8156e579760ae270f73df419dfded8
BLAKE2b-256 checksum
How to use checksums
89dc89116c4d6c1705065b1b05281eade7b95bec7a3be5a8419f7f7adbe24e31
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.2 CPython/3.11.7

Release files / mlx_graphs-0.0.1-py3-none-any.whl

Download URL mlx_graphs-0.0.1-py3-none-any.whl
Size 28.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
26c43385b7c21109e1432ebd1ad6a6e2c6fb3c2dd67748890c8b39ad4cd8d2a7
BLAKE2b-256 checksum
How to use checksums
0adc848f44facb56fb5856e86a75f8298719eeb841274783f9c83295e2f58d85
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.2 CPython/3.11.7

Release history Release notifications | RSS feed

0.0.10

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

This release

0.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page