Skip to main content

https://link.springer.com/article/10.1186/s13015-022-00213-z

Project description

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/

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

treediet-0.3.0.tar.gz (24.9 kB view details)

Uploaded Source

Built Distributions

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

treediet-0.3.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (176.7 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

treediet-0.3.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (175.2 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

treediet-0.3.0-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (175.5 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

File details

Details for the file treediet-0.3.0.tar.gz.

File metadata

  • Download URL: treediet-0.3.0.tar.gz
  • Upload date:
  • Size: 24.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for treediet-0.3.0.tar.gz
Algorithm Hash digest
SHA256 f5b18f9ab2b5d8e63f18cfd1e1d6907bc6b19572d8fe0a28cf473b3ee9ad31f8
MD5 dbbb7a61cc534955b154eed16c8c10f2
BLAKE2b-256 5a9b125e7507aa8a068bcb41d8e2ff7a78e81dc24216d8372d61581620ff28df

See more details on using hashes here.

File details

Details for the file treediet-0.3.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for treediet-0.3.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 5aa8d355411ae4feab98a1df030e15ead1ed7fad8bf7882d8b99c35c2b5a5c14
MD5 3c2b7b8a60c89527cd5aa68eea7f2f48
BLAKE2b-256 9c2d8f7dcd7b3a57e3973fd8d225ce683ae88eea92d7ef05da64835c17233799

See more details on using hashes here.

File details

Details for the file treediet-0.3.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for treediet-0.3.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 fc94a614472a2f9fb0d850518ec2dde26460c7edc24da716c040fcd2762ac6f7
MD5 8fe2652f8561005330134cc5345bd1dc
BLAKE2b-256 aa57a2fd436814a313c30a3f35967f039bdaa8d1870b41911f76ec86296b5459

See more details on using hashes here.

File details

Details for the file treediet-0.3.0-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for treediet-0.3.0-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 62440aac7316a57511c22915f994885e286519097589f90096e8db6273f65adb
MD5 9642cdefcea957ac96a84e7caa463b36
BLAKE2b-256 4830928a577387892d9a0c7bf41841900c1d2301d46528ea90cf805843c91473

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