helios.layouts.mde¶
IPC-PyMDE: Minimum-Distortion Embedding Network Layout
This module implements a IPC Network Layout to be used with PyMDE[1]. The IPC layout grants a non-blocking behavior for PyMDE. PyMDE solves minimum-distortion embedding problem using pytorch.
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 or greater is a requirement for this module.
- ivar ~helios.layouts.mde._CONSTRAINTS
- vartype ~helios.layouts.mde._CONSTRAINTS
dict
- ivar ~helios.layouts.mde._PENALTIES
- vartype ~helios.layouts.mde._PENALTIES
dict
List of Objects¶
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
-
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
MDEServerCalc¶
-
class
helios.layouts.mde.
MDEServerCalc
(num_nodes, num_edges, edges_buffer_name, positions_buffer_name, info_buffer_name, dimension=3, weights_buffer_name=None, snapshots_buffer_name=None, num_snapshots=0, penalty_name=None, penalty_parameters_buffer_name=None, num_penalty_parameters=None, attractive_penalty_name='log1p', repulsive_penalty_name='log', use_shortest_path=False, constraint_name=None, constraint_anchors_buffer_name=None, num_anchors=None)[source]¶ Bases:
helios.layouts.base.NetworkLayoutIPCServerCalc
This Obj. reads the network information stored in a shared memory resource and execute the MDE layout algorithm
- Parameters
num_nodes (int) –
num_edges (int) –
edges_buffer_name (str) –
positions_buffer_name (str) –
info_buffer_name (str) –
weights_buffer_name (str, optional) –
snapshots_buffer_name (str, optional) –
num_snapshots (int, optional) –
dimension=3 (int, optional) – layout dimension
penalty_name (str, optional) –
penalty_parameters_buffer_name (str, optional) –
num_penalty_parameters (int, optional) –
attractive_penalty_name (str, optional) –
repulsive_penalty_name (str, optional) –
use_shortest_path (str, optional) –
constraint_name (str, optional) –
constraint_anchors_buffer_name (str, optional) –
num_anchors (int, optional) –