BisPy

BisPy: Bisimulation in Python - Published in JOSS (2021)

https://github.com/fandreuz/BisPy

Science Score: 77.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 12 DOI reference(s) in README
  • Academic publication links
    Links to: joss.theoj.org
  • Committers with academic emails
    1 of 3 committers (33.3%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (13.6%) to scientific vocabulary

Keywords

algorithms bisimulation graph-algorithms graph-theory hacktoberfest python

Keywords from Contributors

pde
Last synced: 4 months ago · JSON representation ·

Repository

BisPy - Python bisimulation library

Basic Info
  • Host: GitHub
  • Owner: fandreuz
  • License: mit
  • Language: Python
  • Default Branch: master
  • Homepage:
  • Size: 3.51 MB
Statistics
  • Stars: 16
  • Watchers: 3
  • Forks: 5
  • Open Issues: 10
  • Releases: 5
Topics
algorithms bisimulation graph-algorithms graph-theory hacktoberfest python
Created about 5 years ago · Last pushed almost 4 years ago
Metadata Files
Readme License Citation

README.md

BisPy

Python package Coverage Status GitHub license Documentation Status status PyPI version

Description

BisPy is a Python package for the computation of the maximum bisimulation of directed graphs. At the moment it supports the following algorithms:

  • Paige-Tarjan
  • Dovier-Piazza-Policriti
  • Saha

A brief introduction to the problem can be found here.

Usage

Paige-Tarjan, Dovier-Piazza-Policriti

To compute the maximum bisimulation of a graph, first of all we import paige_tarjan and dovier_piazza_policriti from BisPy, as well as the package NetworkX, which we use to represent graphs:

```python

import networkx as nx from bispy import computemaximumbisimulation, Algorithms ```

We then create a simple graph:

```python

graph = nx.balancedtree(2,3, createusing=nx.DiGraph) ```

It's important to set create_using=nx.DiGraph since BisPy works only with directed graphs. Now we can compute the maximum bisimulation using Paige-Tarjan's algorithm, which is the default for the function compute_maximum_bisimulation:

```python

computemaximumbisimulation(graph) [(7, 8, 9, 10, 11, 12, 13, 14), (3, 4, 5, 6), (1, 2), (0,)] ```

We can use Dovier-Piazza-Policriti's algorithm as well:

```python

computemaximumbisimulation(graph, algorithm=Algorithms.DovierPiazzaPolicriti) [(7, 8, 9, 10, 11, 12, 13, 14), (3, 4, 5, 6), (1, 2), (0,)]

```

We may also introduce a labeling set (or initial partition):

```python

computemaximumbisimulation(graph, initial_partition=[(0,7,10), (1,2,3,4,5,6,8,9,11,12,13,14)]) [(7, 10), (5, 6), (8, 9, 11, 12, 13, 14), (3, 4), (2,), (1,), (0,)]

```

Saha

In order to use Saha's algorithm we only need to import the following function:

```python

from bispy import saha ```

We call that function to obtain an object of type SahaPartition, which has a method called add_edge. This method adds a new edge to the graph and recomputes the maximum bisimulation incrementally:

python saha_partition = saha(graph)

(We reused the graph object which we defined in the previous paragraph). We can now use the aforementioned method add_edge (note that when you call this method the instance of graph which you passed is not modified):

```python

for edge in [(1,0), (4,0)]: ... maximumbisimulation = sahapartition.addedge(edge) ... print(maximumbisimulation) [(3, 4, 5, 6), (7, 8, 9, 10, 11, 12, 13, 14), (0,), (2,), (1,)] [(3, 5, 6), (7, 8, 9, 10, 11, 12, 13, 14), (0,), (2,), (1,), (4,)] ```

Documentation

You can read the documentation (hosted on ReadTheDocs) at this link.

To build the HTML version of the docs locally use:

```bash

cd docs make html ```

The generated html can be found in docs/build/html.

Dependencies and installation

BisPy requires the modules llist, networkx. The code is tested for Python 3, while compatibility with Python 2 is not guaranteed. It can be installed using pip or directly from the source code.

Installing via pip

To install the package:

```bash

pip install bispy ```

To uninstall the package:

```bash

pip uninstall bispy ```

Installing from source

You can clone this repository on your local machine using:

```bash

git clone https://github.com/fAndreuzzi/BisPy ```

To install the package:

```bash

cd BisPy python setup.py install ```

Testing

We are using GitHub actions for continuous intergration testing. To run tests locally (pytest is required) use the following command from the root folder of BisPy:

```bash

pytest tests ```

Authors and acknowledgements

BisPy is currently developed and mantained by Francesco Andreuzzi. You can contact me at:

  • andreuzzi.francesco at gmail.com
  • fandreuz at sissa.it

The project has been developed under the supervision of professor Alberto Casagrande (University of Trieste), which was my advisor for my bachelor thesis.

Reporting a bug

The best way to report a bug is using the Issues section. Please, be clear, and give detailed examples on how to reproduce the bug (the best option would be the graph which triggered the error you are reporting).

How to contribute

We are more than happy to receive contributions on tests, documentation and new features. Our Issues section is always full of things to do.

Here are the guidelines to submit a patch:

  1. Start by opening a new issue describing the bug you want to fix, or the feature you want to introduce. This lets us keep track of what is being done at the moment, and possibly avoid writing different solutions for the same problem.

  2. Fork the project, and setup a new branch to work in (fix-issue-22, for instance). If you do not separate your work in different branches you may have a bad time when trying to push a pull request to fix a particular issue.

  3. Run black before pushing your code for review.

  4. Any significant changes should almost always be accompanied by tests. The project already has good test coverage, so look at some of the existing tests if you're unsure how to go about it.

  5. Provide menaningful commit messages to help us keeping a good git history.

  6. Finally you can submbit your pull request!

References

We consulted the following resources during the development of BisPy:

  • Saha, Diptikalyan. "An incremental bisimulation algorithm." International Conference on Foundations of Software Technology and Theoretical Computer Science. Springer, Berlin, Heidelberg, 2007. DOI
  • Dovier, Agostino, Carla Piazza, and Alberto Policriti. "A fast bisimulation algorithm." International Conference on Computer Aided Verification. Springer, Berlin, Heidelberg, 2001. DOI
  • Gentilini, Raffaella, Carla Piazza, and Alberto Policriti. "From bisimulation to simulation: Coarsest partition problems." Journal of Automated Reasoning 31.1 (2003): 73-103. DOI
  • Paige, Robert, and Robert E. Tarjan. "Three partition refinement algorithms." SIAM Journal on Computing 16.6 (1987): 973-989. DOI
  • Hopcroft, John. "An n log n algorithm for minimizing states in a finite automaton." Theory of machines and computations. Academic Press, 1971. 189-196.
  • Aczel, Peter. "Non-well-founded sets." (1988).
  • Kanellakis, Paris C., and Scott A. Smolka. "CCS expressions, finite state processes, and three problems of equivalence." Information and computation 86.1 (1990): 43-68. DOI
  • Sharir, Micha. "A strong-connectivity algorithm and its applications in data flow analysis." Computers & Mathematics with Applications 7.1 (1981): 67-72. DOI
  • Cormen, Thomas H., et al. Introduction to algorithms. MIT press, 2009. (ISBN: 9780262533058)

License

See the LICENSE file for license rights and limitations (MIT).

Owner

  • Name: Francesco Andreuzzi
  • Login: fandreuz
  • Kind: user
  • Location: Geneva, Switzerland
  • Company: CERN

CSE MSc student | SWE @cern

Citation (CITATION.cff)

cff-version: 1.2.0
message: "If you use this software, please cite it as below."
authors:
- family-names: "Andreuzzi"
  given-names: "Francesco"
  orcid: "https://orcid.org/0000-0002-9508-7801"
title: "BisPy: Bisimulation in Python"
version: 0.2.3
doi: 10.21105/joss.03519
date-released: 2021-09-28
url: "https://github.com/fAndreuzzi/BisPy"

GitHub Events

Total
  • Watch event: 1
Last Year
  • Watch event: 1

Committers

Last synced: 5 months ago

All Time
  • Total Commits: 568
  • Total Committers: 3
  • Avg Commits per committer: 189.333
  • Development Distribution Score (DDS): 0.009
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
francescoandreuzzi a****o@g****m 563
SV-97 v****7@g****m 3
Daniel S. Katz d****z@i****g 2
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 4 months ago

All Time
  • Total issues: 20
  • Total pull requests: 16
  • Average time to close issues: 25 days
  • Average time to close pull requests: about 10 hours
  • Total issue authors: 2
  • Total pull request authors: 3
  • Average comments per issue: 0.75
  • Average comments per pull request: 0.5
  • Merged pull requests: 15
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • fandreuz (18)
  • SV-97 (2)
Pull Request Authors
  • fandreuz (14)
  • SV-97 (1)
  • danielskatz (1)
Top Labels
Issue Labels
improvement (6) enhancement (5) bug (2) documentation (2) tutorial (1) help wanted (1) good first issue (1)
Pull Request Labels

Dependencies

docs/requirements.txt pypi
  • llist *
  • networkx *
  • sphinx_autodoc_typehints *
requirements.txt pypi
  • llist *
  • networkx *
setup.py pypi
  • networkx *