skillfed

grandalf

Graph and drawing algorithms framework

grandalf v0.8 2.8M downloads/30d#2,870 on PyPI268
Copyleft license GPLv2 | EPLv1 DORMANT released

What it is and what it does

Grandalf is a pure-Python graph layout library that solves the geometric problem of positioning nodes and routing edges for visualization. It implements two layout strategies: Sugiyama (hierarchical/dot-style) and force-driven (energy minimization), each designed to be simple enough to read and modify. The library does not handle rendering—it computes coordinates and edge paths, leaving the actual drawing to your choice of graphics toolkit (matplotlib, Qt, GTK, etc.).

The package is intentionally lightweight (about 1500 lines total, with individual algorithms under 600 lines) and trades speed for simplicity and hackability. It targets experimental work and small-to-medium graphs rather than production-scale visualization. With only pyparsing as a runtime dependency and no graphics toolkit requirement, it integrates easily into headless or custom rendering pipelines.

Use it for:

  • Compute node positions for a hierarchical flowchart or organizational chart, then render with your preferred graphics library.
  • Prototype a force-directed graph layout algorithm by modifying the energy minimization code directly.
  • Generate graph coordinates in a headless environment (server, CLI tool) without requiring a display or graphics toolkit.
  • Integrate graph layout into a custom visualization pipeline where you control rendering separately from layout.
  • Experiment with graph drawing algorithms in a small, readable codebase without the overhead of heavyweight libraries.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Grandalf computes node coordinates and routes edges for graph layouts using Sugiyama hierarchical or force-driven algorithms, then leaves the actual drawing to your graphics toolkit of choice.

Yes, if you need graph layout coordinates for experimental or small-scale work and want to control rendering separately. The low install friction and copyleft license are straightforward. However, dormant maintenance (last release January 2023) means you should not expect bug fixes or updates; use it only if the current feature set meets your needs and you are comfortable maintaining a fork if required.

Install

grandalf on PyPI

pip

pip install grandalf

uv

uv add grandalf

poetry

poetry add grandalf

Installing grandalf

Before you install

Low friction: pure Python with only pyparsing as a runtime dependency, distributed as a wheel. Dormant maintenance status—last release was 2023-01-10 and no commits since 2024-08-10—means bug fixes or feature updates are unlikely, though the codebase is small and stable.

License in practice

Dual-licensed under GPLv2 and EPLv1 (copyleft). Any derivative work or distribution must comply with copyleft terms; proprietary or closed-source projects may face licensing constraints.

Quickstart

pip install grandalf

from grandalf.graphs import Graph, Vertex, Edge
from grandalf.layouts import SugiyamaLayout

v1, v2 = Vertex('a'), Vertex('b')
g = Graph()
g.add_vertices(v1, v2)
g.add_edge(Edge(v1, v2))
layout = SugiyamaLayout(g)
layout.compute_layout()
print(v1.x, v1.y)  # Node coordinates

Verify before relying

  • Whether the package works reliably with modern Python versions (requires_python is unspecified in metadata).
  • Performance characteristics for graphs approaching the 'thousands of nodes' upper bound mentioned in the description.

Package facts

License GPLv2 | EPLv1 (copyleft)
Python support not specified
Install friction low — pure-Python wheel
Runtime dependencies 1 — pyparsing
Maintenance dormant — 1,312 days since the last release
Last repo commit
First released
Downloads 2,833,940/month — #2,870 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: grandalf-0.8-py3-none-any.whl

Keywords: graph, drawings, graphviz, networkx

Development Status :: 3 - AlphaIntended Audience :: DevelopersLicense :: OSI Approved :: GNU General Public License v2 (GPLv2)Programming Language :: Python :: 3

Tags

graph layout algorithmsnode coordinate computationhierarchical graph drawingforce-directed graph layoutedge routing for graphssugiyama layout implementationgraph visualization coordinates
graph-layoutvisualization-geometryexperimental-algorithms

More Graphics packages