WeightedWalkable<E>.generate constructor

const WeightedWalkable<E>.generate({
  1. required Iterable<(E, double)> successors(
    1. E node
    ),
  2. required Iterable<E> roots(),
})

Creates a weighted walkable which generates successors dynamically.

The successors function is called whenever a node is accessed, and the roots function is called whenever the roots are accessed. This allows for lazy generation of nodes and edges.

Implementation

const factory WeightedWalkable.generate({
  required Iterable<(E, double)> Function(E node) successors,
  required Iterable<E> Function() roots,
}) = _GeneratedWeightedWalkable<E>;