Skip to content

GraphPlot rewritten as a layout engine; new HypergraphPlot ; v0.237 - #83

Merged
stblake merged 1 commit into
mainfrom
book-new-chapters
Oct 1, 2026
Merged

stblake merged 1 commit into
mainfrom
book-new-chapters

Conversation

@msollami

Copy link
Copy Markdown
Collaborator

Summary

GraphPlot was minimal: every vertex on a circle, directed edges drawn as plain lines, axes on. This rewrites it as a deterministic layout engine (src/graph/glayout.c) plus a drawing layer, and adds HypergraphPlot. v0.237.

Changes

  • Default layouts: stress majorization (SMACOF on BFS distances, starting from Pivot MDS, with circle/Tutte starts and a crossing count for small components), tidy layered trees, and layered DAGs (dummy vertices, barycentre ordering). Components are shelf-packed.
  • GraphLayout -> "StressEmbedding" | "SpringElectricalEmbedding" | "CircularEmbedding" | "LayeredEmbedding" | "LayeredDigraphEmbedding" | "BipartiteEmbedding" | "GridEmbedding".
  • Options: VertexCoordinates (list or rules), VertexLabels (placed in the widest gap), GraphHighlight, VertexStyle, EdgeStyle, EdgeLabels (including "EdgeWeight"), VertexSize. Any other option passes through to Graphics.
  • Directed edges become Arrows that stop at the target disk; mutual pairs are offset.
  • New HypergraphPlot: each hyperedge is drawn as an inflated translucent convex hull, a size-2 hyperedge as a stadium and a size-1 hyperedge as a ring, over a stress layout of the star expansion.
  • PDF export: Text offsets, Text[Style[...]] size/colour, the Arrowheads directive with clipped shafts, and equal scaling for an explicit AspectRatio -> Automatic.
  • Docs: graphs.md, hypergraphs.md, file-io.md and the 2026-09-28 changelog.

Testing

  • New graphplot_tests covers determinism, every layout and option, degenerate graphs, and graphs with 500–1500 vertices.
  • leaks reports 0.

JIRA Ticket

N/A

GraphPlot was a minimal version: every vertex on a circle, directed edges as
plain lines, axes on. It is now a deterministic layout engine
(src/graph/glayout.c) plus a drawing layer:

- Default layouts: stress majorization (SMACOF on BFS distances, from a
  Pivot MDS start, with circle/Tutte starts and a crossing count for small
  components), tidy layered trees, and layered DAGs (dummy vertices,
  barycentre ordering). Components are shelf-packed.
- GraphLayout -> "StressEmbedding" | "SpringElectricalEmbedding" |
  "CircularEmbedding" | "LayeredEmbedding" | "LayeredDigraphEmbedding" |
  "BipartiteEmbedding" | "GridEmbedding".
- Options: VertexCoordinates (list or rules), VertexLabels (placed in the
  widest gap), GraphHighlight, VertexStyle, EdgeStyle, EdgeLabels
  (including "EdgeWeight"), VertexSize. Other options pass through to
  Graphics.
- Directed edges become Arrows that stop at the target disk; mutual pairs
  are offset.

HypergraphPlot (new) draws each hyperedge as an inflated convex hull
(translucent), a size-2 hyperedge as a stadium and a size-1 hyperedge as a
ring, over a stress layout of the star expansion.

PDF export gains Text offsets and Text[Style[...]] size/colour, the
Arrowheads directive with clipped shafts, and equal scaling for an explicit
AspectRatio -> Automatic.

New graphplot_tests covers determinism, every layout and option, degenerate
graphs and 500-1500 vertex graphs; leaks reports 0.
@stblake
stblake merged commit b7a7c5c into main Oct 1, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants