Produce an interactive bipartite-graph animation showing how a chosen linear-assignment algorithm transforms the matching over time. The result is an htmlwidget suitable for use in R Markdown, Quarto, pkgdown vignettes, Shiny apps, or standalone HTML output.
Usage
lap_animate(
cost,
method = "hungarian",
maximize = FALSE,
width = NULL,
height = NULL,
elementId = NULL,
...
)Arguments
- cost
Numeric cost matrix. Rows = workers/sources, columns = jobs/targets.
NAorInfentries mark forbidden assignments.- method
Character; the algorithm to animate. Must match one of the methods registered for animation (see
animated_methods()for the current list). Method names are the same strings used byassignment(), e.g."hungarian","jv","auction","gabow_tarjan".- maximize
Logical; if
TRUE, animate the maximization variant.- width, height
Optional explicit widget dimensions (pixels or CSS units).
- elementId
Optional DOM id for the widget container.
- ...
Algorithm-specific extra arguments forwarded to the trace function (e.g.
auction_eps).
Details
This is a teaching interface. It runs a slower R reference implementation
that emits a state trace at every step, then plays it back in the browser.
For production solving, use assignment() or lap_solve() which call the
fast C++ backends.
Animated methods
Animation support is added incrementally. Call animated_methods() to see
which method strings currently have a registered trace.
See also
assignment() for production solving, lap_solve() for the tidy
interface.