{"id":21321700,"url":"https://github.com/akensert/molgraph","last_synced_at":"2025-07-12T05:30:29.140Z","repository":{"id":57840900,"uuid":"524111570","full_name":"akensert/molgraph","owner":"akensert","description":"Graph neural networks for molecular machine learning. Implemented and compatible with TensorFlow and Keras.","archived":false,"fork":false,"pushed_at":"2025-06-04T10:40:15.000Z","size":1815,"stargazers_count":54,"open_issues_count":0,"forks_count":5,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-04T17:15:19.477Z","etag":null,"topics":["bioinformatics","cheminformatics","computational-biology","computational-chemistry","deep-learning","graph-neural-networks","graphs","keras","machine-learning","tensorflow"],"latest_commit_sha":null,"homepage":"https://molgraph.readthedocs.io/en/latest/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/akensert.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-08-12T14:10:06.000Z","updated_at":"2025-06-04T10:40:18.000Z","dependencies_parsed_at":"2023-11-15T14:28:06.831Z","dependency_job_id":"50bbb310-4610-4fc8-a8df-f47dc7dd6ba8","html_url":"https://github.com/akensert/molgraph","commit_stats":{"total_commits":90,"total_committers":1,"mean_commits":90.0,"dds":0.0,"last_synced_commit":"ddce89ee2d2193d6eda344f35864264fa5aa7a3d"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/akensert/molgraph","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akensert%2Fmolgraph","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akensert%2Fmolgraph/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akensert%2Fmolgraph/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akensert%2Fmolgraph/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/akensert","download_url":"https://codeload.github.com/akensert/molgraph/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akensert%2Fmolgraph/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264941497,"owners_count":23686497,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bioinformatics","cheminformatics","computational-biology","computational-chemistry","deep-learning","graph-neural-networks","graphs","keras","machine-learning","tensorflow"],"created_at":"2024-11-21T20:08:41.719Z","updated_at":"2025-07-12T05:30:28.745Z","avatar_url":"https://github.com/akensert.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg src=\"https://github.com/akensert/molgraph/blob/main/docs/source/_static/molgraph-logo-pixel.png\" alt=\"molgraph-title\" width=\"90%\"\u003e\n\n**Graph Neural Networks** with **TensorFlow** and **Keras**. Focused on **Molecular Machine Learning**.\n\n## Quick start\nBenchmark the performance of MolGraph [here](https://github.com/akensert/molgraph/blob/main/examples/GNN-Benchmarking.ipynb), and implement a complete model pipeline with MolGraph [here](https://github.com/akensert/molgraph/blob/main/examples/QSAR-GNN-Tutorial.ipynb). \n\n\n## Highlights\nBuild a Graph Neural Network with Keras' [Sequential](https://www.tensorflow.org/api_docs/python/tf/keras/Sequential) API:\n\n```python\nfrom molgraph import GraphTensor\nfrom molgraph import layers\nfrom tensorflow import keras\n\ng = GraphTensor(node_feature=[[4.], [2.]], edge_src=[0], edge_dst=[1])\n\nmodel = keras.Sequential([\n    layers.GNNInput(type_spec=g.spec),\n    layers.GATv2Conv(units=32),\n    layers.GATv2Conv(units=32),\n    layers.Readout(),\n    keras.layers.Dense(units=1),\n])\n\npred = model(g)\n\n# Save and load Keras model\nmodel.save('/tmp/gatv2_model.keras')\nloaded_model = keras.models.load_model('/tmp/gatv2_model.keras')\nloaded_pred = loaded_model(g)\nassert pred == loaded_pred\n```\n\nCombine outputs of GNN layers to improve predictive performance:\n\n```python\nmodel = keras.Sequential([\n    layers.GNNInput(type_spec=g.spec),\n    layers.GNN([\n        layers.FeatureProjection(units=32),\n        layers.GINConv(units=32),\n        layers.GINConv(units=32),\n        layers.GINConv(units=32),\n    ]),\n    layers.Readout(),\n    keras.layers.Dense(units=128),\n    keras.layers.Dense(units=1),\n])\n\nmodel.summary()\n```\n\n## Installation\nFor **CPU** users:\n\u003cpre\u003e\npip install molgraph\n\u003c/pre\u003e\nFor **GPU** users:\n\u003cpre\u003e\npip install molgraph[gpu]\n\u003c/pre\u003e\n\n## Implementations\n- **Tensors**\n    - [Graph tensor](http://github.com/akensert/molgraph/tree/main/molgraph/tensors/graph_tensor.py)\n        - A composite tensor holding graph data; compatible with `tf.data.Dataset`, `keras.Sequential` and much more.\n- **Layers**\n    - [Graph convolutional layers](http://github.com/akensert/molgraph/tree/main/molgraph/layers/convolutional/)\n    - [Graph attentional layers](http://github.com/akensert/molgraph/tree/main/molgraph/layers/attentional/)\n    - [Graph message passing layers](http://github.com/akensert/molgraph/tree/main/molgraph/layers/message_passing/)\n    - [Graph readout layers](http://github.com/akensert/molgraph/tree/main/molgraph/layers/readout/)\n    - [Preprocessing layers](https://github.com/akensert/molgraph/tree/main/molgraph/layers/preprocessing/)\n    - [Postprocessing layers](https://github.com/akensert/molgraph/tree/main/molgraph/layers/postprocessing/)\n    - [Positional encoding layers](https://github.com/akensert/molgraph/tree/main/molgraph/layers/positional_encoding)\n- **Models**\n    - [Graph neural networks](https://github.com/akensert/molgraph/tree/main/molgraph/models/)\n    - [Saliency mapping](https://github.com/akensert/molgraph/tree/main/molgraph/models/interpretability/)\n\n## Overview \n\u003cimg src=\"https://github.com/akensert/molgraph/blob/main/docs/source/_static/molgraph-overview.png\" alt=\"molgraph-overview\" width=\"90%\"\u003e\n\n## Documentation\nSee [readthedocs](https://molgraph.readthedocs.io/en/latest/)\n\n## Papers\n- [MolGraph: a Python package for the implementation of molecular graphs and graph neural networks with TensorFlow and Keras](https://doi.org/10.48550/arXiv.2208.09944)\n- [A hands-on tutorial on quantitative structure-activity relationships using fully expressive graph neural networks](https://doi.org/10.1016/j.aca.2024.343046)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakensert%2Fmolgraph","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fakensert%2Fmolgraph","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakensert%2Fmolgraph/lists"}