ForceAtlas2 Layout

ForceAtlas2 Layout#

graphistry.layout.fa2.compute_bounding_boxes(self, partition_key, engine)#

Returns the bounding boxes for each partition based on the center coordinates and dimensions of the nodes. DF keys: - cx: Center x-coordinate - cy: Center y-coordinate - w: Width - h: Height - partition_key: Partition key

Parameters:
  • self (Plottable)

  • partition_key (str)

  • engine (Engine)

Return type:

Any

graphistry.layout.fa2.fa2_layout(g, fa2_params=None, circle_layout_params=None, singleton_layout=None, partition_key=None, engine=EngineAbstract.AUTO)#

Applies FA2 layout for connected nodes and circle layout for singleton (edgeless) nodes

Allows optional parameterization of the circle layout, e.g., sort keys

Parameters:
  • g (graphistry.Plottable.Plottable) – The graph object with nodes and edges, in a format compatible with Graphistry’s Plottable object.

  • fa2_params (Optional[Dict[str, Any]]) – Optional parameters for customizing the Force-Atlas 2 (FA2) layout, passed through to fa2_layout.

  • circle_layout_params (Optional[Dict[str, Any]]) – Optional parameters for customizing the circle layout, passed through to general_circle_layout. Can include: - by: Column name(s) for sorting nodes (default: ‘degree’). - ascending: Boolean(s) to control sorting order. - ring_spacing: Spacing between rings in the circle layout. - point_spacing: Spacing between points in each ring.

  • singleton_layout (Optional[Callable[[Plottable, Tuple[float, float, float, float] | Any], Plottable]]) – Optional custom layout function for singleton nodes (default: circle_layout).

  • partition_key (Optional[str]) – The key for partitioning nodes (used for picking bounding box type). Default is None.

  • engine (EngineAbstract | str)

Returns:

A graph object with FA2 and circle layouts applied.

Return type:

graphistry.Plottable.Plottable