Skip to main content

No project description provided

Project description

PyPI version Python versions codecov

Graph ID

Graph ID is a universal identifier system for atomistic structures including crystals and molecules. It generates unique, deterministic identifiers based on the topological and compositional properties of atomic structures, enabling efficient structure comparison, database indexing, and materials discovery.

Overview

Graph ID works by:

  1. Converting atomic structures into graph representations where atoms are nodes and bonds are edges
  2. Analyzing the local chemical environment around each atom using compositional sequences
  3. Computing a hash-based identifier that captures both topology and composition
  4. Supporting various modes including topology-only comparisons and Wyckoff position analysis

Features

  • Universal Structure Identification: Generate unique IDs for any crystal or molecular structure
  • Topological Analysis: Option to generate topology-only IDs for structure type comparison
  • Wyckoff Position Support: Include crystallographic symmetry information in ID generation
  • Distance Clustering: Advanced clustering-based analysis for complex structures
  • C++ Performance: High-performance C++ backend with Python bindings
  • Multiple Neighbor Detection: Support for various neighbor-finding algorithms (MinimumDistanceNN, CrystalNN, etc.)

Installation

From PyPI

pip install graph-id-core
pip install graph-id-db  # optional database component

From Source

git clone https://github.com/kmu/graph-id-core.git
cd graph-id-core
git submodule update --init --recursive
pip install -e .

Quick Start

Basic Usage

from pymatgen.core import Structure, Lattice
from graph_id import GraphIDMaker

# Create a structure (NaCl)
structure = Structure.from_spacegroup(
    "Fm-3m",
    Lattice.cubic(5.692),
    ["Na", "Cl"],
    [[0, 0, 0], [0.5, 0.5, 0.5]]
)

# Generate Graph ID
maker = GraphIDMaker()
graph_id = maker.get_id(structure)
print(graph_id)  # Output: NaCl-88c8e156db1b0fd9

Loading from Files

from pymatgen.core import Structure
from graph_id_cpp import GraphIDGenerator

# Load structure from file
structure = Structure.from_file("path/to/structure.cif")
generator = GraphIDGenerator()
graph_id = generator.get_id(structure)

Advanced Configuration

from graph_id_cpp import GraphIDGenerator
from pymatgen.analysis.local_env import CrystalNN

# Topology-only comparison (ignores composition)
topo_gen = GraphIDGenerator(topology_only=True)
topo_id = topo_gen.get_id(structure)

# Include Wyckoff positions
wyckoff_gen = GraphIDGenerator(wyckoff=True)
wyckoff_id = wyckoff_gen.get_id(structure)

# Use different neighbor detection
crystal_gen = GraphIDGenerator(nn=CrystalNN())  # Faster CrystalNN using C++ is also available
crystal_id = crystal_gen.get_id(structure)

Search Structures from Database

Use graph-id-db to search structures in the Materials Project using precomputed Graph ID stored in graph-id-db

# pip install graph-id-db
from graph_id_cpp import GraphIDGenerator

from pymatgen.core import Structure, Lattice

structure = Structure.from_spacegroup(
    "Fm-3m",
    Lattice.cubic(5.692),
    ["Na", "Cl"],
    [[0, 0, 0], [0.5, 0.5, 0.5]]
).get_primitive_structure()
gen = GraphIDGenerator()
graph_id = gen.get_id(structure)
print(f"Graph ID of NaCl is {graph_id}")

from graph_id_db import Finder

# Search for structures in graph-id-db using GraphID
finder = Finder()
finder.find(graph_id)

Examples

More comprehensive examples can be found in the tests/ and examples/ directories.

Applications

Graph ID is particularly useful for:

  • Materials Databases: Efficient indexing and deduplication of structure databases
  • High-throughput Screening: Rapid identification of unique structures in computational workflows
  • Polymorph Identification: Distinguishing between different polymorphs of the same composition

Web Service (experimental)

You can search materials using Graph ID at matfinder.net.

Citation

If you use Graph ID in your research, please cite:

Muraoka, K., Tanimoto, T., Munekata, T. & Nakayama, A. Universal graph-based identifiers of chemical structures for linking large material databases. Nature Communications 17, 5409 (2026). https://doi.org/10.1038/s41467-026-74536-5

@article{muraoka2026graphid,
  title   = {Universal graph-based identifiers of chemical structures for linking large material databases},
  author  = {Muraoka, Koki and Tanimoto, Taku and Munekata, Tsubasa and Nakayama, Akira},
  journal = {Nature Communications},
  volume  = {17},
  number  = {1},
  pages   = {5409},
  year    = {2026},
  doi     = {10.1038/s41467-026-74536-5}
}

