Optional layout adapter that shells out to GraphViz and imports computed
coordinates back into Yog.Layout position maps.
This module requires an external installation of GraphViz (the dot, neato,
etc. commands) to be present on your system's PATH.
Coordinates and Scaling
GraphViz computes coordinates in inches by default in its -Tplain output.
To align with typical screen pixels, this module scales coordinates by 72.0
(since standard resolution is 72 points per inch). You can customize this
using the :position_scale option.
Summary
Functions
Positions nodes using a GraphViz layout engine.
Functions
@spec layout( Yog.Graph.t() | Yog.Multi.Graph.t(), keyword() ) :: %{required(any()) => {float(), float()}}
Positions nodes using a GraphViz layout engine.
Supports both simple graphs (Yog.Graph) and multigraphs (Yog.Multi.Graph).
Options
:engine- The GraphViz engine to execute (e.g.:dot,:neato,:fdp,:circo,:twopi) (default::dot).:position_scale- Factor to multiply GraphViz coordinates by (default:72.0to convert inches to screen points/pixels).:dot_options- Map of custom DOT renderer options passed to the exporter.
Error Handling
Raises a RuntimeError if the GraphViz engine executable is not found on the
system's PATH, or if the command fails during execution.
Example
graph = Yog.directed() |> Yog.add_nodes_from([1, 2])
# Requires GraphViz installed on system PATH:
# positions = Yog.Layout.GraphViz.layout(graph, engine: :dot)
# => %{1 => {27.0, 90.0}, 2 => {27.0, 18.0}}