hgf_widgets library

Flutter widgets for hgf networks: belief trajectory plots that re-draw thousands of trials per frame, and a network graph view.

Classes

BandLayer
A shaded band, either center ± scale / √precision (a belief and its uncertainty) or between explicit bounds.
HgfColors
Series colours, from a colour-vision-checked categorical palette, stepped separately for light and dark surfaces.
HgfTrajectoryView
One plot per node, top level first, then the total surprise: the Flutter counterpart of pyhgf's plot_trajectories.
LineLayer
A line through the samples.
NetworkGraph
A drawing of a Network's graph: inputs at the bottom, value coupling as solid arrows, volatility coupling as dashed ones (as in pyhgf's plot_network). Tap a node to select it.
NetworkLayout
A layered drawing of a Network: inputs on the bottom row, each other node one row above its highest child, ordered within rows to keep edges short (barycentre sweeps).
PlotGeometry
Where the plot area sits in the widget.
PlotLayer
Something drawn in a TrajectoryPlot, indexed by trial (sample t is at x = t). Non-finite values are gaps.
PlotStyle
Colours and sizes of a TrajectoryPlot; PlotStyle.of derives them from the theme.
PlotViewport
The visible x window (trials) of one or more linked TrajectoryPlots, as (first, last) x coordinates; null shows every trial.
PlotViewportBar
An overview of a PlotViewport: the visible window as a thumb on a track over the whole series (drag it, or tap the track, to pan), zoom buttons, a reset, and the visible trials.
PointLayer
A dot per sample (observations).
ReferenceLine
A horizontal reference line at value (e.g. chance level).
SeriesReducer
Reduces a series to what can be seen at a given pixel width, so drawing costs O(pixels), not O(samples).
TrajectoryPlot
A time-series plot of one or more PlotLayers over trials, built to re-draw thousands of samples every frame: each layer is reduced to at most two points per pixel column before drawing (see SeriesReducer).

Enums

EdgeKind
Whether an edge carries value or volatility coupling.

Functions

defaultNodeLabel(int node) → String
The default node label: x₀, x₁, ... as in the HGF literature (by node index, as pyhgf numbers them).
finiteRange(Float64List values, int first, int last) → (double, double)?
The finite minimum and maximum of values[first..last], or null if there are none.
formatTick(double v, double step) → String
A tick label with as many digits as the tick step needs, so that neighbouring ticks never print the same.
niceTicks(double lo, double hi, {int target = 4}) → List<double>
About target "nice" tick values (steps of 1, 2 or 5 × 10ⁿ) covering [lo, hi].

Typedefs

GraphEdge = ({int child, EdgeKind kind, int parent, double strength})
A directed parent → child edge.