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.2.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.2-cp39-abi3-win_amd64.whl (245.7 kB view details)

Uploaded CPython 3.9+Windows x86-64

untangle_rs-0.2.2-cp39-abi3-win32.whl (229.1 kB view details)

Uploaded CPython 3.9+Windows x86

untangle_rs-0.2.2-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.2-cp39-abi3-musllinux_1_2_i686.whl (586.6 kB view details)

Uploaded CPython 3.9+musllinux: musl 1.2+ i686

untangle_rs-0.2.2-cp39-abi3-musllinux_1_2_armv7l.whl (646.5 kB view details)

Uploaded CPython 3.9+musllinux: musl 1.2+ ARMv7l

untangle_rs-0.2.2-cp39-abi3-musllinux_1_2_aarch64.whl (556.4 kB view details)

Uploaded CPython 3.9+musllinux: musl 1.2+ ARM64

untangle_rs-0.2.2-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (391.1 kB view details)

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

untangle_rs-0.2.2-cp39-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl (421.3 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ s390x

untangle_rs-0.2.2-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.2-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.2-cp39-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (382.5 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ARMv7l

untangle_rs-0.2.2-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (376.0 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ARM64

untangle_rs-0.2.2-cp39-abi3-macosx_11_0_arm64.whl (339.8 kB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

untangle_rs-0.2.2-cp39-abi3-macosx_10_12_x86_64.whl (350.9 kB view details)

Uploaded CPython 3.9+macOS 10.12+ x86-64

File details

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

File metadata

  • Download URL: untangle_rs-0.2.2.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.2.tar.gz
Algorithm Hash digest
SHA256 da49f3fc345ea61c1f86f5f2f2e62a486d74e166025d05d004d9fbf18cb97376
MD5 852d839381c6aa32eb8269da6de9ac05
BLAKE2b-256 996a80d32d9327e15eab7638b11c6609feb3dbc409ac7532054cef850bbeffb9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for untangle_rs-0.2.2-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 0d7b4a0d149771d20e08be5341e5a44f196fd4f32b6f10ea4d0b057e28653de4
MD5 172f2cffea0df526c06de9c8145a4ac9
BLAKE2b-256 8c7cf67beb60df2f7e61f0993a7e810e797882a475add7677be75cba7bb896b1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: untangle_rs-0.2.2-cp39-abi3-win32.whl
  • Upload date:
  • Size: 229.1 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.2-cp39-abi3-win32.whl
Algorithm Hash digest
SHA256 2937fc32fb93f266d3c5ba3c477ffd486cbd5adf207f60c2661dd4abab69cd24
MD5 1f8ac72d583c2c832a33f71a403c2c1c
BLAKE2b-256 6c9a0707ec6d83f381972437f4be26bc6f4e7e50f8a0913a82bc16942f166fdf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for untangle_rs-0.2.2-cp39-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 d1c6269504f7c1bdd8ab535829a97a92d1d2befd39beec8dc30bc5cee733b460
MD5 e4987ccc4316d67b6033c6cd07200d10
BLAKE2b-256 9f377cd557872cd79fbf9a2cfd27b5eb3f547f10fd8be7a0410e79b25841b17f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for untangle_rs-0.2.2-cp39-abi3-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 31f00c23c0676f79e079a4b91016453e77926ec554f89badeca7c5f987def34f
MD5 c998431e6814515f31b31fc691f44ace
BLAKE2b-256 3b0a893fa71954f7dbaf2cecc2ecc378fb4d1897f671cdc980b30bd9af877609

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for untangle_rs-0.2.2-cp39-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 40d3e3e637ca00940dd5b111d9f3e8e72f4d84d766283c39fb80179c2ccf2f04
MD5 a7a8585a871858bb9498cd2c8f790dce
BLAKE2b-256 8f6749fa0319e4d65718808b22d2f082f4c55f28e1ec4991ccc9d193ab55086e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for untangle_rs-0.2.2-cp39-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 cfab4151956a1dffb2c321f2520ef141ea42754c37205bb89733db1c20e4f708
MD5 29b4bc490b333b849f47fb7ae1e03b9a
BLAKE2b-256 e493afbbd20ab4529813d7fe85aebe33c9c8a13e89e0b738cc33d319e4051512

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for untangle_rs-0.2.2-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a7a06f411c9691281cd7f12459786124599105d48276b13d8f8a9720a9cab7d8
MD5 1dba229dc87f5cd8fc6c9b3bb5a4ddbe
BLAKE2b-256 4d71c7db879e2ad40ed3627baaf5e65afe8b65e37015bcb604ff911c5721c37f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for untangle_rs-0.2.2-cp39-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Algorithm Hash digest
SHA256 06294daaabe891bea01414138a53756ec90cca5a99fec1aef4511ed49398ca6d
MD5 89ac43aa8b0853c4d673caae0783f4c1
BLAKE2b-256 b3cbafde03ba5fb6a106610fee7bc1902f9da38c5825bb333df9640255b2f932

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for untangle_rs-0.2.2-cp39-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Algorithm Hash digest
SHA256 b1c5b166a3f885e25ecafc22bb91d83963674188f395ac7d7af854f5b02291fb
MD5 303cf3596fe7632b7ffc47d18e2a6366
BLAKE2b-256 55c3f0e4812f472ecb6d54266bf3b6a6d47b5c731d6c03173cc28908d966bb23

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for untangle_rs-0.2.2-cp39-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 6d8d00bdef710bf263bc2421ecf0cd4011b853b4ff52f081a018e795904d12d9
MD5 5c51c78361f6c9ecd3f18b81592d5d90
BLAKE2b-256 37942e8ee5b930549648bd496662c194eab089cf7daae38328aa33b5edb35701

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for untangle_rs-0.2.2-cp39-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 2c8f5f20bc941317d2729bae7863c732b3f707737e2d5d489827568079260912
MD5 5f6b3d985fd904c8e346aa49af0db6d8
BLAKE2b-256 9949fb92c0a76cc9c999ef5d34c73f07d0f7296ddf317c842b4051c177e57b63

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for untangle_rs-0.2.2-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 2c33d62b3a003a9a49a3235998c47276f605da89f48e39c65bf5b8eab6930ba2
MD5 4c639edaf58273059fa31485cd046049
BLAKE2b-256 115ff0b145a888aacf804f3106a0b8ef386cce9bc74ca15345ee01b2e865ae73

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for untangle_rs-0.2.2-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b2fc01a170ffb8c6f4071362aff69c00279fb5569bf655c24aae20e8ac1fca7a
MD5 b0f86c06d818b983158dc04b490b9e59
BLAKE2b-256 0087acf465fd9e2021c7509e157eaf92cb4db9911e1e27d77804a69e7e3185fc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for untangle_rs-0.2.2-cp39-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 c8a9a51f08b0782c15acc1f20d57b2f2bd19e97efec70c99d734871b24356b89
MD5 c7af3b5bb1841f6d57331284fe56351a
BLAKE2b-256 153eac4e1cf087beaa26a1d6f283a5964d57ea60eabe3cf0c06c46815559a1e3

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