Skip to main content

Node Labeling

This repository implements a two-phase algorithm for labeling line diagrams of ordered sets.

Usage

Install via PyPI

Install the package from PyPI using pip.

pip install node-labeling

Execute the layout generation using the node-labeling command.

node-labeling

Install from source

Clone the repository and initialize the environment. uv will automatically create a virtual environment and sync dependencies based on the pyproject.toml.

uv sync

Execute the layout generation using uv run to ensure the correct environment context.

uv run node-labeling

The script will prompt you for a path to a .graphml file. Each node needs x/y position data, and optionally general data as a plain string and extent/intent label data (;-separated names). To export the final layout to a PDF add the --export flag.

uv run node-labeling --export

The --export flag also works with the PyPI install:

node-labeling --export

Use as a library

Node Labeling can also be called directly from Python via node_labeling.label.

from node_labeling import label

# graphml is a path to a .graphml file
labels = label('path/to/graph.graphml')

By default label returns the final label placement for every node as a dict mapping label id to LabelCandidate. Pass export=True to instead write the final layout to a PDF in figs/.

label('path/to/graph.graphml', export=True)

Pass a Config instance to override any parameter listed below.

from node_labeling import label
from node_labeling.utils.config import Config

labels = label('path/to/graph.graphml', cfg=Config(top_k=200))

Configuration

Category Parameter Description
Dev Mode plot Whether to plot intermediate steps
runtime Whether to display runtime information
Data label_config Label configuration
Visualize font_size Font size for labels
k_rows Number of rows for layout
max_row_chars Maximum characters per row
Grid grid_step Grid step size
min_label_dist Minimum label distance from drawing
max_label_dist Maximum label distance from drawing
top_k Top k labels to consider
Weights (cost) w_align Anchor alignment
w_angle Natural angle
w_boundary Close to polygon boundary
w_binder Length of binding line
w_binder_intersect Penalty for binder intersecting another label
w_binder_cross Penalty for crossing binding lines
w_tight_overlap Penalty for ink overlaps
w_overlap Penalty for padding overlaps
w_padding Penalty for padding
w_miss Penalty for unplaced label
w_type Penalty for label type mismatch
Hungarian Solver max_hungarian_iterations Maximum iterations for the Hungarian solver
max_hungarian_fixes Maximum fixes for the Hungarian solver
iter_penalty_multiplier Multiplier for penalties in each iteration of the Hungarian solver
Forces w_inner_proximity Weight for pushing away from internal drawing
w_global_proximity Weight for pushing away from other overflow labels
w_spring Weight for pulling toward node
w_binder_dodge Weight for pushing binder away from fixed labels
w_half_plane Weight for keeping labels in the correct half plane
force_iterations Number of iterations for force refinement
force_step_size Step size for force refinement
min_binder_length Minimum length for binding lines

License

Shield: CC BY 4.0

This work is licensed under a Creative Commons Attribution 4.0 International License.

CC BY 4.0

Metadata

Release files for node-labeling 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for node-labeling 1.0.2
File Size Uploaded Provenance Actions
node_labeling-1.0.2.tar.gz 42.2 kB Without provenance Details for node_labeling-1.0.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for node-labeling 1.0.2
File Interpreter ABI Platform Actions
node_labeling-1.0.2-py3-none-any.whl Python 3 none any Details for node_labeling-1.0.2-py3-none-any.whl

Total release size: 97.0 kB

Release files / node_labeling-1.0.2.tar.gz

Download URL node_labeling-1.0.2.tar.gz
Size 42.2 kB
Tags Source
SHA-256 checksum
How to use checksums
96beb7f08dc0208c95e41c54a55025b6a805c63f7e09fbe8f74140389643567d
BLAKE2b-256 checksum
How to use checksums
9a4420c53e4d5705f6badd2a6f48a6359a55c6e64ed6a7e57d6e092a299cd015
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.15 {"installer":{"name":"uv","version":"0.9.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"25.10","id":"questing","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / node_labeling-1.0.2-py3-none-any.whl

Download URL node_labeling-1.0.2-py3-none-any.whl
Size 54.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2b2c3b36538c3a19d6d1efbdaf88b8c85b15b6809e7bd748fbfb05ac821b4b5b
BLAKE2b-256 checksum
How to use checksums
236cff0467df809e082c5dc74e8168fca41adced369a53690b6e58ca4ab2005d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.15 {"installer":{"name":"uv","version":"0.9.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"25.10","id":"questing","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for node-labeling 1.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.2 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page