Bloccs.Web.Topology.Layout (bloccs_web v0.1.0)

Copy Markdown View Source

A pure, deterministic layered layout for a network's DAG — the server-side alternative to a client layout library. Each node is placed in a column by its longest path from a source, and in a row within that column; edges become cubic-bezier paths between the right and left faces of the hexagons.

Returns plain data (coords + SVG path strings) so Bloccs.Web.Panels.Topology is pure rendering and the layout is unit-testable without a browser. Live node state is layered on at render time, not here.

Summary

Functions

Compute the layout for a running network's topology.

Types

placed_edge()

@type placed_edge() :: %{from: atom(), to: atom(), path: String.t()}

placed_node()

@type placed_node() :: %{
  id: atom(),
  glyph: atom(),
  kind: atom(),
  label: String.t(),
  x: number(),
  y: number()
}

t()

@type t() :: %{
  width: number(),
  height: number(),
  nodes: [placed_node()],
  edges: [placed_edge()]
}

Functions

compute(network)

@spec compute(Bloccs.Introspect.Network.t()) :: t()

Compute the layout for a running network's topology.