grandiso


Namegrandiso JSON
Version 2.2.0 PyPI version JSON
download
home_pagehttps://github.com/aplbrain/grandiso-networkx
SummaryPerformant subgraph isomorphism
upload_time2024-02-13 16:21:18
maintainer
docs_urlNone
authorJordan Matelsky
requires_python
license
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <h1 align=center>Grand Isomorphisms</h1>

<p align="center">
<a href="https://codecov.io/gh/aplbrain/grandiso-networkx/"><img alt="Codecov" src="https://img.shields.io/codecov/c/github/aplbrain/grandiso-networkx?style=for-the-badge"></a>
<a href="https://github.com/aplbrain/grandiso-networkx/actions"><img alt="GitHub Workflow Status" src="https://img.shields.io/github/actions/workflow/status/aplbrain/grandiso-networkx/python-package.yml?branch=master&style=for-the-badge"></a><a href="https://bossdb.org/tools/DotMotif"><img src="https://img.shields.io/badge/Pretty Dope-👌-00ddcc.svg?style=for-the-badge" /></a>
<img alt="GitHub" src="https://img.shields.io/github/license/aplbrain/grandiso-networkx?style=for-the-badge">
<a href="https://pypi.org/project/grandiso/"><img alt="PyPI" src="https://img.shields.io/pypi/v/grandiso?style=for-the-badge"></a>
</p>

Subgraph isomorphism is a resource-heavy (but branch-parallelizable) algorithm that is hugely impactful for large graph analysis. SotA algorithms for this (Ullmann, VF2, BB-Graph) are heavily RAM-bound, but this is due to a large number of small processes each of which hold a small portion of a traversal tree in memory.

_Grand-Iso_ is a subgraph isomorphism algorithm that exchanges this resource-limitation for a parallelizable partial-match queue structure.

It performs favorably compared to other pure-python (and even some non-pure-python!) implementations:

<img width="485" alt="image" src="https://user-images.githubusercontent.com/693511/96184546-a35e0380-0f06-11eb-8475-1921e8f94256.png">

