helios.layouts.mde.MDE

class helios.layouts.mde.MDE(edges, network_draw, weights=None, use_shortest_path=True, constraint_name=None, anchors=None, anchors_pos=None, penalty_name=None, penalty_parameters=None, attractive_penalty_name='log1p', repulsive_penalty_name='log')[source]

Bases: helios.layouts.base.NetworkLayoutIPCRender

Minimum Distortion Embedding algorithm running on IPC

This call the PyMDE lib running in a different process which comunicates with this object through SharedMemory from python>=3.8.

References

[1] A. Agrawal, A. Ali, and S. Boyd, “Minimum-Distortion Embedding,” arXiv:2103.02559 [cs, math, stat], Mar. 2021, Accessed: Jul. 24, 2021. http://arxiv.org/abs/2103.02559

Notes

Python 3.8+ is required to use this

Parameters
  • edges (ndarray) – the edges of the graph. A numpy array of shape (n_edges, 2)

  • network_draw (NetworkDraw) – a NetworkDraw object

  • weights (array, optional) – edge weights. A one dimensional array of shape (n_edges, )

  • use_shortest_path (bool, optional) – If set to True, shortest path is used to compute the layout

  • constraint_name (str, optional) – centered, standardized or anchored

  • anchors (array, optional) – a list of vertex that will be anchored

  • anchors_pos (ndarray, optional) – The positions of the anchored vertex

  • penalty_name (str, optional) – cubic, huber, invpower, linear, log, log1p, logratio, logistic, power, pushandpull or quadratic

  • penalty_parameters (array, optional) – the parameters of the penalty function

  • attractive_penalty_name (str, optional) – cubic, huber, invpower, linear, log, log1p, logratio, logistic, power, pushandpull or quadratic

  • repulsive_penalty_name (str, optional) – cubic, huber, invpower, linear, log, log1p, logratio, logistic, power, pushandpull or quadratic

Methods

cleanup

Release the shared memory resources

start

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

stop

Stop the layout algorithm

update

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

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