nichesphere.niche_stats.community_edge_weight_distributions#
- nichesphere.niche_stats.community_edge_weight_distributions(g: Graph, partition: dict) dict#
Raw edge weight lists per community, split by location and sign.
Uses the same unique-pair iteration as
community_edge_stats()so weights correspond one-to-one with the counts computed there. External edges are attributed to both communities they connect.- Parameters:
g (nx.Graph) – Signed co-localization network.
partition (dict) – Mapping of node → community name.
- Returns:
dist – Keyed by community name; each value is a dict with four lists:
'internal_pos'– positive weights of internal edges'internal_neg'– absolute values of negative internal edges'external_pos'– positive weights of external edges'external_neg'– absolute values of negative external edges
- Return type:
dict
Examples
>>> dist = nichesphere.niche.community_edge_weight_distributions(gCol, vc_map_named) >>> plt.hist(dist['2_FibCore']['internal_pos'])