Visualization utilities documentation

bang.visualization.draw_blocks(pbn: PBN, filename: str | None = None, format: Literal['pdf', 'png', 'svg'] = 'svg', number_from_one: bool = False) Digraph

Plot the blocks of a Probabilistic Boolean Network (PBN).

This function creates a directed graph where each node represents a block in the PBN, and each edge represents a transition between blocks.

Parameters:
  • pbn (PBN) – The Probabilistic Boolean Network (PBN) to plot.

  • filename (str, optional) – The filename to save the graph. If None, the graph is not saved.

  • format (Literal['pdf', 'png', 'svg']) – The format to save the graph in. Default is ‘svg’.

Returns:

A graphviz.Digraph object representing the block graph.

Return type:

graphviz.Digraph

bang.visualization.draw_dependencies(pbn: PBN, filename: str | None = None, format: Literal['pdf', 'png', 'svg'] = 'svg', number_from_one: bool = False) Digraph

Plot the dependency graph of a Probabilistic Boolean Network (PBN).

This function creates a directed graph where each node represents a variable in the PBN, and each edge represents a dependency between variables.

Parameters:
  • pbn (PBN) – The Probabilistic Boolean Network (PBN) to plot.

  • filename (str, optional) – The filename to save the graph. If None, the graph is not saved.

  • format (Literal['pdf', 'png', 'svg']) – The format to save the graph in. Default is ‘svg’.

Returns:

A graphviz.Digraph object representing the dependency graph.

Return type:

graphviz.Digraph

bang.visualization.draw_trajectory_ndarray(trajectory: ndarray, filename: str | None = None, format: Literal['pdf', 'png', 'svg'] = 'svg', show_labels: bool = True, bit_length: int | None = None) Digraph

Plot the trajectory of a Probabilistic Boolean Network (PBN).

This function creates a directed graph where each node represents a state in the trajectory, and each edge represents a transition between states.

Parameters:
  • trajectory (np.ndarray) – The trajectory to plot, where each row represents a state.

  • filename (str, optional) – The filename to save the graph. If None, the graph is not saved.

  • format (Literal['pdf', 'png', 'svg']) – The format to save the graph in. Default is ‘svg’.

  • show_labels (bool) – Whether to show labels on the nodes. Default is True. If set to False, the nodes are represented as points.

Returns:

A graphviz.Digraph object representing the trajectory graph.

Return type:

graphviz.Digraph