WolframModel.HypergraphSVG (WolframModel v1.3.0)

Copy Markdown View Source

SVG rendering of a Hypergraph state.

Vertices are placed with a force-directed spring layout (Fruchterman-Reingold style). Rendering conventions:

  • Unary hyperedges: dashed ring around the vertex.
  • Binary hyperedges: directed line with an arrowhead (order preserved).
  • N-ary (3+) hyperedges: translucent filled polygon in a distinct colour per hyperedge, with a solid border.

Example

hg
|> WolframModel.HypergraphSVG.to_svg(title: "Step 5")
|> then(&File.write!("hypergraph.svg", &1))

# Render whole evolution history as a horizontal strip
model
|> WolframModel.HypergraphSVG.evolution_to_svg(max_snapshots: 8)
|> then(&File.write!("evolution.svg", &1))

# Render in a 3-column grid
model
|> WolframModel.HypergraphSVG.evolution_to_svg(max_snapshots: 12, columns: 3)
|> then(&File.write!("evolution.svg", &1))

Summary

Functions

Renders the full evolution_history of model as a grid of panels, oldest first. Each panel shows one hypergraph snapshot.

Returns an SVG string rendering hg.

Functions

evolution_to_svg(model, opts \\ [])

@spec evolution_to_svg(
  WolframModel.t(),
  keyword()
) :: String.t()

Renders the full evolution_history of model as a grid of panels, oldest first. Each panel shows one hypergraph snapshot.

Options:

  • :max_snapshots — maximum panels to show (default 6).
  • :panel_size — pixel size of each square panel (default 200).
  • :columns — number of panels per row (default: all panels in one row).

to_svg(hg, opts \\ [])

@spec to_svg(
  Hypergraph.t(),
  keyword()
) :: String.t()

Returns an SVG string rendering hg.

Options:

  • :width / :height — canvas size in pixels (default 500).
  • :title — optional label drawn at the top of the canvas.
  • :directed — draw arrowheads on binary edges (default true).