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. For more information, refer our docs.

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.23.tar.gz (6.2 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.23-cp313-cp313-win_amd64.whl (313.6 kB view details)

Uploaded CPython 3.13Windows x86-64

graph_id_core-0.1.23-cp313-cp313-manylinux_2_28_x86_64.manylinux_2_27_x86_64.whl (350.5 kB view details)

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

graph_id_core-0.1.23-cp313-cp313-macosx_15_0_arm64.whl (288.3 kB view details)

Uploaded CPython 3.13macOS 15.0+ ARM64

graph_id_core-0.1.23-cp312-cp312-win_amd64.whl (313.6 kB view details)

Uploaded CPython 3.12Windows x86-64

graph_id_core-0.1.23-cp312-cp312-manylinux_2_28_x86_64.manylinux_2_27_x86_64.whl (350.5 kB view details)

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

graph_id_core-0.1.23-cp312-cp312-macosx_15_0_arm64.whl (288.4 kB view details)

Uploaded CPython 3.12macOS 15.0+ ARM64

graph_id_core-0.1.23-cp311-cp311-win_amd64.whl (310.0 kB view details)

Uploaded CPython 3.11Windows x86-64

graph_id_core-0.1.23-cp311-cp311-manylinux_2_28_x86_64.manylinux_2_27_x86_64.whl (349.9 kB view details)

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

graph_id_core-0.1.23-cp311-cp311-macosx_15_0_arm64.whl (288.1 kB view details)

Uploaded CPython 3.11macOS 15.0+ ARM64

File details

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

File metadata

  • Download URL: graph_id_core-0.1.23.tar.gz
  • Upload date:
  • Size: 6.2 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.23.tar.gz
Algorithm Hash digest
SHA256 aef8405560d59fa8ebad39da8c32fc6ee33da47022648715370a26df02770cea
MD5 5ef7dab5b6cbdb5ea5923e2cf66aaac4
BLAKE2b-256 bf8c6b890178d4554caa63b5245298dce2dc2cfa8af61827d04faf8dba0015a8

See more details on using hashes here.

Provenance

The following attestation bundles were made for graph_id_core-0.1.23.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.23-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for graph_id_core-0.1.23-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 f0818ec24cafeebcc33c6f5518f4d84ed11edd443460e500461a7ac9acda66c6
MD5 d69ce81fc217842ba774f00fdf94745c
BLAKE2b-256 8921c447ef89f6fac5a156cf4db32c2c388f8f997109bfcfefea8dc829b8d5ea

See more details on using hashes here.

Provenance

The following attestation bundles were made for graph_id_core-0.1.23-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.23-cp313-cp313-manylinux_2_28_x86_64.manylinux_2_27_x86_64.whl.

File metadata

File hashes

Hashes for graph_id_core-0.1.23-cp313-cp313-manylinux_2_28_x86_64.manylinux_2_27_x86_64.whl
Algorithm Hash digest
SHA256 3f21762fc2b707f0dfff27c5119899b659d6146930ae27e0d90f910dc9f66b37
MD5 08427845a4515e1458937bee79652e03
BLAKE2b-256 7950e9b16c6a3f2b2a23921a2bea6045d66a53124dafbab752d5343eb0e3673a

See more details on using hashes here.

Provenance

The following attestation bundles were made for graph_id_core-0.1.23-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.23-cp313-cp313-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for graph_id_core-0.1.23-cp313-cp313-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 efc2121fe579aa23d2ad4f2c952041d2027a5ffe3117adf46306d03c3e6b063c
MD5 9dd23de8cfc28458ca260575d094586e
BLAKE2b-256 339d5bf941b8af67638f8d28861168e3e751b4916bf6fd12793ff16808686ac6

See more details on using hashes here.

Provenance

The following attestation bundles were made for graph_id_core-0.1.23-cp313-cp313-macosx_15_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.23-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for graph_id_core-0.1.23-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 f6a7cc47d9634ded4ebcdc78b110288e294becf0e5d3978866e9cdfbf3419e0f
MD5 04b5b7c0b6b1d4534b0f0800d35a1f91
BLAKE2b-256 c8891a324697035a4d1da45dc1b461a36872041906c147fee232979f73629481

See more details on using hashes here.

Provenance

The following attestation bundles were made for graph_id_core-0.1.23-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.23-cp312-cp312-manylinux_2_28_x86_64.manylinux_2_27_x86_64.whl.

File metadata

File hashes

Hashes for graph_id_core-0.1.23-cp312-cp312-manylinux_2_28_x86_64.manylinux_2_27_x86_64.whl
Algorithm Hash digest
SHA256 89f03db4bb9040d415f11e9368ef8326986ce07e32855ff39bd1163d9bd6ba79
MD5 e3e4ace82a3f022d3314829ed1711a65
BLAKE2b-256 b4469cfd3a00d0ce2d6836dcc8fe0b9ec4c4b019801944260da742680930ef02

See more details on using hashes here.

Provenance

The following attestation bundles were made for graph_id_core-0.1.23-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.23-cp312-cp312-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for graph_id_core-0.1.23-cp312-cp312-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 73a04ac3f7e34c8f4ed25c99f50a22856a690f02fe6c6657fa9864fef7517243
MD5 fb0e2c8a91f12c779dc24666847367f2
BLAKE2b-256 9dd2ed910c8e52ebe82c84d35cfb693de7a6d3850ff14ea801f8422944212531

See more details on using hashes here.

Provenance

The following attestation bundles were made for graph_id_core-0.1.23-cp312-cp312-macosx_15_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.23-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for graph_id_core-0.1.23-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 a7da5ef98b00e247e6e05811b759b0018843714376b8b9ab028ea9bd35ee1011
MD5 e675fdb775e09f144a3dd8f1e1a525fb
BLAKE2b-256 65036aaf872d17e49bf94abf5a1dcb56694fc4d55f2419621d7edbfa67d8c436

See more details on using hashes here.

Provenance

The following attestation bundles were made for graph_id_core-0.1.23-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.23-cp311-cp311-manylinux_2_28_x86_64.manylinux_2_27_x86_64.whl.

File metadata

File hashes

Hashes for graph_id_core-0.1.23-cp311-cp311-manylinux_2_28_x86_64.manylinux_2_27_x86_64.whl
Algorithm Hash digest
SHA256 ea3d22803779c4deca7cf81f5596daa1f2ff080b02287e9122c1e0a47bbd68d0
MD5 37380d9ebfe7ed98a939720f94986c5f
BLAKE2b-256 1b1b3f7ad211f8fe5a251eba77e6bfa2558199cb9293237b2b8c76efae507466

See more details on using hashes here.

Provenance

The following attestation bundles were made for graph_id_core-0.1.23-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.23-cp311-cp311-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for graph_id_core-0.1.23-cp311-cp311-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 61e91fad9d72c5d5036568b601ef737212597fb0a0d1fa7f90716bc742918eb3
MD5 21c602e7c0e834a656c162e77d76cebb
BLAKE2b-256 c79f9585d2afee7b9a76d2947b8e425f2a7498475eb027d3feb4c3d85ac943b7

See more details on using hashes here.

Provenance

The following attestation bundles were made for graph_id_core-0.1.23-cp311-cp311-macosx_15_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