{"id":21182611,"url":"https://github.com/fandreuz/bispy","last_synced_at":"2025-06-17T17:41:00.050Z","repository":{"id":46722403,"uuid":"314878976","full_name":"fandreuz/BisPy","owner":"fandreuz","description":"BisPy - Python bisimulation library","archived":false,"fork":false,"pushed_at":"2022-01-21T22:32:52.000Z","size":3681,"stargazers_count":14,"open_issues_count":10,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-06-05T04:36:33.942Z","etag":null,"topics":["algorithms","bisimulation","graph-algorithms","graph-theory","hacktoberfest","python"],"latest_commit_sha":null,"homepage":"","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/fandreuz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-11-21T18:37:29.000Z","updated_at":"2024-08-11T22:22:09.000Z","dependencies_parsed_at":"2022-09-26T21:02:05.098Z","dependency_job_id":null,"html_url":"https://github.com/fandreuz/BisPy","commit_stats":null,"previous_names":["fandreuz/bispy","fandreuzzi/bispy"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/fandreuz/BisPy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fandreuz%2FBisPy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fandreuz%2FBisPy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fandreuz%2FBisPy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fandreuz%2FBisPy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fandreuz","download_url":"https://codeload.github.com/fandreuz/BisPy/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fandreuz%2FBisPy/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260075800,"owners_count":22955421,"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":["algorithms","bisimulation","graph-algorithms","graph-theory","hacktoberfest","python"],"created_at":"2024-11-20T17:57:30.231Z","updated_at":"2025-06-17T17:40:55.037Z","avatar_url":"https://github.com/fandreuz.png","language":"Python","readme":"\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/fAndreuzzi/BisPy\" target=\"_blank\" \u003e\n    \u003cimg alt=\"BisPy\" src=\"logo.png\" width=\"400\" /\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n![Python package](https://github.com/fAndreuzzi/BisPy/workflows/Python%20package/badge.svg?branch=master)\n\u003ca href='https://coveralls.io/github/fAndreuzzi/BisPy'\u003e\u003cimg src='https://coveralls.io/repos/github/fAndreuzzi/BisPy/badge.svg' alt='Coverage Status' /\u003e\u003c/a\u003e\n[![GitHub license](https://img.shields.io/github/license/Naereen/StrapDown.js.svg)](https://github.com/Naereen/StrapDown.js/blob/master/LICENSE)\n\u003cimg src='https://img.shields.io/badge/Code%20style-Black-%23000000'/\u003e\n[![Documentation Status](https://readthedocs.org/projects/bispy-bisimulation-in-python/badge/?version=latest)](https://bispy-bisimulation-in-python.readthedocs.io/en/latest/?badge=latest)\n[![status](https://joss.theoj.org/papers/9d9c3ca0715d482938b5a450525cefa0/status.svg)](https://joss.theoj.org/papers/9d9c3ca0715d482938b5a450525cefa0)\n[![PyPI version](https://badge.fury.io/py/BisPy.svg)](https://badge.fury.io/py/BisPy)\n\n## Description\n\n**BisPy** is a Python package for the computation of the maximum bisimulation\nof directed graphs. At the moment it supports the following algorithms:\n\n- Paige-Tarjan\n- Dovier-Piazza-Policriti\n- Saha\n\nA brief introduction to the problem can be found\n[here](https://bispy-bisimulation-in-python.readthedocs.io/en/latest/?badge=latest#a-brief-introduction-to-bisimulation).\n\n## Usage\n\n### Paige-Tarjan, Dovier-Piazza-Policriti\n\nTo compute the maximum bisimulation of a graph, first of all we import\n`paige_tarjan` and `dovier_piazza_policriti` from **BisPy**, as well as the\npackage _NetworkX_, which we use to represent graphs:\n\n```python\n\u003e\u003e\u003e import networkx as nx\n\u003e\u003e\u003e from bispy import compute_maximum_bisimulation, Algorithms\n```\n\nWe then create a simple graph:\n\n```python\n\u003e\u003e\u003e graph = nx.balanced_tree(2,3, create_using=nx.DiGraph)\n```\n\nIt's important to set `create_using=nx.DiGraph` since **BisPy** works only with\n_directed_ graphs. Now we can compute the _maximum bisimulation_ using\n_Paige-Tarjan_'s algorithm, which is the default for the function\n`compute_maximum_bisimulation`:\n\n```python\n\u003e\u003e\u003e compute_maximum_bisimulation(graph)\n[(7, 8, 9, 10, 11, 12, 13, 14), (3, 4, 5, 6), (1, 2), (0,)]\n```\n\nWe can use _Dovier-Piazza-Policriti_'s algorithm as well:\n\n```python\n\u003e\u003e\u003e compute_maximum_bisimulation(graph, algorithm=Algorithms.DovierPiazzaPolicriti)\n[(7, 8, 9, 10, 11, 12, 13, 14), (3, 4, 5, 6),  (1, 2), (0,)]\n\n```\n\nWe may also introduce a _labeling set_ (or _initial partition_):\n\n```python\n\u003e\u003e\u003e compute_maximum_bisimulation(graph, initial_partition=[(0,7,10), (1,2,3,4,5,6,8,9,11,12,13,14)])\n[(7, 10), (5, 6), (8, 9, 11, 12, 13, 14), (3, 4), (2,), (1,), (0,)]\n\n```\n\n### Saha\n\nIn order to use _Saha_'s algorithm we only need to import the following\nfunction:\n\n```python\n\u003e\u003e\u003e from bispy import saha\n```\n\nWe call that function to obtain an object of type `SahaPartition`, which has a\nmethod called `add_edge`. This method adds a new edge to the graph and\nrecomputes the maximum bisimulation incrementally:\n\n```python\nsaha_partition = saha(graph)\n```\n\n(We reused the `graph` object which we defined in the previous paragraph). We\ncan now use the aforementioned method `add_edge` (note that when you call this\nmethod the instance of `graph` which you passed is **not** modified):\n\n```python\n\u003e\u003e\u003e for edge in [(1,0), (4,0)]:\n...    maximum_bisimulation = saha_partition.add_edge(edge)\n...    print(maximum_bisimulation)\n[(3, 4, 5, 6), (7, 8, 9, 10, 11, 12, 13, 14), (0,), (2,), (1,)]\n[(3, 5, 6), (7, 8, 9, 10, 11, 12, 13, 14), (0,), (2,), (1,), (4,)]\n```\n\n## Documentation\n\nYou can read the documentation (hosted on ReadTheDocs) at this\n[link](https://bispy-bisimulation-in-python.readthedocs.io/en/latest/?badge=latest).\n\nTo build the HTML version of the docs locally use:\n\n```bash\n\u003e cd docs\n\u003e make html\n```\n\nThe generated html can be found in `docs/build/html`.\n\n## Dependencies and installation\n\n**BisPy** requires the modules `llist, networkx`. The code is tested\nfor _Python 3_, while compatibility with _Python 2_ is not guaranteed. It can\nbe installed using `pip` or directly from the source code.\n\n### Installing via _pip_\n\nTo install the package:\n\n```bash\n\u003e pip install bispy\n```\n\nTo uninstall the package:\n\n```bash\n\u003e pip uninstall bispy\n```\n\n### Installing from source\n\nYou can clone this repository on your local machine using:\n\n```bash\n\u003e git clone https://github.com/fAndreuzzi/BisPy\n```\n\nTo install the package:\n\n```bash\n\u003e cd BisPy\n\u003e python setup.py install\n```\n\n\n## Testing\n\nWe are using **GitHub actions** for continuous intergration testing. To run\ntests locally (`pytest` is required) use the following command from the root\nfolder of **BisPy**:\n\n```bash\n\u003e pytest tests\n```\n\n## Authors and acknowledgements\n\n**BisPy** is currently developed and mantained by **Francesco Andreuzzi**. You\ncan contact me at:\n\n- andreuzzi.francesco at gmail.com\n- fandreuz at sissa.it\n\nThe project has been developed under the supervision of professor **Alberto\nCasagrande** (_University of Trieste_), which was my advisor for my _bachelor\nthesis_.\n\n## Reporting a bug\n\nThe best way to report a bug is using the\n[Issues](https://github.com/fAndreuzzi/BisPy/issues) section. Please, be clear,\nand give detailed examples on how to reproduce the bug (the best option would\nbe the graph which triggered the error you are reporting).\n\n## How to contribute\n\nWe are more than happy to receive contributions on tests, documentation and\nnew features. Our [Issues](https://github.com/fAndreuzzi/BisPy/issues)\nsection is always full of things to do.\n\nHere are the guidelines to submit a patch:\n\n1. Start by opening a new [issue](https://github.com/fAndreuzzi/BisPy/issues)\n   describing the bug you want to fix, or the feature you want to introduce.\n   This lets us keep track of what is being done at the moment, and possibly\n   avoid writing different solutions for the same problem.\n\n2. Fork the project, and setup a **new** branch to work in (_fix-issue-22_, for\n   instance). If you do not separate your work in different branches you may\n   have a bad time when trying to push a pull request to fix a particular\n   issue.\n\n3. Run [black](https://github.com/psf/black) before pushing\n   your code for review.\n\n4. Any significant changes should almost always be accompanied by tests. The\n   project already has good test coverage, so look at some of the existing\n   tests if you're unsure how to go about it.\n\n5. Provide menaningful **commit messages** to help us keeping a good _git_\n   history.\n\n6. Finally you can submbit your _pull request_!\n\n## References\n\nWe consulted the following resources during the development of **BisPy**:\n\n- Saha, Diptikalyan. \"An incremental bisimulation algorithm.\" International\n  Conference on Foundations of Software Technology and Theoretical Computer\n  Science. Springer, Berlin, Heidelberg, 2007.\n  [DOI](https://doi.org/10.1007/978-3-540-77050-3_17)\n- Dovier, Agostino, Carla Piazza, and Alberto Policriti. \"A fast bisimulation\n  algorithm.\" International Conference on Computer Aided Verification.\n  Springer, Berlin, Heidelberg, 2001.\n  [DOI](https://doi.org/10.1007/3-540-44585-4_8)\n- Gentilini, Raffaella, Carla Piazza, and Alberto Policriti. \"From bisimulation\n  to simulation: Coarsest partition problems.\" Journal of Automated Reasoning\n  31.1 (2003): 73-103. [DOI](https://doi.org/10.1023/A:1027328830731)\n- Paige, Robert, and Robert E. Tarjan. \"Three partition refinement algorithms.\"\n  SIAM Journal on Computing 16.6 (1987): 973-989.\n  [DOI](https://doi.org/10.1137/0216062)\n- Hopcroft, John. \"An n log n algorithm for minimizing states in a finite\n  automaton.\" Theory of machines and computations. Academic Press, 1971.\n  189-196.\n- Aczel, Peter. \"Non-well-founded sets.\" (1988).\n- Kanellakis, Paris C., and Scott A. Smolka. \"CCS expressions, finite state\n  processes, and three problems of equivalence.\" Information and computation\n  86.1 (1990): 43-68. [DOI](\u003chttps://doi.org/10.1016/0890-5401(90)90025-D\u003e)\n- Sharir, Micha. \"A strong-connectivity algorithm and its applications in data\n  flow analysis.\" Computers \u0026 Mathematics with Applications 7.1 (1981): 67-72.\n  [DOI](\u003chttps://doi.org/10.1016/0898-1221(81)90008-0\u003e)\n- Cormen, Thomas H., et al. Introduction to algorithms. MIT press, 2009.\n  (ISBN: 9780262533058)\n\n## License\n\nSee the [LICENSE](LICENSE) file for license rights and limitations (MIT).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffandreuz%2Fbispy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffandreuz%2Fbispy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffandreuz%2Fbispy/lists"}