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

mlx-graphs is available on Pypi. To install run

pip install mlx-graphs

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.2

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.2
File Size Uploaded
mlx-graphs-0.0.2.tar.gz 23.1 kB Details

Built distribution (wheel)

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

Total release size: 52.0 kB

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

Download URL mlx-graphs-0.0.2.tar.gz
Size 23.1 kB
Tags Source
SHA-256 checksum
How to use checksums
482fca7b41f13d76697cda0b419f096f3229175da0130093cbc895949e87bcbc
BLAKE2b-256 checksum
How to use checksums
207e9f8270b2faa0819b979621208465f52d8cdbb1b0dc0d943950d2b9be78a8
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.2-py3-none-any.whl

Download URL mlx_graphs-0.0.2-py3-none-any.whl
Size 28.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8cc77195705898f806124e9aee836d722472128c21d11b98d8f3f2b056a6b001
BLAKE2b-256 checksum
How to use checksums
a35473e183e0afc40f74fd7127bb2292f4364ad034534ed2861f9326aeb73054
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

This release

0.0.2 This release

2 release files

0.0.1

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