Skip to content

fabilab/ilayoutx

Repository files navigation

builds.sr.ht status Github Actions ReadTheDocs status PyPI pyversions PyPI wheels Coverage

ilayoutx

Compute fast network layouts. Intended as the upstream companion for iplotx.

NOTE: This software is alpha quality. The API is very much in flux, and the documentation is sparse. Use at your own risk.

Installation

pip install ilayoutx

To include support for fast arithmetic, parallelisation, and visualisation:

pip install ilayoutx[all]

Resources

Quickstart

import networkx as nx
import ilayoutx as ilx

G = nx.circulant_graph(4, [1])
layout = ilx.layouts.multidimensional_scaling(G)

Features

Layouts

  • Shapes:

    • line
    • circle (supports vertex sizes)
    • shell
    • spiral
  • Grid or lattice:

    • square
    • triangular
  • Force-directed:

    • spring (Fruchterman-Reingold)
    • ARF
    • Forceatlas2
    • Kamada-Kawai
    • GEM (graph embedder)
    • Geometric (from netgraph)
    • LGL (from igraph)
  • Directed acyclic graphs (DAGs):

    • Sugiyama including edge routing (only for directed graphs ATM).
  • Machine learning:

    • UMAP (supports arbitrary graphs, not just knn graphs)
  • Other:

    • bipartite
    • multipartite
    • random (supports vertex sizes)
    • multidimensional scaling (MDS)

Packings

Edge routing

ilayoutx includes routines to route edges in a visually pleasing way. This is generally tricky not only because aesthetics are subjective, but also because the task is somewhat dependent on the level of zoom of the downstream visualisation (intuitively, when zoomed out, things tend to look more crowded). Edge routing can be used in iplotx via the waypoints keyword argument of the network function.

The following edge routing algorithms are implemented:

  • Sugiyama edge routing for DAGs.

Wishlist

  • Tree-like:
    • Reingold-Tilford

Rationale

The layout code is in Rust and exposed to Python via the amazing PyO3, with the goal to combine speed (by the machine) with comfort (for the user).

I'm a rust beginner, please be kind when judging this codebase. Feel free to open an issue on SourceHut if you have questions.

Authors

Fabio Zanini (https://fabilab.org)