helios.layouts.forceatlas2gpu

IPC-ForceAtlas2: Network Layout using cuGraph

ForceAtlas2 layout algorithm through IPC using cuGraph.

ForceAtlas2

class helios.layouts.forceatlas2gpu.ForceAtlas2(edges, network_draw, weights=None, lin_log_mode=False, edge_weight_influence=1.0, jitter_tolerance=1.0, barnes_hut_optimize=True, barnes_hut_theta=1.0, scaling_ratio=2.0, strong_gravity_mode=False, gravity=1.0)[source]

Bases: helios.layouts.base.NetworkLayoutIPCRender

Performs the ForceAtlas2 algorithm using the cugraph lib.

The ForceAtlas will be called inside of a different process which comunicates with this object through the SharedMemory

Notes

Python 3.8+ is required to use this

Parameters
  • edges (ndarray) –

  • network_draw (NetworkDraw) –

  • weights (array, optional) – edge weights

  • lin_log_mode (bool, default False) –

  • edge_weight_influence (float, default 1.0) –

  • jitter_tolerance (float, default 1.0) –

  • barnes_hut_optimize (bool, default True) –

  • barnes_hut_theta (float, default 1.0) –

  • scaling_ratio (float, default 2.0) –

  • strong_gravity_mode (bool, default False) –

  • gravity (float, default 1.0) –

cleanup()

Release the shared memory resources

start(ms=30, steps=100, iters_by_step=2, record_positions=False, without_iren_start=True)

This method starts the network layout algorithm creating a new subprocess.

Right after the network layout algorithm finish the computation (ending of the related subprocess), the stop method will be called automatically.

Parameters
  • ms (float) – time interval in milleseconds to update the positions inside of the NetworkDraw

  • steps (int) – number of steps; snapshots. For example, if you set steps=3 that means the positions will be updated three times.

  • iters_by_step (int) – number of interations in each step

  • record_positions (bool, optional, default True) – Record the positions of the network

  • without_iren_start (bool, optional, default True) – Set this to False if you will start the ShowManager. That is, if you will invoke the following commands

Examples

>>> network_draw.initialize()
>>> network_draw.start()
stop()

Stop the layout algorithm

update()

This method updates the position of the network actor and right after that refresh the network draw

ForceAtlas2ServerCalc

class helios.layouts.forceatlas2gpu.ForceAtlas2ServerCalc(edges_buffer_name, positions_buffer_name, info_buffer_name, weights_buffer_name=None, snapshots_buffer_name=None, num_snapshots=0, lin_log_mode=False, edge_weight_influence=1.0, jitter_tolerance=1.0, barnes_hut_optimize=True, barnes_hut_theta=1.0, scaling_ratio=2.0, strong_gravity_mode=False, gravity=1.0)[source]

Bases: helios.layouts.base.NetworkLayoutIPCServerCalc

This Obj. reads the network information stored in a shared memory resource and execute the ForceAtlas2 layout algorithm

Parameters
  • edges_buffer_name (str) – The name of the shared memory buffer where the edges are stored

  • positions_buffer_name (str) – The name of the shared memory buffer where the positions are stored.

  • info_buffer_name (str) –

  • weights_buffer_name (str, optional) –

  • snapshots_buffer_name (str, optional) –

  • num_snapshots (int, optional) –

  • lin_log_mode (bool, default False) –

  • edge_weight_influence (float, default 1.0) –

  • jitter_tolerance (float, default 1.0) –

  • barnes_hut_optimize (bool, default True) –

  • barnes_hut_theta (float, default 1.0) –

  • scaling_ratio (float, default 2.0) –

  • strong_gravity_mode (bool, default False) –

  • gravity (float, default 1.0) –

start(steps=100, iters_by_step=3)[source]

This method starts the network layout algorithm.

Parameters
  • steps (int) – number of iterations to perform

  • iters_by_step (int) – number of iterations to perform between each step