terror / terror/dotgraph

Hierarchical layout (Sugiyama method)

Open
#4 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Rust
Stars
0
Forks
0
PR merge metrics
No merged PRs in 30d

Description

Directed graphs need a hierarchical/layered layout, which is what Graphviz's `dot` engine produces. This is the Sugiyama method, consisting of four sub-steps.

First, cycle removal via DFS to identify and reverse back edges, storing a `reversed` flag so rendering can restore the original direction. Second, layer assignment using longest-path layering, which assigns each node to a rank. Edges spanning multiple layers get virtual (dummy) nodes inserted so every edge spans exactly one layer; these become bend points in the final rendering. Third, crossing minimization using the barycenter heuristic with alternating sweeps (~24 passes) to reduce edge crossings between adjacent layers. Fourth, coordinate assignment using a simplified Brandes-Kopf approach, spacing nodes within layers by `nodesep` (default 72pt) and layers by `ranksep` (default 36pt). The `rankdir` attribute (TB/BT/LR/RL) is handled by swapping axis semantics.

Cluster handling requires constraining cluster nodes to contiguous positions within their layers, then computing cluster bounding boxes after coordinate assignment. Special cases include self-loops (excluded from layering, rendered as curved paths), multi-edges, disconnected components (laid out independently then composed), and the `rank` attribute for same/min/max/source/sink constraints.

References

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No implementation files or tests are named. Start by reviewing the linked Graphviz and layered graph drawing references, then map the four required Sugiyama stages and the listed cluster, loop, multi-edge, component, and rank constraints onto the renderer. Done means hierarchical layouts support those stages, rankdir, spacing, and the stated special cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
data-visualization
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.