Skip to main content

Library that minimises edge crossings in a hierarchical multipartite graph

Project description

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)
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.1.0.tar.gz (20.0 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.1.0-cp39-abi3-win_amd64.whl (219.3 kB view details)

Uploaded CPython 3.9+Windows x86-64

untangle_rs-0.1.0-cp39-abi3-win32.whl (211.2 kB view details)

Uploaded CPython 3.9+Windows x86

untangle_rs-0.1.0-cp39-abi3-musllinux_1_2_x86_64.whl (537.1 kB view details)

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

untangle_rs-0.1.0-cp39-abi3-musllinux_1_2_i686.whl (569.3 kB view details)

Uploaded CPython 3.9+musllinux: musl 1.2+ i686

untangle_rs-0.1.0-cp39-abi3-musllinux_1_2_armv7l.whl (629.1 kB view details)

Uploaded CPython 3.9+musllinux: musl 1.2+ ARMv7l

untangle_rs-0.1.0-cp39-abi3-musllinux_1_2_aarch64.whl (536.9 kB view details)

Uploaded CPython 3.9+musllinux: musl 1.2+ ARM64

untangle_rs-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (372.8 kB view details)

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

untangle_rs-0.1.0-cp39-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl (402.9 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ s390x

untangle_rs-0.1.0-cp39-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl (487.5 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ppc64le

untangle_rs-0.1.0-cp39-abi3-manylinux_2_17_i686.manylinux2014_i686.whl (394.7 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ i686

untangle_rs-0.1.0-cp39-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (365.5 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ARMv7l

untangle_rs-0.1.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (357.1 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ARM64

untangle_rs-0.1.0-cp39-abi3-macosx_11_0_arm64.whl (320.3 kB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

untangle_rs-0.1.0-cp39-abi3-macosx_10_12_x86_64.whl (332.3 kB view details)

Uploaded CPython 3.9+macOS 10.12+ x86-64

File details

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

File metadata

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

File hashes

Hashes for untangle_rs-0.1.0.tar.gz
Algorithm Hash digest
SHA256 147d53e10463d612a3b6eeca5c06b82481491eebc1c802d0258cd288017e07fc
MD5 c2da1128e261dc856fa1a7ff540a9d92
BLAKE2b-256 9ebe9ee3fdb57a354b1b8995969552707e6f35d40b9cc1ac9e894e62cceafd0b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for untangle_rs-0.1.0-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 30cd6aa73800a3604ae5e7696ad35b24f5cd5c34bb5f6287e32f20896e51d88d
MD5 daba82f499a2118768de3128f2289d7e
BLAKE2b-256 c64526dcd0d0cd4c651cbd8a910598bd1e36e9c43043a2d01910ac8314b54071

See more details on using hashes here.

File details

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

File metadata

  • Download URL: untangle_rs-0.1.0-cp39-abi3-win32.whl
  • Upload date:
  • Size: 211.2 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.1.0-cp39-abi3-win32.whl
Algorithm Hash digest
SHA256 9dac0813d840da5d8eb63e540f45253685bfc97b3a381be9b92ee0924f7fe85d
MD5 8c236e2ffb5d9e7d21d84075357fdcb8
BLAKE2b-256 5fa0715101faeb44ef6d2765d21bce50ecf5398303063a1ec45088d848198f81

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for untangle_rs-0.1.0-cp39-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 1c08a1b9a855289168464f230332ad6490b076c05695a1894345fdd6906b0270
MD5 71fb4e01a8aff4a509732848b142435a
BLAKE2b-256 6e4865675daad9859d8345e3b072f129084bf25163f12d6e9d9b757d806d8e15

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for untangle_rs-0.1.0-cp39-abi3-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 0467962c3a3ba5cacaf5636bcdb21cef8ddbae122a9856fd72ce5cd459555115
MD5 2e3a673969999ea85cb4f1e2e5f46b73
BLAKE2b-256 1ac00a6984154e980d6e8a49876c5fae54982f56f8bbb30279c993c0378379f0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for untangle_rs-0.1.0-cp39-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 6ab03a754d83a0ccfed4e4ee7d9f718ff0b0051b8365269e6ed4c34c9656caae
MD5 0d01c1334f508e285a842127c7780040
BLAKE2b-256 a8c89877ae3af0e73d4793c2ed830bfff5ea737009108b88ac9404821185103c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for untangle_rs-0.1.0-cp39-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 f5cd0be5a895804b544181eb3ae50a356ee51d1a499a7b40173b934098c5436e
MD5 2b87a7cfd5e0c0f522fc7febd74dd101
BLAKE2b-256 257653b25b296a0288ab5f7669b5c6ad23f27b7f20bc88078e320e193a2b3d45

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for untangle_rs-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1301595d1da2fb7ce8376ecd2191a61f4e67a84527bef3e2c99cb6ba0b4d00e2
MD5 5007d58b8685b552b11e59da24b8c198
BLAKE2b-256 46100f1c1b50436b4202a97c1e948749fb664ac74c7ed4ec232fe1573a8f344f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for untangle_rs-0.1.0-cp39-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 d3ca2f62fb5a46121d1d195c369f2ddce8981e63242d8e0288b3e391bb9d500f
MD5 2820d6c2dfc4396954a41d1419275a39
BLAKE2b-256 f7b9c0d67f521ab0c6ac3d5f89b75afa47c2c660c9d159482cdd9260e53c57f9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for untangle_rs-0.1.0-cp39-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 55bd6aab37c49fd548ac60e7c8e3d4858ec24e6ab2a313ea902a6ccc67a889b9
MD5 31f4123228c6b3ada467a6fef6036b5c
BLAKE2b-256 aa44250a55ff770ea21d26ca4ca1548a4153b91f9c8e10efe725ff2b53a554ef

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for untangle_rs-0.1.0-cp39-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 c98c43fdc9f5e4fdbbf4a2e0bfce2648f4674cff7964fa9c1f2a613e56551118
MD5 7681fe64fc8446044de6d58432b1f71f
BLAKE2b-256 9f57d7a541b95af31c8bbd6788ade688407f01fa00224ea475498c4671d02509

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for untangle_rs-0.1.0-cp39-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 f0444ef39275e07263632e77eb5caecdde20b540e831ddb1661a8061914f3cba
MD5 c162e21cf01c4779e6de69614b83efad
BLAKE2b-256 e3d6251a9ca12b6311482f035b21f1efb6f196abd4dca8d64567b15df5f3b420

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for untangle_rs-0.1.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b8bf10b336a1794c280fcb2bd0f1825f2fe929d844af8e975096535c45a9583f
MD5 417646f1cd9562e3b01de3dcfa963edd
BLAKE2b-256 affdea0b3431f86d1805acd8bb8e112ca1962f42f00da4899a0838a537a54baa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for untangle_rs-0.1.0-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 21e916075afd5cc811d27d960e881737a3eecb93d764a69526dd1919ef1287d8
MD5 1e3fba923eac92ed7a0255d1261767ea
BLAKE2b-256 c2ef26808d83377c5a269b15753c0512ec758f727ec176be022c63138101bea1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for untangle_rs-0.1.0-cp39-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 3a5b0cfa1b75d3cd38ba3943b3feb738e26fb404d8a1d30e22a64c5de46354ed
MD5 d0d1700beaea6eb03b1179a96016d6e0
BLAKE2b-256 f7d1d06ae711704c58176dbbed1cd7c60a3740477fcadf64e692d82f73742ea8

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