Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pymeiji-1.0.1.tar.gz (73.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pymeiji-1.0.1-py3-none-any.whl (71.9 kB view details)

Uploaded Python 3

File details

Details for the file pymeiji-1.0.1.tar.gz.

File metadata

  • Download URL: pymeiji-1.0.1.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

Hashes for pymeiji-1.0.1.tar.gz
Algorithm Hash digest
SHA256 de3363405cf1a863e48ad85b13a0e03616ff6a1eaf029b6cff3950d7ee6ca992
MD5 c63c919c94a960c10a3546a648f94dcc
BLAKE2b-256 5330b934db258df02d00d8b970df15f57c66bc0579e447378e68a6c20c1e6f14

See more details on using hashes here.

File details

Details for the file pymeiji-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: pymeiji-1.0.1-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

Hashes for pymeiji-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1d09409bfc310f710a76545d5adba9b1920bb9684e346b3a6d1c3c4c268c7377
MD5 a7b8f692f497a33249db89af6e96b031
BLAKE2b-256 468fe78d630bdf6286b0e9efbdad22eca0bfa8874e1ec985169e750bcdf9e4f7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page