cana.graphs.effective_graph module

Effective graphs of Boolean networks.

Edge weights are per-input edge effectiveness (edge_effectiveness()). Optional interaction sign frozensets use the same conventions as interaction_graph.

cana.graphs.effective_graph.build_effective_graph(nodes, name='', bound='mean', threshold=None, signed=False, base_eg=None)[source]

Build the effective graph of a Boolean network.

Edge weights are edge effectiveness. Pass base_eg (an unsigned, unthresholded EG) to reuse a cached graph without recomputing effectiveness; base_eg is never mutated.

Parameters:
  • nodes (sequence) – Nodes with .name, .inputs, and .edge_effectiveness (and .input_signs when signed).

  • name (str) – Network name used in the digraph name attribute.

  • bound (str) – Bound forwarded to edge_effectiveness. One of "lower", "mean", "upper", "tuple". Ignored when base_eg is provided.

  • threshold (float, optional) – Keep edges with weight > threshold.

  • signed (bool) – Attach interaction sign frozensets. When True, works on a deep copy of the unsigned graph.

  • base_eg (networkx.DiGraph, optional) – Cached effective graph. Must satisfy base_eg.graph["threshold"] is None or threshold >= base_eg.graph["threshold"]. Built from nodes when omitted.

Returns:

Possibly signed and/or thresholded EG.

G.graph["threshold"] records the applied threshold.

Return type:

G (networkx.DiGraph)

cana.graphs.effective_graph.build_conditional_effective_graph(nodes, conditioned_nodes=None, bound='mean', threshold=None, signed=False, name='', base_eg=None)[source]

Build an effective graph conditioned on fixed node states.

Propagates constants induced by conditioning, recomputing edge effectiveness on the remaining inputs of affected successors.

Parameters:
  • nodes (sequence) – Original network nodes (not mutated).

  • conditioned_nodes (mapping) – {node_id: state} fixed values.

  • bound (str) – Bound for edge effectiveness.

  • threshold (float, optional) – Drop edges with weight <= threshold.

  • signed (bool) – Attach signs from conditioned LUTs.

  • name (str) – Network name for digraph naming.

  • base_eg (networkx.DiGraph, optional) – Unsigned unthresholded EG to start from. Built via build_effective_graph() if omitted.

Returns:

Conditioned effective graph.

Return type:

(networkx.DiGraph)