Skip to main content

Library that minimises edge crossings in a hierarchical multipartite graph

Project description

PyPI version PyPI downloads Coverage Build

untangle-rs

Library that minimises edge crossings in weighted multipartite graphs, with support for respecting node hierarchy. It uses a simple metropolis-hastings algorithm that iteratitely swaps neighboring nodes in order to minimize the number of crossings. It is unlikely to find a global minimum but does converge to optimal solutions.

Basic example Basic example

Basic layouts

You can minimize the crossings in arbitrary multipartite graphs, as long as you provide the parts of the graph:

from untanglers import LayoutOptimizerInt

nodes = [
  [0,1,2],
  [3,4,5],
  [6,7,8],
]

edges = [
  # node_a, node_b, edge_weight
  [(0, 4, 1), (1, 3, 5)],
  [(4, 8, 2), (5, 6, 1)]
]

optimizer = LayoutOptimizerInt(nodes, edges)
edge_crossings = optimizer.count_crossings()
new_crossings = optimizer.optimize(
  start_temp = 1.0,
  end_temp = 0.1,
  steps = 3,
  max_iterations = 20,
  passes = 5,
)

Complicated example More complicated graph

Hierarchical layouts

In case certain nodes need to remain grouped together, the optimizer also supports hierarchy. This is useful for visualizing e.g. data lineage where columns in a table should remain together.

from untanglers import HierarchyOptimizerInt

nodes = ...
edges = ...

hierarchy = [
  # 2 levels, note that the coarser level is aligned with the finer level
  [[4,5,6,5], [9, 11]],
  [[7, 20, 13], [27, 13]],
  [[8, 9, 6, 7], [17, 13]],
]

optimizer = HierarchyOptimizerInt(nodes, edges, hierarchy)
new_crossings = optimizer.optimize(...)

Hierarchical example Graph with 2 levels of node hierarchy

Download files

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

Source Distribution

untangle_rs-0.2.1.tar.gz (20.1 kB view details)

Uploaded Source

Built Distributions

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

untangle_rs-0.2.1-cp39-abi3-win_amd64.whl (244.6 kB view details)

Uploaded CPython 3.9+Windows x86-64

untangle_rs-0.2.1-cp39-abi3-win32.whl (228.3 kB view details)

Uploaded CPython 3.9+Windows x86

untangle_rs-0.2.1-cp39-abi3-musllinux_1_2_x86_64.whl (555.4 kB view details)

Uploaded CPython 3.9+musllinux: musl 1.2+ x86-64

untangle_rs-0.2.1-cp39-abi3-musllinux_1_2_i686.whl (585.6 kB view details)

Uploaded CPython 3.9+musllinux: musl 1.2+ i686

untangle_rs-0.2.1-cp39-abi3-musllinux_1_2_armv7l.whl (645.7 kB view details)

Uploaded CPython 3.9+musllinux: musl 1.2+ ARMv7l

untangle_rs-0.2.1-cp39-abi3-musllinux_1_2_aarch64.whl (555.4 kB view details)

Uploaded CPython 3.9+musllinux: musl 1.2+ ARM64

