cana.graphs.interaction_graph module
Interaction (wiring) graphs of Boolean networks.
Nodes are variables; an edge source -> target exists when source is
an input of target. Edge weight is 1.0 (topology only). Edge
sign is an Optional[frozenset[int]]:
Nonewhensigned=False(not computed)frozenset({1})/frozenset({-1})— pure activation / inhibitionfrozenset({1, -1})— binate / dual-signfrozenset()— irrelevant (no influence)
- cana.graphs.interaction_graph.fill_wiring_signs(G, nodes)[source]
Set edge
signfrozensets from each target node’sinput_signs.- Parameters:
G (networkx.DiGraph) – Digraph whose nodes are integer node ids.
nodes (sequence) – Nodes with
.inputsand.input_signs(), indexed by id (typicallyBooleanNetwork.nodes).
- Returns:
The same graph, mutated in place.
- Return type:
G (networkx.DiGraph)
- cana.graphs.interaction_graph.build_interaction_graph(nodes, name='', remove_constants=False, signed=True, constant_ids=None)[source]
Build the interaction graph from a sequence of Boolean nodes.
- Parameters:
nodes (sequence) – Nodes with
.name,.inputs, and.input_signs()(whensigned=True).name (str) – Network name used in the digraph
nameattribute.remove_constants (bool) – Drop constant nodes. Defaults to
False.signed (bool) – Compute and attach interaction signs. Defaults to
True.constant_ids (iterable, optional) – Node ids removed when
remove_constantsis True. Ignored otherwise.
- Returns:
The interaction graph.
- Return type:
G (networkx.DiGraph)