WolframModel.MultiwayGraphSVG (WolframModel v1.3.0)

Copy Markdown View Source

SVG rendering of the multiway evolution graph (DAG or tree).

Accepts the DAG structure returned by WolframModel.multiway_explore_dag/2:

%{
  root:  canonical_key,
  nodes: %{canonical_key => %WolframModel{}},
  edges: MapSet.t({from_key, to_key})
}

Nodes are drawn as rounded boxes labelled with vertex count, edge count, and generation. Each depth level is a horizontal row. Edges are drawn as curved arrows. The root node is highlighted.

Example

WolframModel.multiway_explore_dag(universe, 3)
|> WolframModel.MultiwayGraphSVG.to_svg()
|> then(&File.write!("multiway.svg", &1))

Summary

Functions

Returns an SVG string for dag.

Functions

to_svg(dag, opts \\ [])

@spec to_svg(
  %{root: term(), nodes: map(), edges: MapSet.t()},
  keyword()
) :: String.t()

Returns an SVG string for dag.

Options:

  • :width — canvas width in pixels. When provided the layout is scaled horizontally so the graph fills exactly this width. Computed automatically when omitted.
  • :height — canvas height in pixels. Computed automatically when omitted.