ForceDirectedGraph<T>.generateNNodes constructor

ForceDirectedGraph<T>.generateNNodes({
  1. required int nodeCount,
  2. required T generator(),
  3. GraphConfig config = const GraphConfig(),
})

Generate a graph with n nodes, no edges. nodeCount is the node count. generator is the generator of the node data. Make sure the data is unique.

Implementation

ForceDirectedGraph.generateNNodes({
  required int nodeCount,
  required T Function() generator,
  this.config = const GraphConfig(),
}) {
  for (int i = 0; i < nodeCount; i++) {
    final node = Node(generator());
    nodes.add(node);
  }
}