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 Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

treediet-0.2.2-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.2.2-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.2.2-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.2.2-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for treediet-0.2.2-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 d2bde91270145918bf486bc01277a77a250cfc73d3ae9b500b0e0c0184dcbc82
MD5 c877833aa7a6f4bba503bd1834214df7
BLAKE2b-256 d58dab15eb06670308ef80b9a02b5a5c84c48e46dab7abc91553912021858499

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for treediet-0.2.2-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 7abbe7a046142256d7cda21de56cabf48ecb41a125decf80dba03170af356179
MD5 e8791199fe7d961bd231ce86ff27b2c3
BLAKE2b-256 e7c4ab60f51121ab222a7cd24aa6105e77827c980011e8105c996713d958aa9e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for treediet-0.2.2-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 a942c6afcb5e8ebbc6f0a6d7c9739278bba8520f33cf4e7ceec8c9c620302fa0
MD5 61a182b6fa022f486af5c55c2919cc30
BLAKE2b-256 6d1b9273393e8e591f45ea90e85131d32dccb103b0a895312db21403b0c3f777

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