nichesphere.niche_stats.community_signed_weight_distributions

nichesphere.niche_stats.community_signed_weight_distributions#

nichesphere.niche_stats.community_signed_weight_distributions(g: Graph, partition: dict) → dict#

Combine positive and negative weights into a single signed distribution.

Positive weights are kept as-is; negative weights are negated so the original score sign is preserved. This gives one distribution per community per edge type (internal / external), suitable for a single pair of box plots rather than four separate pos/neg boxes.

Parameters:
  • g (nx.Graph) – Signed co-localization network.

  • partition (dict) – Mapping of node → community name.

Returns:

signed – Keyed by community name; each value is a dict with keys 'internal' and 'external', each a list of signed weight values.

Return type:

dict