BNMPy.vis¶
- BNMPy.vis.build_igraph_pbn(logic_rules, edge_probabilities)[source]¶
Build igraph for PBN with multiple rules per node.
- BNMPy.vis.create_matplotlib_extension_visualization(logic_rules, new_nodes, new_edges)[source]¶
Create a matplotlib-based visualization for extension comparison.
- BNMPy.vis.create_matplotlib_visualization(logic_rules, removed_nodes=None, removed_edges=None, measured_nodes=None, perturbed_nodes=None)[source]¶
Create a matplotlib-based visualization for Jupyter notebooks.
- BNMPy.vis.extract_logic_rules_from_network(network)[source]¶
Extract logic rules from a BooleanNetwork or PBN object using stored equations.
- Args:
network: BooleanNetwork or ProbabilisticBN object
- Returns:
dict: Mapping from variable names to their logic rules (for BN) or list of rules (for PBN) dict: Mapping from edges to probabilities (for PBN) or empty dict (for BN)
- BNMPy.vis.read_logic_rules(source)[source]¶
Reads logic rules from a file path or from a string containing rules.
- Args:
source (str): Path to the file or the string containing logic rules.
- Returns:
dict: Mapping from variable names to their logic rules.
- BNMPy.vis.vis_compression(original_network, compressed_network, compression_info, output_html='compression_comparison.html', interactive=False)[source]¶
Visualize the original network with removed/collapsed nodes highlighted.
- Args:
original_network: Original BooleanNetwork or ProbabilisticBN compressed_network: Compressed network (not used for visualization) compression_info: Dictionary with compression information output_html (str): Output HTML file name interactive (bool): If True, return network visualization in interactive html file
- BNMPy.vis.vis_extension(original_network, extended_network, output_html='extension_comparison.html', interactive=False)[source]¶
Visualize the extended network with new nodes and edges highlighted.
- Args:
original_network: Original BooleanNetwork or ProbabilisticBN extended_network: Extended network with additional nodes/edges output_html (str): Output HTML file name interactive (bool): If True, return network visualization in interactive html file
- BNMPy.vis.vis_network(source, output_html='network_graph.html', interactive=False, removed_nodes=None, removed_edges=None, measured_nodes=None, perturbed_nodes=None)[source]¶
Visualize the logic graph using PyVis and igraph.
- Args:
- source: Logic rules (dict), file path (str), network string (str),
BooleanNetwork object, or ProbabilisticBN object
output_html (str): Output HTML file name. interactive (bool): If True, return the network visualization in interactive html file removed_nodes (set): Set of node names that were removed (shown in grey) removed_edges (set): Set of edge tuples that were removed (shown in grey) measured_nodes (set): Set of node names that are measured (shown in orange) perturbed_nodes (set): Set of node names that are perturbed (shown in red)