updateLayoutParameters method

  1. @override
void updateLayoutParameters({
  1. required double width,
  2. required double height,
  3. required double nodeRadius,
})
override

Specify the graph layout area and the radius of each node.

The layout algorithm must be aware of the node radius so that it does not produce a layout where some part of a node lies outside the node area boundaries.

Implementation

@override
void updateLayoutParameters({
  required double width,
  required double height,
  required double nodeRadius,
}) {
  super.updateLayoutParameters(
    width: width,
    height: height,
    nodeRadius: nodeRadius,
  );

  // This is a constant which depends on both the layout area and the node number.
  k = C *
      sqrt((layoutDimensions.x * layoutDimensions.y) /
          graph.adjacencyList.keys.length);
}