Skip to main content

TdVisu

Maintenance PyPI license Tests codecov

GitHub release (latest SemVer including pre-releases) PyPI version fury.io GitHub commits since latest release (by SemVer) PyPI status PyPI pyversions PyPI - Wheel GitHub code size in bytes


Visualization for dynamic programming on tree decompositions.

Create a graph object for each given graph that is of interest for the dynamic programming.

The visualization generates highlights and adds solution-tables for user defined time steps.

These snapshot of the graphs will be written in a graphviz-supported file-format to a folder of your choosing.

For the portable and light weight '.svg' format, all graphs for a timestep can be joined together to provide a thoroughly view on the process of dynamic programming.

With the '.svg' format the images are highly customizable, and even combining several timesteps together using svg animate would be an option in the future.


Using

Note: see also the steps prepared in the CI/CD .github/workflows/python-app.yml:

Graphviz (>=2.38). Be aware of changes in default layouts over different major versions of Graphviz. The project currently tests with graphviz-version: "12.2.1".

python-benedict[xml]

PostgreSQL adapter for Python: psycopg (3)


To register the graphviz plugins

https://gitlab.com/graphviz/graphviz/-/issues/1352

dot.exe -c

To install

In a command prompt with pip (to get pip see: https://pip.pypa.io/en/stable/) installed: Just run

pip install -h (for more information on install options)
pip install tdvisu

To download the latest version from the default branch:

git clone --depth 1 --single https://github.com/VaeterchenFrost/tdvisu

To isolate the dependencies

With virtualenv on the system installed you can isolate the environment, for example

virtualenv tdvisu_dir -p 3.13
cd tdvisu_dir/bin/
source activate
# Windows: ./tdvisu_dir/Scripts/activate

With Conda on the system installed the dependencies for this project can be automatically installed in a new environment:

Go to the projects base directory.

Open a conda-command-prompt with admin privileges and run the commands from the project folder

  • to create a new environment with basic dependencies:
conda env create -f ./environment.yml
  • to activate the environment:
conda activate tdvisu

Install from source

To clone the complete repository:

git clone https://github.com/VaeterchenFrost/tdvisu

To download only the latest version from the default branch:

git clone --depth 1 --single https://github.com/VaeterchenFrost/tdvisu

To install the project from the source folder:

pip install -h (for more information on install options)
pip install .

to confirm that the visualization finds all dependencies:

python ./tdvisu/visualization.py -h

to run all tests:

pip install .[test]
pytest ./test/

How to use

The visualization needs input in the form of the Json API. The creation of this file is exemplary implemented in construct_dpdb_visu.py or the fork GPUSAT and --visufile filename (optionally disabling preprocessing with -p).

Run the python file with the above dependencies installed: visualization.py

visualization.py takes two parameters, the json-infile to read from, and optionally one outputfolder. With both arguments a run might look like this:

python tdvisu/visualization.py visugpusat.json examplefolder

For #SAT it produces for example three different graphs suffixed with a running integer to represent timesteps:

  • TDStep the tree decomposition with solved nodes
  • PrimalGraphStep the primal graph with currently active variables highlighted
  • IncidenceGraphStep the bipartite incidence graph with active clauses/variables highlighted

The graphs are images encoded in resolution independent .svg files (see https://www.lifewire.com/svg-file-4120603)

How to use construct_dpdb_visu.py

After installing the project dp_on_dbs with the there listed requirements, we need to

  • edit the database.ini with our password to postgresql
  • Solve a problem with python dpdb.py [GENERAL-OPTIONS] -f <INPUT-FILE> <PROBLEM> [PROBLEM-SPECIFIC-OPTIONS]
    • for the problem VertexCover
      • with flag --gr-file to store the htd Input (if the input was in a different format)
    • for the problem SharpSat
      • with flag --store-formula to store the formula in the database
  • Run
    • Sat / SharpSat: python construct_dpdb_visu.py [PROBLEMNUMBER]
    • VertexCover: python construct_dpdb_visu.py [PROBLEMNUMBER] --twfile [TWFILE] with the file in DIMACS tw-format containing the edges of the graph.

Installation of PostgreSQL Dependencies

TdVisu requires PostgreSQL client libraries for database connectivity through psycopg.

Windows

Install PostgreSQL from postgresql.org or use the client-only installer:

# Option 1: Full PostgreSQL installation (includes server + client)
# Download from: https://www.postgresql.org/download/windows/

# Option 2: Client libraries only (recommended for development)
# Download "Command Line Tools" from PostgreSQL download page

macOS

# Using Homebrew
brew install postgresql@16
# OR just the client libraries
brew install libpq

Linux (Ubuntu/Debian)

# Client libraries and development headers
sudo apt-get install postgresql-client-16 libpq-dev

# OR just client libraries for runtime
sudo apt-get install libpq5

Linux (CentOS/RHEL/Fedora)

# Client libraries and development headers  
sudo dnf install postgresql16 postgresql16-devel
# OR
sudo yum install postgresql-client postgresql-devel

Conda Environment

# Cross-platform solution
conda install postgresql libpq

Verification

After installing PostgreSQL, verify the installation:

pg_config --version  # Should show PostgreSQL version
python -c "import psycopg; print('✅ psycopg works!')"

Note: Whatever version of libpq psycopg is compiled with, it will be possible to connect to PostgreSQL servers of any supported version. Install the most recent libpq version available for your platform.

For more details see: https://www.psycopg.org/psycopg3/docs/basic/install.html


New Release

Version

  • Bump /version.py according to the changes made
  • Change date to the release day, keep format

Requirements

In case dependencies have changed, or just to update some, check

  • requirements.txt
  • stable-requirements.txt (using pip freeze)
  • setup.py

Write Changelog.md

  • Add tag with link (see bottom for linking examples)
  • Add changes, maybe some are already in Unreleased
  • Update Unreleased with (No) unreleased changes

Review code

  • Run tests (pytest)
  • Check codestyle (pylint)

Push

  • Push changes to main
  • Wait for all automated checks! (All checks have passed...)

Create Release

  • On the GitHub page go to: Release, Draft a new release
  • Enter v'YOUR VERSION NUMBER' as the tag.
  • Add a Release Title (could be just the version)
  • Add some description (like in the CHANGELOG.md)
  • Click on Publish release on the bottom

Should automatically release to PyPI

Now you are set for the new release 🎉


Metadata

Release files for tdvisu 1.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tdvisu 1.2.1
File Size Uploaded Provenance Actions
tdvisu-1.2.1.tar.gz 76.4 kB Without provenance Details for tdvisu-1.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for tdvisu 1.2.1
File Interpreter ABI Platform Actions
tdvisu-1.2.1-py3-none-any.whl Python 3 none any Details for tdvisu-1.2.1-py3-none-any.whl

Total release size: 136.5 kB

Release files / tdvisu-1.2.1.tar.gz

Download URL tdvisu-1.2.1.tar.gz
Size 76.4 kB
Tags Source
SHA-256 checksum
How to use checksums
820ef005e658ac65fe7dda15131750e3f826708d224984a2fcaf3784cb3110bb
BLAKE2b-256 checksum
How to use checksums
9756c78beb893e88c7c03a278e00f1fdd6a03b9206b3ac1dd076a4db05cd38cb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.16

Release files / tdvisu-1.2.1-py3-none-any.whl

Download URL tdvisu-1.2.1-py3-none-any.whl
Size 60.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e8451a914cb2d6cbc08291d225b349e27098fd39f33c3690c5108e9619fd9873
BLAKE2b-256 checksum
How to use checksums
6b39e75b98f9ee7059f8a9df38612050db7fd6e52c581c8b9ed00933627e7f1b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.16

Security for tdvisu 1.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page