cluster_sim.app package

class cluster_sim.app.BrowserState(shape=(5, 5, 5), p_err=0.09, layout='Grid3D', seed=None, path_clicks=0, removed_nodes=<factory>, log='', camera_state=<factory>, offset=(0, 0, 0), plot_options=<factory>)

Bases: object

This class controls the default values when the app is loaded.

This class contains a local state of the web app, representing a persistent state on the user’s local browsing section.

Parameters:
camera_state: Dict[str, Any]
classmethod from_json(json_str)
layout: str = 'Grid3D'
log: str = ''
offset: tuple = (0, 0, 0)
p_err: float = 0.09
path_clicks: int = 0
plot_options: Dict[str, bool]
removed_nodes: set[int]
seed: int | None = None
shape: tuple[int, int, int] = (5, 5, 5)
to_json()
xoffset = 0
yoffset = 0
zoffset = 0
class cluster_sim.app.Grid3D(browser_state)

Bases: object

Parameters:

browser_state (BrowserState)

get_node_coords(index, log=False)

Get node coordinates from the grid shape and index.

Parameters:

index (int)

get_node_index(x, y, z)

Get the index from the coordinates.

Parameters:
Return type:

int

update_graph_with_layout(g)

Add the current layout to the PyGraph.

Parameters:

g (PyGraph) – PyGraph

cluster_sim.app.grid_graph_3d(shape)

Generate a Grid graph in rustworkx

Parameters:

shape (tuple[int, int, int]) – the shape

Returns:

rustworkx graph

Return type:

_type_

cluster_sim.app.rx_graph_to_plot(graph, browser_state)

Convert a rustworkx object to a plotly object.

Parameters:
Return type:

tuple[ndarray, ndarray, list[str]]

cluster_sim.app.update_plot_cytoscape(browser_state, G)

Main function that updates the plot.

Parameters:
cluster_sim.app.update_plot_plotly(plot_data, browser_state)

Main function that updates the plot.

Parameters:

Submodules

cluster_sim.app.layout module

class cluster_sim.app.layout.Grid3D(browser_state)

Bases: object

Parameters:

browser_state (BrowserState)

get_node_coords(index, log=False)

Get node coordinates from the grid shape and index.

Parameters:

index (int)

get_node_index(x, y, z)

Get the index from the coordinates.

Parameters:
Return type:

int

update_graph_with_layout(g)

Add the current layout to the PyGraph.

Parameters:

g (PyGraph) – PyGraph

cluster_sim.app.layout.rx_graph_to_plot(graph, browser_state)

Convert a rustworkx object to a plotly object.

Parameters:
Return type:

tuple[ndarray, ndarray, list[str]]

cluster_sim.app.layout.update_plot_cytoscape(browser_state, G)

Main function that updates the plot.

Parameters:
cluster_sim.app.layout.update_plot_from_simulator(G, browser_state)
Parameters:
Return type:

list[Scatter3d]

cluster_sim.app.layout.update_plot_plotly(plot_data, browser_state)

Main function that updates the plot.

Parameters:

cluster_sim.app.state module

class cluster_sim.app.state.BrowserState(shape=(5, 5, 5), p_err=0.09, layout='Grid3D', seed=None, path_clicks=0, removed_nodes=<factory>, log='', camera_state=<factory>, offset=(0, 0, 0), plot_options=<factory>)

Bases: object

This class controls the default values when the app is loaded.

This class contains a local state of the web app, representing a persistent state on the user’s local browsing section.

Parameters:
camera_state: Dict[str, Any]
classmethod from_json(json_str)
layout: str = 'Grid3D'
log: str = ''
offset: tuple = (0, 0, 0)
p_err: float = 0.09
path_clicks: int = 0
plot_options: Dict[str, bool]
removed_nodes: set[int]
seed: int | None = None
shape: tuple[int, int, int] = (5, 5, 5)
to_json()
xoffset = 0
yoffset = 0
zoffset = 0

cluster_sim.app.utils module

cluster_sim.app.utils.grid_graph_3d(shape)

Generate a Grid graph in rustworkx

Parameters:

shape (tuple[int, int, int]) – the shape

Returns:

rustworkx graph

Return type:

_type_