helios.layouts.base

Network Layout Abstract Classes

This module provides a set of abstract classes to deal with different network layouts algorithms using different communication strategies.

List of Functions

is_running

helios.layouts.base.is_running(p, timeout=0)[source]

Check if the process p is running

Parameters
  • p (process) –

  • timeout (float, optional) – positive float

Returns

running

Return type

bool

NetworkLayoutIPCRender

class helios.layouts.base.NetworkLayoutIPCRender(network_draw, edges, weights=None)[source]

Bases: abc.ABC

An abstract class which reads the network information and creates the shared memory resources.

Parameters
  • network_draw (NetworkDraw) – A NetworkDraw object which will be used to draw the network

  • edges (ndarray) – a bi-dimensional array with the edges list

  • weights (array, optional) – a one-dimensional array with the edge weights

cleanup()[source]

Release the shared memory resources

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

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()[source]

Stop the layout algorithm

update()[source]

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

NetworkLayoutIPCServerCalc

class helios.layouts.base.NetworkLayoutIPCServerCalc(num_nodes, num_edges, edges_buffer_name, positions_buffer_name, info_buffer_name, weights_buffer_name=None, dimension=3, snaphosts_buffer_name=None, num_snapshots=0)[source]

Bases: abc.ABC

An abstract class which reads the network information from the shared memory resources.

This should be used inside of a subprocess which will update the network layout positions

Parameters
  • num_nodes (int) –

  • num_edges (int) –

  • edges_buffer_name (str) –

  • positions_buffer_name (str) –

  • info_buffer_name (str) –

  • weights_buffer_name (str, optional) –

  • dimension (int) –

  • snaphosts_buffer_name (str, optional) –

  • num_snapshots (int, optional) –

abstract 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