--- id: grandalf version: "0.8" license: GPLv2 | EPLv1 license_treatment: copyleft maintenance: dormant --- # grandalf — Graph and drawing algorithms framework License: copyleft · Maintenance: dormant · Downloads: 2.8M/mo ## 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 above — 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 pip install grandalf uv add grandalf 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: unspecified - Install friction: low - Maintenance: dormant - Downloads: 2.8M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags graph layout algorithms, node coordinate computation, hierarchical graph drawing, force-directed graph layout, edge routing for graphs, sugiyama layout implementation, graph visualization coordinates, graph-layout, visualization-geometry, experimental-algorithms [View on SkillFed](https://skillfed.io/packages/grandalf) · [View on PyPI](https://pypi.org/project/grandalf/)