A simple jpype-based python wrapper around Hisao Tamaki's treewidth solver for PACE 2017
Project description
This is a simple python wrapper around https://github.com/TCS-Meiji/PACE2017-TrackA# (meiji treewidth solver from PACE 2017), based on jpype. The original implementation of the solver is in java. The algorithm is described in https://arxiv.org/abs/1704.05286.
Installation instructions
pip install pymeiji
Usage
def meiji_solver(edge_list):
"""
Exact computation of the treewidth of a graph.
Python-wrapper around the PACE 2017 meiji solver,
which was originally written in java,
and whose details are described in
https://arxiv.org/abs/1704.05286
Parameters
----------
edge_list: list of tuples of integers
list of edges of the graph. Each edge must
be a tuple of 2 integers (u,v).
The integers should range from 0 to
the number of vertices in the graph - 1.
Returns
-------
(treewidth, bags, bag_adj)
A tuple consisting of three objects. The first is an integer equal
to the treewidth. The second is a python dictionary associating
integers (bag index) to lists of integers (bag content). The
third is also a dictionary, associating integers (bag index)
to lists of integers (indices of the neighbors of that bag
in the tree decomposition).
"""
>>> from pymeiji import meiji_solver
>>> meiji_solver([(0,1),(1,2),(2,3),(0,3)])
(2, {1: [0, 1, 3], 2: [1, 2, 3]}, {1: [2], 2: [1]})
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pymeiji-1.0.0.tar.gz.
File metadata
- Download URL: pymeiji-1.0.0.tar.gz
- Upload date:
- Size: 73.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
93276b136260954b6a8de2bf3dc049df42795ade8b4879247770c934d05ceaa1
|
|
| MD5 |
05ea0832084519e021c6558a31435706
|
|
| BLAKE2b-256 |
1da64269f69a5d9368f45294a0b1c4b4c8abfdffbc99a5ab7f1a95551f5fce60
|
File details
Details for the file pymeiji-1.0.0-py3-none-any.whl.
File metadata
- Download URL: pymeiji-1.0.0-py3-none-any.whl
- Upload date:
- Size: 71.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cb6a9dc3469bf8a4a1bf75d65eede25f703368dc244c7e5a6b92d6f6018b24cc
|
|
| MD5 |
b2e842ff3d7bc923dbd5cb76486a9040
|
|
| BLAKE2b-256 |
ac5d938760413c2ffe084b8523532c0384c93ab2385946a19653f97819016852
|