cana.graphs.activity_graph module
Activity graphs of Boolean networks.
As proposed in Ghanbarnejad & Klemm (2012) EPL, 99. Edge weights are
per-input activities (activities()).
Optional interaction sign frozensets use the same conventions as
interaction_graph.
The unthresholded graph includes every wiring edge (activity may be 0)
and records G.graph["threshold"] is None. Pass that graph as base_ag
to apply a threshold without recomputing activities. Applying a lower
threshold (or None) than the base is an error — filtered edges cannot be
recovered.
- cana.graphs.activity_graph.build_activity_graph(nodes, name='', threshold=None, signed=False, base_ag=None)[source]
Build the activity graph from a sequence of Boolean nodes.
Pass
base_ag(typically an unsigned, unthresholded AG) to reuse a cached graph without recomputing activities;base_agis never mutated.- Parameters:
nodes (sequence) – Nodes with
.name,.inputs,.activities(), and.input_signs()(whensigned=True). Ignored for edge weights whenbase_agis provided.name (str) – Network name used in the digraph
nameattribute.threshold (float, optional) – Keep edges with activity
> threshold. WhenNone, keep all wiring edges (including weight0).signed (bool) – Attach interaction
signfrozensets. When True, works on a deep copy of the unsigned graph. Defaults toFalse.base_ag (networkx.DiGraph, optional) – Cached activity graph. Must satisfy
base_ag.graph["threshold"] is Noneorthreshold >= base_ag.graph["threshold"]. Built fromnodeswhen omitted.
- Returns:
- Activity graph with
weightandsign. G.graph["threshold"]records the applied threshold.
- Activity graph with
- Return type:
G (networkx.DiGraph)