Skip to main content

This package contains an implementation of an algorithm that reduces the width of a given tree decomposition while removing a minimum number of edges. An example of use is:

    from treediet.graph_classes import Graph, Bag
    from treediet.tree_diet import tree_diet
        
    # Graph Definition
    G = Graph()
     
    for i in range(5):
        G.add_vertex(i)

    G.add_edge(0,1)
    G.add_edge(0,2)
    G.add_edge(0,3)

    G.add_edge(1,2)
    G.add_edge(1,3)

    G.add_edge(2,3)

    G.add_edge(1,4)
    G.add_edge(2,4)
    G.add_edge(3,4)

    # Tree Decomposition construction
    R = Bag([])

    B1 = Bag([0])
    B2 = Bag([0,1])
    B3 = Bag([0,1,2])
    B4 = Bag([0,1,2,3])
    B5 = Bag([1,2,3,4])

    R.add_child(B1)
    B1.add_child(B2)
    B2.add_child(B3)
    B3.add_child(B4)
    B4.add_child(B5)

    # Calling Dynamic Programming tree-diet algorithm
    OPT, real_edges, color_dictionary = tree_diet(R, G.adj, 2, [])

    print(OPT,real_edges, color_dictionary)

The output should be:

    >> 7, [(0, 1), (0, 2), (1, 2), (0, 3), (1, 3), (1, 4), (3, 4)], {1: {0: 1}, 2: {0: 1, 1: 1}, 3: {0: 1, 1: 1, 2: 1}, 4: {0: 1, 1: 1, 2: 3, 3: 1}, 5: {1: 1, 2: 3, 3: 1, 4: 1}}

Source code documentation

https://bmarchand-perso.gitlab.io/tree-diet/

Metadata

Release files for treediet 0.3.0

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

Source distribution (sdist)

Source distribution for treediet 0.3.0
File Size Uploaded Provenance Actions
treediet-0.3.0.tar.gz 24.9 kB Without provenance Details for treediet-0.3.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for treediet 0.3.0
File Interpreter ABI Platform Actions
treediet-0.3.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.17+ x86-64 Details for treediet-0.3.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
treediet-0.3.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.17+ x86-64 Details for treediet-0.3.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
treediet-0.3.0-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.9 CPython 3.9 Linux glibc 2.17+ x86-64 Details for treediet-0.3.0-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Total release size: 552.3 kB

Release files / treediet-0.3.0.tar.gz

Download URL treediet-0.3.0.tar.gz
Size 24.9 kB
Tags Source
SHA-256 checksum
How to use checksums
f5b18f9ab2b5d8e63f18cfd1e1d6907bc6b19572d8fe0a28cf473b3ee9ad31f8
BLAKE2b-256 checksum
How to use checksums
5a9b125e7507aa8a068bcb41d8e2ff7a78e81dc24216d8372d61581620ff28df
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.11

Release files / treediet-0.3.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL treediet-0.3.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 176.7 kB
Tags CPython 3.11 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
5aa8d355411ae4feab98a1df030e15ead1ed7fad8bf7882d8b99c35c2b5a5c14
BLAKE2b-256 checksum
How to use checksums
9c2d8f7dcd7b3a57e3973fd8d225ce683ae88eea92d7ef05da64835c17233799
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.11

Release files / treediet-0.3.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL treediet-0.3.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 175.2 kB
Tags CPython 3.10 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
fc94a614472a2f9fb0d850518ec2dde26460c7edc24da716c040fcd2762ac6f7
BLAKE2b-256 checksum
How to use checksums
aa57a2fd436814a313c30a3f35967f039bdaa8d1870b41911f76ec86296b5459
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.11

Release files / treediet-0.3.0-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL treediet-0.3.0-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 175.5 kB
Tags CPython 3.9 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
62440aac7316a57511c22915f994885e286519097589f90096e8db6273f65adb
BLAKE2b-256 checksum
How to use checksums
4830928a577387892d9a0c7bf41841900c1d2301d46528ea90cf805843c91473
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.11

Security for treediet 0.3.0

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