untangle_rs-0.2.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (390.3 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ x86-64

untangle_rs-0.2.1-cp39-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl (420.3 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ s390x

untangle_rs-0.2.1-cp39-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (503.8 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ppc64le

untangle_rs-0.2.1-cp39-abi3-manylinux_2_17_i686.manylinux2014_i686.whl (416.4 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ i686

untangle_rs-0.2.1-cp39-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (381.6 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ARMv7l

untangle_rs-0.2.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (375.0 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ARM64

untangle_rs-0.2.1-cp39-abi3-macosx_11_0_arm64.whl (338.9 kB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

untangle_rs-0.2.1-cp39-abi3-macosx_10_12_x86_64.whl (350.5 kB view details)

Uploaded CPython 3.9+macOS 10.12+ x86-64

File details

Details for the file untangle_rs-0.2.1.tar.gz.

File metadata

  • Download URL: untangle_rs-0.2.1.tar.gz
  • Upload date:
  • Size: 20.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.9.4

File hashes

Hashes for untangle_rs-0.2.1.tar.gz
Algorithm Hash digest
SHA256 94c7ce5d4f1368b7a2ec383f33b4121a07fe95fbb89f3c46c6c7b76b84a63c8f
MD5 5cc61b9a96ec8a825329474693160211
BLAKE2b-256 97c75b2b2a5b1868610428006856c8069dbd2643ad29a1722083247d67a4f80f

See more details on using hashes here.

File details

Details for the file untangle_rs-0.2.1-cp39-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for untangle_rs-0.2.1-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 02d56a019a86bdc60baaeb30f8fc8252b521e127585b966f8ce72fc6bc9f46a3
MD5 53cf66edab4cfdcc94a3c0590966c0ae
BLAKE2b-256 b5f3a542b62d7304e2408b274b3fb7866faaa1cca06de2392fd83ed9f48ecbdf

See more details on using hashes here.

File details

Details for the file untangle_rs-0.2.1-cp39-abi3-win32.whl.

File metadata

  • Download URL: untangle_rs-0.2.1-cp39-abi3-win32.whl
  • Upload date:
  • Size: 228.3 kB
  • Tags: CPython 3.9+, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.9.4

File hashes

Hashes for untangle_rs-0.2.1-cp39-abi3-win32.whl
Algorithm Hash digest
SHA256 7e04653a131c314447bbdfb3202a4707fcf7f4ed2903e99421a506f40e327056
MD5 698fe8751b92e35c9a117b00a8faa605
BLAKE2b-256 3f9eae838d00bdc0114f8ec08baa2ac7978d4e46601e1697240d077b6953ed53

See more details on using hashes here.

File details

Details for the file untangle_rs-0.2.1-cp39-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for untangle_rs-0.2.1-cp39-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 9a54f94b038cfd8c259023b71a387d15ec85ecad5bfea9d7552f5e8f339db98b
MD5 3d8b59821841d636be44aee8288de625
BLAKE2b-256 a405861f86bde21986484ed87cd930eda39003dda933267904dadb8231b4f0e9

See more details on using hashes here.

File details

Details for the file untangle_rs-0.2.1-cp39-abi3-musllinux_1_2_i686.whl.

File metadata

File hashes

Hashes for untangle_rs-0.2.1-cp39-abi3-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 77307fd76aef56be95f92042b835216e1c258250e2cf52a128cb8f5ff0c184c0
MD5 4115488a8440b62d19b3dd8134a851d9
BLAKE2b-256 921be9bef0d0f5829edc703acfd239adecfb58f581a3ae7271635614d28942b5

See more details on using hashes here.

File details

Details for the file untangle_rs-0.2.1-cp39-abi3-musllinux_1_2_armv7l.whl.

File metadata

File hashes

Hashes for untangle_rs-0.2.1-cp39-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 5ee19c523448d6d4f2fcdb6a02fb65c69cf4fcadd6cad1219822077b077a2b29
MD5 c0607a0b4e3caecbf7e03122ae281937
BLAKE2b-256 9282084b4bd89c34c72ec109a0647b37c175e0efdc4052beaedc8dc30802e1f9

See more details on using hashes here.

File details

Details for the file untangle_rs-0.2.1-cp39-abi3-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for untangle_rs-0.2.1-cp39-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 a239556c274df98cd9ecbd941081f0d61a9c95c58635aaa214a726bb86b1ca46
MD5 d3f9fb74ecafc008a4ef205cbc7cfe48
BLAKE2b-256 948f5dc9cf09fee6d78001d951efe99439b3112ca036a4269f206a974d88910f

See more details on using hashes here.

File details

Details for the file untangle_rs-0.2.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for untangle_rs-0.2.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 84189e3ec3462366c8bb218e9dbe5e3c5c1504a9147ea3eb5a4c47ac8ff960a2
MD5 9c15a51ceee7f756c78bb56be50805dc
BLAKE2b-256 cbf4c2e2bb462a1b78b4ab9253341aed9688fdef2905e030c57a44fb84d40685

See more details on using hashes here.

File details

Details for the file untangle_rs-0.2.1-cp39-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl.

File metadata

File hashes

Hashes for untangle_rs-0.2.1-cp39-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 04959a2e2a48913679381ba0cc835692e459c493d456f41529cc871d343b19d3
MD5 5631fa33d4910e07de9aa04285a00340
BLAKE2b-256 476cc62b6ccb7506d1f44a77f249c51b9f81d601fe428ddf9618738da2357cc9

See more details on using hashes here.

File details

Details for the file untangle_rs-0.2.1-cp39-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl.

File metadata

File hashes

Hashes for untangle_rs-0.2.1-cp39-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 ddc506b500622a21b4be7cec0b81449d1e6e786f4d5b1108f81672af851a70a5
MD5 92810aa30c08c98c5404bac8a6c1b525
BLAKE2b-256 9cbca82905d351360f69595c194160d428ab54e35475078925cd249d506e7d5a

See more details on using hashes here.

File details

Details for the file untangle_rs-0.2.1-cp39-abi3-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for untangle_rs-0.2.1-cp39-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 93d58c7a90c13fc51eb5ca66d68e27ce1702147ccdc28829398cce9b6ae2ac83
MD5 afc8d52f697707ffdd6eda7bd27447f3
BLAKE2b-256 d13465e15ccb2b80b2d0332b38c5b91a8abba157c977c5365ae179a9c6ad11c0

See more details on using hashes here.

File details

Details for the file untangle_rs-0.2.1-cp39-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl.

File metadata

File hashes

Hashes for untangle_rs-0.2.1-cp39-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 9be5d4f838686ee133db4da693313eacc36c93c2debf9bf6a33b31b143d7e033
MD5 d2c3ada02b6a8d14e0be80f7815b3134
BLAKE2b-256 60b4e3db732de5492b158b67186f01d4e0f2e0d771345a55c201263aad3312e9

See more details on using hashes here.

File details

Details for the file untangle_rs-0.2.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for untangle_rs-0.2.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 4542fc1393b93c6841552c1b5b4499ead9944fd8df98483f83121b12bb2f4edc
MD5 ddfc7ce64ed0903fa89934d5d3040b48
BLAKE2b-256 3dc01cfa92103b9be3a3666a37e84c6ff9125f3dc3468f275f5807705315f7f4

See more details on using hashes here.

File details

Details for the file untangle_rs-0.2.1-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for untangle_rs-0.2.1-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a8dd478a475166f5552aac6258e04d4eae1fa4f68cd3efcf2815a474dcf5b590
MD5 e3c3252a61c969dca33afa877c786858
BLAKE2b-256 f68e3ba58ed19febf8e25dfdac171190cd59858b61eccc601390fd69569829c8

See more details on using hashes here.

File details

Details for the file untangle_rs-0.2.1-cp39-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for untangle_rs-0.2.1-cp39-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 b9531a0a20efc7fbfb2c0cc56c73fa4b2ceb1718b0ece03401ac0e1d7c24a773
MD5 5e3e14d750c131c086bc961068604a0e
BLAKE2b-256 eb08b0a0b8b55d2597d7237b11257c7c2844329f8f7f16bc33873a60b44e4e69

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