Yog.Builder.ToroidalGraph (YogEx v0.70.0)

Copy Markdown View Source

A specialized grid graph result for toroidal (wrapping) grids.

Structurally identical to Yog.Builder.GridGraph, but with its own type to allow specialized rendering and behavioral hints.

Fields

  • graph - The underlying Yog graph
  • rows - Number of rows in the grid
  • cols - Number of columns in the grid
  • topology - Connection pattern (:rook, :queen, etc.)

Summary

Functions

Converts coordinate to ID.

Converts ID to coordinate.

Creates a new toroidal graph result.

Unwraps to a plain graph.

Converts to a standard GridGraph.

Types

t()

@type t() :: %Yog.Builder.ToroidalGraph{
  cols: non_neg_integer(),
  graph: Yog.graph(),
  rows: non_neg_integer(),
  topology: atom()
}

Functions

coord_to_id(grid, row, col)

Converts coordinate to ID.

id_to_coord(grid, id)

Converts ID to coordinate.

new(graph, rows, cols, topology \\ :rook)

@spec new(Yog.graph(), non_neg_integer(), non_neg_integer(), atom()) :: t()

Creates a new toroidal graph result.

to_graph(toroidal_graph)

@spec to_graph(t()) :: Yog.graph()

Unwraps to a plain graph.

to_grid_graph(toroidal)

@spec to_grid_graph(t()) :: Yog.Builder.GridGraph.t()

Converts to a standard GridGraph.