pydistsim.gui.drawing.draw_current_state

draw_current_state(sim: Simulation | NetworkType, axes: Axes = None, clear: bool = True, tree_key: str = None, dpi: int = 100, node_radius: int | Callable[[Node], int] = 10, node_positions: dict | Callable[[], dict[Node, tuple[float, ...]]] = None, node_colors: dict | Callable[[], dict[Node, Any]] = None, edge_filter: list = None, show_messages: bool = True, message_colors: Callable[[Message, MessageType], Any] = None, message_size: int = None, show_legends: bool = True, space_for_legend: float = 0.15, show_labels: bool = True, node_labels: dict[Node, str] | Callable[[], dict[Node, str]] = None)[source]

Function to draw the current state of the simulation or network. This function is used to visualize the network and the messages in the network. Automatically determines the current algorithm and draws the network accordingly. This includes a mapping of node colors to the status of the nodes, as well as the messages in the network.

Parameters:
  • sim – Simulation or NetworkType object

  • axes – matplotlib axes object

  • clear – boolean to clear the axes before drawing

  • tree_key – key in nodes memory (dictionary) where tree data is stored

  • dpi – dots per inch

  • node_radius – radius of nodes

  • node_positions – dictionary of node positions or function to get node positions

  • node_colors – dictionary of node colors or function to get node colors

  • edge_filter – list of edges to draw

  • show_messages – boolean to show messages in the network

  • show_legends – boolean to show legends

  • space_for_legend – space for legend, as a porcentage of the figure

  • show_labels – boolean to show labels of nodes

  • node_labels – dictionary of node labels or function to get node labels

Returns:

matplotlib figure object