Developer's notes

This repo is managed by poetry.

Installation

  1. Clone the repository:
git clone https://github.com/kmu/graph-id-core.git
cd graph-id-core
  1. Initialize git submodules (required for the C++ build):
git submodule update --init --recursive
  1. Install the package and dependencies using Poetry:
poetry install
  1. Install pre-commit
pre-commit install

Note: The git submodules (library/pybind11, library/eigen, library/gtl) are required for building the C++ extension. Without them, the installation will fail during the CMake build step.

Testing

poetry install
poetry run pytest

If you have made changes to the C++ code, run poetry run pip install -e --force-reinstall to apply the changes before running the tests.

Releasing

  • Bump version in pyproject.toml.
  • Merge automatically created PR to merge main branch to release branch.

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

graph_id_core-0.1.22.tar.gz (5.6 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

graph_id_core-0.1.22-cp313-cp313-win_amd64.whl (297.3 kB view details)

Uploaded CPython 3.13Windows x86-64

graph_id_core-0.1.22-cp313-cp313-manylinux_2_28_x86_64.manylinux_2_27_x86_64.whl (306.9 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

graph_id_core-0.1.22-cp313-cp313-macosx_11_0_arm64.whl (262.1 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

graph_id_core-0.1.22-cp312-cp312-win_amd64.whl (297.3 kB view details)

Uploaded CPython 3.12Windows x86-64

graph_id_core-0.1.22-cp312-cp312-manylinux_2_28_x86_64.manylinux_2_27_x86_64.whl (306.9 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

graph_id_core-0.1.22-cp312-cp312-macosx_11_0_arm64.whl (262.1 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

graph_id_core-0.1.22-cp311-cp311-win_amd64.whl (296.8 kB view details)

Uploaded CPython 3.11Windows x86-64

graph_id_core-0.1.22-cp311-cp311-manylinux_2_28_x86_64.manylinux_2_27_x86_64.whl (307.6 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

graph_id_core-0.1.22-cp311-cp311-macosx_11_0_arm64.whl (262.6 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

File details

Details for the file graph_id_core-0.1.22.tar.gz.

File metadata

  • Download URL: graph_id_core-0.1.22.tar.gz
  • Upload date:
  • Size: 5.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for graph_id_core-0.1.22.tar.gz
Algorithm Hash digest
SHA256 9106acc5c4ad374d067ea5711b260187196b466caa1cfd5f0cb22dcd2068d5ac
MD5 8cbf18c7cbe7537bbde73a662a13d0bd
BLAKE2b-256 2d1de5ec24b34591b09b532eb9f4ab33c5ddee9bff4d4cbc08603daaa3c1ac25

See more details on using hashes here.

Provenance

The following attestation bundles were made for graph_id_core-0.1.22.tar.gz:

Publisher: release.yml on kmu/graph-id-core

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file graph_id_core-0.1.22-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for graph_id_core-0.1.22-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 3411f6d36daa3df3cfada6ca7d42eef262ef91f134baa6342594e65a95c724e2
MD5 a7a50ebccf2abf1ba8b459e6fa304c51
BLAKE2b-256 e200cf081e47dddb710f955fc9e3b71db27dcd58d0f7e578bcc3c5df65f44422

See more details on using hashes here.

Provenance

The following attestation bundles were made for graph_id_core-0.1.22-cp313-cp313-win_amd64.whl:

Publisher: release.yml on kmu/graph-id-core

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file graph_id_core-0.1.22-cp313-cp313-manylinux_2_28_x86_64.manylinux_2_27_x86_64.whl.

File metadata

File hashes

Hashes for graph_id_core-0.1.22-cp313-cp313-manylinux_2_28_x86_64.manylinux_2_27_x86_64.whl
Algorithm Hash digest
SHA256 c1f78025713d683811da700fd7b838c1af3d5158208df8c83592473cde66ee07
MD5 02cb2f2e22b154a15182df1c895c559a
BLAKE2b-256 336c2b006fc2824903e6776a5328cabf2c4e9c9c75049994a55285872ef9c4d9

See more details on using hashes here.

Provenance

The following attestation bundles were made for graph_id_core-0.1.22-cp313-cp313-manylinux_2_28_x86_64.manylinux_2_27_x86_64.whl:

Publisher: release.yml on kmu/graph-id-core

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file graph_id_core-0.1.22-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for graph_id_core-0.1.22-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c14593a9ffc68e3b7d772f85bab4e1a433f57b8af5da2c08b20b2525c58306d4
MD5 7f5592760ef58c73323e6685f5ed6529
BLAKE2b-256 3b39735b8a85a21c24aa8e4d927b28346ccbdbae6970098e405e4b8dbc08f6b7

See more details on using hashes here.

Provenance

The following attestation bundles were made for graph_id_core-0.1.22-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: release.yml on kmu/graph-id-core

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file graph_id_core-0.1.22-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for graph_id_core-0.1.22-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 5dc0aecd16d86620db22f5e5aedb0f0b4f8e635ab0787abe54e8416b42c7c086
MD5 231c001112149795385a99ac6b467a47
BLAKE2b-256 d711b343debc67d34af83a8013d34ed48625a31fddddd95e0af307289b27bde3

See more details on using hashes here.

Provenance

The following attestation bundles were made for graph_id_core-0.1.22-cp312-cp312-win_amd64.whl:

Publisher: release.yml on kmu/graph-id-core

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file graph_id_core-0.1.22-cp312-cp312-manylinux_2_28_x86_64.manylinux_2_27_x86_64.whl.

File metadata

File hashes

Hashes for graph_id_core-0.1.22-cp312-cp312-manylinux_2_28_x86_64.manylinux_2_27_x86_64.whl
Algorithm Hash digest
SHA256 7ba87b976c4d388571fda67ec28b33949f68854024b87d574e722e57121db070
MD5 8de0cfdba63a94bc51bef220ef85c3a0
BLAKE2b-256 d4de54f48f342c1808828b1649fa0b5f48f2d69cfd93def3c744a88b3356dd0f

See more details on using hashes here.

Provenance

The following attestation bundles were made for graph_id_core-0.1.22-cp312-cp312-manylinux_2_28_x86_64.manylinux_2_27_x86_64.whl:

Publisher: release.yml on kmu/graph-id-core

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file graph_id_core-0.1.22-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for graph_id_core-0.1.22-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1cb92f222b2d9643d83a07ffab6a34f4ba33d0bb8bd2abb4b7c1586109d5ace8
MD5 36cb5fd3731e61e0ede807b58d801cac
BLAKE2b-256 7538d8c3619323ea4c706c4927b04f4134c4027780c1f45731a708fa7fa4a9b8

See more details on using hashes here.

Provenance

The following attestation bundles were made for graph_id_core-0.1.22-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: release.yml on kmu/graph-id-core

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file graph_id_core-0.1.22-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for graph_id_core-0.1.22-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 cb7a9879ec38ea3bfb4dbbd1d654a10971b53963058964ede79d772d7b7a0901
MD5 9052bb2fb2c7cdfad86c6bf4f115f93f
BLAKE2b-256 53ad5c85d500a9a50092d6007e19eafeb83b5be1494e628b39f409f78f460120

See more details on using hashes here.

Provenance

The following attestation bundles were made for graph_id_core-0.1.22-cp311-cp311-win_amd64.whl:

Publisher: release.yml on kmu/graph-id-core

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file graph_id_core-0.1.22-cp311-cp311-manylinux_2_28_x86_64.manylinux_2_27_x86_64.whl.

File metadata

File hashes

Hashes for graph_id_core-0.1.22-cp311-cp311-manylinux_2_28_x86_64.manylinux_2_27_x86_64.whl
Algorithm Hash digest
SHA256 bbbee3131eb0c8bcf6cc980f644aeaaaad50e070c267c46001aef4f5934df359
MD5 640e78309ed16b52a98f9c3b461aec36
BLAKE2b-256 b72bd16b4dd511700add3003cc75bcb75123197f913ea03b6760d38a77a7126a

See more details on using hashes here.

Provenance

The following attestation bundles were made for graph_id_core-0.1.22-cp311-cp311-manylinux_2_28_x86_64.manylinux_2_27_x86_64.whl:

Publisher: release.yml on kmu/graph-id-core

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file graph_id_core-0.1.22-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for graph_id_core-0.1.22-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ebf171d58d932823e7cfb43e038cf3f918a87c124f2c485c4c58116186ecd962
MD5 71cc87ece8e115750846772306cae63c
BLAKE2b-256 62e99d1a1f44c3588a37ac43e9e3ecb3ac09d3af524ad9f0c0bd6443c284b795

See more details on using hashes here.

Provenance

The following attestation bundles were made for graph_id_core-0.1.22-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: release.yml on kmu/graph-id-core

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page