See the [wiki](https://github.com/aplbrain/grandiso-networkx/wiki) for more documentation.

## Example Usage

```python
from grandiso import find_motifs
import networkx as nx

host = nx.fast_gnp_random_graph(10, 0.5)

motif = nx.Graph()
motif.add_edge("A", "B")
motif.add_edge("B", "C")
motif.add_edge("C", "D")
motif.add_edge("D", "A")

len(find_motifs(motif, host))
```

Directed graph support:

```python
from grandiso import find_motifs
import networkx as nx

host = nx.fast_gnp_random_graph(10, 0.5, directed=True)

motif = nx.DiGraph()
motif.add_edge("A", "B")
motif.add_edge("B", "C")
motif.add_edge("C", "D")
motif.add_edge("D", "A")

len(find_motifs(motif, host))
```

## Counts-only

For very large graphs, you may use a good chunk of RAM not only on the queue of hypotheses, but also on the list of results. If all you care about is the NUMBER of results, you should pass `count_only=True` to the `find_motifs` function. This will dramatically reduce your RAM overhead on higher-count queries.

There are many other arguments that you can pass to the motif search algorithm. For a full list, see [here](https://github.com/aplbrain/grandiso-networkx/wiki/Algorithm-Arguments).


## Hacking on this repo

### Running Tests

```shell
coverage run --source=grandiso -m pytest
```

## Citing

If this tool is helpful to your research, please consider citing it with:

```bibtex
# https://doi.org/10.1038/s41598-021-91025-5
@article{Matelsky_Motifs_2021, 
    title={{DotMotif: an open-source tool for connectome subgraph isomorphism search and graph queries}},
    volume={11}, 
    ISSN={2045-2322}, 
    url={http://dx.doi.org/10.1038/s41598-021-91025-5}, 
    DOI={10.1038/s41598-021-91025-5}, 
    number={1}, 
    journal={Scientific Reports}, 
    publisher={Springer Science and Business Media LLC}, 
    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},
    year={2021}, 
    month={Jun}
}
```

---

<p align=center><b>Made with 💙 at <a href="https://jhuapl.edu"><img alt="JHU APL" src="https://user-images.githubusercontent.com/693511/116814564-9b268800-ab27-11eb-98bb-dfddb2e405a1.png" height="23px" /></a></b></p>

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/aplbrain/grandiso-networkx",
    "name": "grandiso",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "",
    "author": "Jordan Matelsky",
    "author_email": "opensource@matelsky.com",
    "download_url": "https://files.pythonhosted.org/packages/65/c6/27400e2d81bd769ebe65c695cead44c8efb55ac3769826a01c9223d65709/grandiso-2.2.0.tar.gz",
    "platform": null,
    "description": "<h1 align=center>Grand Isomorphisms</h1>\n\n<p align=\"center\">\n<a href=\"https://codecov.io/gh/aplbrain/grandiso-networkx/\"><img alt=\"Codecov\" src=\"https://img.shields.io/codecov/c/github/aplbrain/grandiso-networkx?style=for-the-badge\"></a>\n<a href=\"https://github.com/aplbrain/grandiso-networkx/actions\"><img alt=\"GitHub Workflow Status\" src=\"https://img.shields.io/github/actions/workflow/status/aplbrain/grandiso-networkx/python-package.yml?branch=master&style=for-the-badge\"></a><a href=\"https://bossdb.org/tools/DotMotif\"><img src=\"https://img.shields.io/badge/Pretty Dope-\ud83d\udc4c-00ddcc.svg?style=for-the-badge\" /></a>\n<img alt=\"GitHub\" src=\"https://img.shields.io/github/license/aplbrain/grandiso-networkx?style=for-the-badge\">\n<a href=\"https://pypi.org/project/grandiso/\"><img alt=\"PyPI\" src=\"https://img.shields.io/pypi/v/grandiso?style=for-the-badge\"></a>\n</p>\n\nSubgraph isomorphism is a resource-heavy (but branch-parallelizable) algorithm that is hugely impactful for large graph analysis. SotA algorithms for this (Ullmann, VF2, BB-Graph) are heavily RAM-bound, but this is due to a large number of small processes each of which hold a small portion of a traversal tree in memory.\n\n_Grand-Iso_ is a subgraph isomorphism algorithm that exchanges this resource-limitation for a parallelizable partial-match queue structure.\n\nIt performs favorably compared to other pure-python (and even some non-pure-python!) implementations:\n\n<img width=\"485\" alt=\"image\" src=\"https://user-images.githubusercontent.com/693511/96184546-a35e0380-0f06-11eb-8475-1921e8f94256.png\">\n\nSee the [wiki](https://github.com/aplbrain/grandiso-networkx/wiki) for more documentation.\n\n## Example Usage\n\n```python\nfrom grandiso import find_motifs\nimport networkx as nx\n\nhost = nx.fast_gnp_random_graph(10, 0.5)\n\nmotif = nx.Graph()\nmotif.add_edge(\"A\", \"B\")\nmotif.add_edge(\"B\", \"C\")\nmotif.add_edge(\"C\", \"D\")\nmotif.add_edge(\"D\", \"A\")\n\nlen(find_motifs(motif, host))\n```\n\nDirected graph support:\n\n```python\nfrom grandiso import find_motifs\nimport networkx as nx\n\nhost = nx.fast_gnp_random_graph(10, 0.5, directed=True)\n\nmotif = nx.DiGraph()\nmotif.add_edge(\"A\", \"B\")\nmotif.add_edge(\"B\", \"C\")\nmotif.add_edge(\"C\", \"D\")\nmotif.add_edge(\"D\", \"A\")\n\nlen(find_motifs(motif, host))\n```\n\n## Counts-only\n\nFor very large graphs, you may use a good chunk of RAM not only on the queue of hypotheses, but also on the list of results. If all you care about is the NUMBER of results, you should pass `count_only=True` to the `find_motifs` function. This will dramatically reduce your RAM overhead on higher-count queries.\n\nThere are many other arguments that you can pass to the motif search algorithm. For a full list, see [here](https://github.com/aplbrain/grandiso-networkx/wiki/Algorithm-Arguments).\n\n\n## Hacking on this repo\n\n### Running Tests\n\n```shell\ncoverage run --source=grandiso -m pytest\n```\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<p align=center><b>Made with \ud83d\udc99 at <a href=\"https://jhuapl.edu\"><img alt=\"JHU APL\" src=\"https://user-images.githubusercontent.com/693511/116814564-9b268800-ab27-11eb-98bb-dfddb2e405a1.png\" height=\"23px\" /></a></b></p>\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Performant subgraph isomorphism",
    "version": "2.2.0",
    "project_urls": {
        "Homepage": "https://github.com/aplbrain/grandiso-networkx"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "65c627400e2d81bd769ebe65c695cead44c8efb55ac3769826a01c9223d65709",
                "md5": "cc8282e585dc476512afab5f859cf75e",
                "sha256": "66f292d27328e13122065c7905ad0ac79c4649f69a35e7b98a3631654a0bf77c"
            },
            "downloads": -1,
            "filename": "grandiso-2.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "cc8282e585dc476512afab5f859cf75e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 16277,
            "upload_time": "2024-02-13T16:21:18",
            "upload_time_iso_8601": "2024-02-13T16:21:18.053009Z",
            "url": "https://files.pythonhosted.org/packages/65/c6/27400e2d81bd769ebe65c695cead44c8efb55ac3769826a01c9223d65709/grandiso-2.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-13 16:21:18",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "aplbrain",
    "github_project": "grandiso-networkx",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "grandiso"
}
        
Elapsed time: 0.22987s