Skip to main content

Library that minimises edge crossings in a hierarchical multipartite graph

Project description

PyPI version PyPI downloads Build Coverage

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.0.tar.gz (20.2 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.0-cp39-abi3-win_amd64.whl (245.8 kB view details)

Uploaded CPython 3.9+Windows x86-64

untangle_rs-0.2.0-cp39-abi3-win32.whl (230.9 kB view details)

Uploaded CPython 3.9+Windows x86

untangle_rs-0.2.0-cp39-abi3-musllinux_1_2_x86_64.whl (556.3 kB view details)

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

untangle_rs-0.2.0-cp39-abi3-musllinux_1_2_i686.whl (585.9 kB view details)

Uploaded CPython 3.9+musllinux: musl 1.2+ i686

untangle_rs-0.2.0-cp39-abi3-musllinux_1_2_armv7l.whl (646.3 kB view details)

Uploaded CPython 3.9+musllinux: musl 1.2+ ARMv7l

untangle_rs-0.2.0-cp39-abi3-musllinux_1_2_aarch64.whl (556.0 kB view details)

Uploaded CPython 3.9+musllinux: musl 1.2+ ARM64

untangle_rs-0.2.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (391.2 kB view details)

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

untangle_rs-0.2.0-cp39-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl (421.1 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ s390x

untangle_rs-0.2.0-cp39-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (504.6 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ppc64le

untangle_rs-0.2.0-cp39-abi3-manylinux_2_17_i686.manylinux2014_i686.whl (416.9 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ i686

untangle_rs-0.2.0-cp39-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (382.2 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ARMv7l

untangle_rs-0.2.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (375.4 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ARM64

untangle_rs-0.2.0-cp39-abi3-macosx_11_0_arm64.whl (339.5 kB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

untangle_rs-0.2.0-cp39-abi3-macosx_10_12_x86_64.whl (351.0 kB view details)

Uploaded CPython 3.9+macOS 10.12+ x86-64

File details

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

File metadata

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

File hashes

Hashes for untangle_rs-0.2.0.tar.gz
Algorithm Hash digest
SHA256 ad8b0aaf438916ff5b2189078ebeaf23ccaf29b28353dd4fc5f2f7f463baec52
MD5 958a131f40be48f71534c134c568b93a
BLAKE2b-256 26e968cc7883ec589a866a89e7148172baf6b2ce5e2e3bd93e9990911ec4abf0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for untangle_rs-0.2.0-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 6bdcca42fbedaa85df7a6db11868884eba547343cc6a126006fc2d902b89d541
MD5 42716d6dce05d4aacff44499c803933e
BLAKE2b-256 66363f5026aafa9ad4e2fe1f539421fba4de1dfb3a4e0aed9572acaf79ebc251

See more details on using hashes here.

File details

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

File metadata

  • Download URL: untangle_rs-0.2.0-cp39-abi3-win32.whl
  • Upload date:
  • Size: 230.9 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.0-cp39-abi3-win32.whl
Algorithm Hash digest
SHA256 c1c2573e9ceb2c881381c6b45f3ac49209549897c196f989c2cd2e8be648eaed
MD5 1dd622a7fdadd42edf8177073289c8b4
BLAKE2b-256 50fa73db1e5dc875a6d4b3e9316cba035be63f53f776ffa131f03b31820fd5db

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for untangle_rs-0.2.0-cp39-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 86b09c508aad5e83990049ef071d651e22b0b224d924517785fe93af4cfc5973
MD5 1bf2addf6a9da629fbf0c48a4434b396
BLAKE2b-256 17a1e25297a83a4511a555a9ca53d31bea2b21b7ea8f2d1205891cccc84a83c7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for untangle_rs-0.2.0-cp39-abi3-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 9b47170801d5d0790a3a470038fc9710302dbbc60896d8bb5e1cc658e2465e75
MD5 1ee2d0eba82b7b66d87f403ed9e10645
BLAKE2b-256 24410c71641e6fcb1bbd27939f2b315763f96a1204ed1a4b2e68160c656b2bd1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for untangle_rs-0.2.0-cp39-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 402024bcf7d728aab16e88ad53a0864fd616144a816fa8fec4766140039a5e8f
MD5 8a48739020f87d2394adce0ce125ce3b
BLAKE2b-256 66c63434e150e05613c173c9a2e3b9653f31fd889b5f735d70569d5d2e2ca96e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for untangle_rs-0.2.0-cp39-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 17dd5d7ceeda331bb0b0a4a627570c298b9850c57bd368cc144413715cce8dc5
MD5 5b49cadba24d7aa299f0bce5fdf55353
BLAKE2b-256 6c2a78a8c2d514dcc60f3c31e18ed1e02077b1b2c16258f85dfd74a761681522

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for untangle_rs-0.2.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a8859ad98e1fb2f8bf957c5f9ab452fb749c78d2feeac7a3b3a6e458b65b8e43
MD5 7dbf8f849891306ff5f5b18e1014e0fb
BLAKE2b-256 94434f295f3557f74ba684b73d0b021d38efe15afb8bf00d3b3bb22e9b86ee29

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for untangle_rs-0.2.0-cp39-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 0a9f837911081e1c5494bb27d87e6c7224b9f9651a152d64e8004c69e17b4950
MD5 1e668931791a5fbbb9fdb2edb6d65828
BLAKE2b-256 970c9ecc389afcbf9432fa8937a8bf912590516d966364a61c92925fbb7c9ea0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for untangle_rs-0.2.0-cp39-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 786757e30bde390591c940be3cce28a6be2d19f63b39301eaf72794a95ced002
MD5 66694d071f75be974935d13bc5234d1a
BLAKE2b-256 ba5de0f4048fdb11ddd8041f9ba3771f1778cb282887268584e91df702423c71

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for untangle_rs-0.2.0-cp39-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 ba63b5a9e74739251deba8645f8aa10a310640f2ae5a8bae500190f15ef68481
MD5 1681d4c9480be2fc5002e794c31e3d9a
BLAKE2b-256 561ece95b8e226fef41e9ded7744c512e863da5e957c50ad39dad4db8abaf580

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for untangle_rs-0.2.0-cp39-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 8c38ea8a842318aba521e79c6c23eb31af97783cde0ae667c227c2a3334853ea
MD5 8831bf50ad20a3f3ce91a6220eb0dec7
BLAKE2b-256 21ed0259fd4c09415c9ad41d98d6119a0f6c9506bff301babec14a04e7ab50f4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for untangle_rs-0.2.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 ca70062a35d702ef138992d945bf6549a8d726a86ce3f532d5cc7881485431ec
MD5 980e84d482ccf95204f41a1a0c62445a
BLAKE2b-256 b1ec66adf57d32dd8b2a358c448347794af9211eaaabf352c5365880088a90da

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for untangle_rs-0.2.0-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0926d6333dcb56fbf826f2ec7b16a38d1c71dd53086d50d3f1337829f097d2cd
MD5 80f16abab6db4f74d08103cc8152463f
BLAKE2b-256 670322480189a7f889f844f64f41ccc4468e258fb0cd595cd3e1bc940c1c726a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for untangle_rs-0.2.0-cp39-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 c46fed59c0c2181235b540a9999ef2dda48a61437d3a10576574691fd8e8f9be
MD5 fa9dddcd29b0d0c920ac3a7bbdb5ccdd
BLAKE2b-256 4d7a35db74e4375159ba1abd5158189554bed7121f7a8a2a44c488d8e8bc3ff3

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