{"id":23494492,"url":"https://github.com/aplbrain/grand","last_synced_at":"2025-04-04T09:08:16.761Z","repository":{"id":38380489,"uuid":"286553444","full_name":"aplbrain/grand","owner":"aplbrain","description":"Your favorite Python graph libraries, scalable and interoperable. Graph databases in memory, and familiar graph APIs for cloud databases.","archived":false,"fork":false,"pushed_at":"2024-12-11T18:41:41.000Z","size":473,"stargazers_count":108,"open_issues_count":7,"forks_count":7,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-03-28T08:05:42.941Z","etag":null,"topics":["aplbrain","dynamodb","grand","grand-graph","graph","graph-algorithms","graph-database","graph-library","graph-theory","graphs","gremlin","igraph","neptune","network-analysis","networkit","networkx","serverless","sql"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aplbrain.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}},"created_at":"2020-08-10T18:44:11.000Z","updated_at":"2025-03-27T19:27:50.000Z","dependencies_parsed_at":"2024-04-11T21:41:01.849Z","dependency_job_id":"2af9ab56-3444-40b0-bf3f-7a3785f3cb43","html_url":"https://github.com/aplbrain/grand","commit_stats":{"total_commits":79,"total_committers":3,"mean_commits":"26.333333333333332","dds":"0.49367088607594933","last_synced_commit":"ca8f9ca70700d4bc3a295d32c8f4dac837510b0f"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aplbrain%2Fgrand","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aplbrain%2Fgrand/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aplbrain%2Fgrand/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aplbrain%2Fgrand/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aplbrain","download_url":"https://codeload.github.com/aplbrain/grand/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247149501,"owners_count":20891954,"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":["aplbrain","dynamodb","grand","grand-graph","graph","graph-algorithms","graph-database","graph-library","graph-theory","graphs","gremlin","igraph","neptune","network-analysis","networkit","networkx","serverless","sql"],"created_at":"2024-12-25T03:05:54.730Z","updated_at":"2025-04-04T09:08:16.742Z","avatar_url":"https://github.com/aplbrain.png","language":"Python","readme":"\u003cdiv align=center\u003e\u003cimg src=\"docs/grand.png\" width=400 /\u003e\u003c/div\u003e\n\n\u003cdiv align=center\u003e\u003ca href=\"https://pypi.org/project/grand-graph/\"\u003e\u003cimg src=\"https://img.shields.io/pypi/v/grand-graph?style=for-the-badge\" /\u003e\u003c/a\u003e \u003ca href=\"https://app.codecov.io/gh/aplbrain/grand\"\u003e\u003cimg alt=\"Codecov\" src=\"https://img.shields.io/codecov/c/github/aplbrain/grand?style=for-the-badge\"\u003e\u003c/a\u003e\u003c/div\u003e\n\n\u003c!--  \u003ca href=\"https://github.com/aplbrain/grand/actions/workflows/python-package.yml\"\u003e\u003cimg alt=\"GitHub Workflow Status (with branch)\" src=\"https://img.shields.io/github/actions/workflow/status/aplbrain/grand/python-package.yml?style=for-the-badge\"\u003e\u003c/a\u003e --\u003e\n\n\u003cbr /\u003e\n\n\u003cp align=center\u003eGraph toolkit interoperability and scalability for Python\u003c/p\u003e\n\n## Installation\n\n```shell\npip install grand-graph\n```\n\n## Example use-cases\n\n-   Write NetworkX commands to analyze true-serverless graph databases using DynamoDB\\*\n-   Query a host graph in SQL for subgraph isomorphisms with DotMotif\n-   Write iGraph code to construct a graph, and then play with it in Networkit\n-   Attach node and edge attributes to Networkit or IGraph graphs\n\n\u003e \\* [Neptune is not true-serverless.](docs/What-About-Neptune.md)\n\n## Why it's a big deal\n\n_Grand_ is a Rosetta Stone of graph technologies. A _Grand_ graph has a \"Backend,\" which handles the implementation-details of talking to data on disk (or in the cloud), and an \"Dialect\", which is your preferred way of talking to a graph.\n\nFor example, here's how you make a graph that is persisted in DynamoDB (the \"Backend\") but that you can talk to as though it's a `networkx.DiGraph` (the \"Dialect\"):\n\n```python\nimport grand\n\nG = grand.Graph(backend=grand.DynamoDBBackend())\n\nG.nx.add_node(\"Jordan\", type=\"Person\")\nG.nx.add_node(\"DotMotif\", type=\"Project\")\n\nG.nx.add_edge(\"Jordan\", \"DotMotif\", type=\"Created\")\n\nassert len(G.nx.edges()) == 1\nassert len(G.nx.nodes()) == 2\n```\n\nIt doesn't stop there. If you like the way IGraph handles anonymous node insertion (ugh) but you want to handle the graph using regular NetworkX syntax, use a `IGraphDialect` and then switch to a `NetworkXDialect` halfway through:\n\n```python\nimport grand\n\nG = grand.Graph()\n\n# Start in igraph:\nG.igraph.add_vertices(5)\n\n# A little bit of networkit:\nG.networkit.addNode()\n\n# And switch to networkx:\nassert len(G.nx.nodes()) == 6\n\n# And back to igraph!\nassert len(G.igraph.vs) == 6\n```\n\nYou should be able to use the \"dialect\" objects the same way you'd use a real graph from the constituent libraries. For example, here is a NetworkX algorithm running on NetworkX graphs alongside Grand graphs:\n\n```python\nimport networkx as nx\n\nnx.algorithms.isomorphism.GraphMatcher(networkxGraph, grandGraph.nx)\n```\n\nHere is an example of using Networkit, a highly performant graph library, and attaching node/edge attributes, which are not supported by the library by default:\n\n```python\nimport grand\nfrom grand.backends.networkit import NetworkitBackend\n\nG = grand.Graph(backend=NetworkitBackend())\n\nG.nx.add_node(\"Jordan\", type=\"Person\")\nG.nx.add_node(\"Grand\", type=\"Software\")\nG.nx.add_edge(\"Jordan\", \"Grand\", weight=1)\n\nprint(G.nx.edges(data=True)) # contains attributes, even though graph is stored in networkit\n```\n\n## Current Support\n\n\u003ctable\u003e\u003ctr\u003e\n\u003cth\u003e✅ = Fully Implemented\u003c/th\u003e\n\u003cth\u003e🤔 = In Progress\u003c/th\u003e\n\u003cth\u003e🔴 = Unsupported\u003c/th\u003e\n\u003c/tr\u003e\u003c/table\u003e\n\n| Dialect            | Description \u0026 Notes      | Status |\n| ------------------ | ------------------------ | ------ |\n| `IGraphDialect`    | Python-IGraph interface  | ✅     |\n| `NetworkXDialect`  | NetworkX-like interface  | ✅     |\n| `NetworkitDialect` | Networkit-like interface | ✅     |\n\n| Backend            | Description \u0026 Notes          | Status |\n| ------------------ | ---------------------------- | ------ |\n| `DataFrameBackend` | Stored in pandas-like tables | ✅     |\n| `DynamoDBBackend`  | Edge/node tables in DynamoDB | ✅     |\n| `GremlinBackend`   | For Gremlin datastores       | ✅     |\n| `IGraphBackend`    | An IGraph graph, in memory   | ✅     |\n| `NetworkitBackend` | A Networkit graph, in memory | ✅     |\n| `NetworkXBackend`  | A NetworkX graph, in memory  | ✅     |\n| `SQLBackend`       | Two SQL-queryable tables     | ✅     |\n\nYou can read more about usage and learn about backends and dialects in [the wiki](https://github.com/aplbrain/grand/wiki).\n\n## Citing\n\nIf this tool is helpful to your research, please consider citing it with:\n\n```bibtex\n# https://doi.org/10.1038/s41598-021-91025-5\n@article{Matelsky_Motifs_2021,\n    title={{DotMotif: an open-source tool for connectome subgraph isomorphism search and graph queries}},\n    volume={11},\n    ISSN={2045-2322},\n    url={http://dx.doi.org/10.1038/s41598-021-91025-5},\n    DOI={10.1038/s41598-021-91025-5},\n    number={1},\n    journal={Scientific Reports},\n    publisher={Springer Science and Business Media LLC},\n    author={Matelsky, Jordan K. and Reilly, Elizabeth P. and Johnson, Erik C. and Stiso, Jennifer and Bassett, Danielle S. and Wester, Brock A. and Gray-Roncal, William},\n    year={2021},\n    month={Jun}\n}\n```\n\n---\n\n\u003cp align=center\u003e\u003cb\u003eMade with 💙 at \u003ca href=\"https://jhuapl.edu\"\u003e\u003cimg alt=\"JHU APL\" src=\"https://user-images.githubusercontent.com/693511/116814564-9b268800-ab27-11eb-98bb-dfddb2e405a1.png\" height=\"23px\" /\u003e\u003c/a\u003e\u003c/b\u003e\u003c/p\u003e\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faplbrain%2Fgrand","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faplbrain%2Fgrand","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faplbrain%2Fgrand/lists"}