corneto.graph.preferential_attachment_network#
- corneto.graph.preferential_attachment_network(n, m, interactions=None, probs=None, seed=None)#
Generate a random network using the Barabasi-Albert preferential attachment model.
- Parameters:
n (int) – Total number of nodes in the network (must be greater than m).
m (int) – Number of edges each new node attaches with, controlling network density.
interactions (list or None, optional) – List of possible interaction types for edges (e.g., [1, -1]). If None, no interaction types will be assigned to edges.
probs (list or None, optional) – List of probabilities for each interaction type in the ‘interactions’ list. Must sum to 1 and have the same length as ‘interactions’. If None and interactions is provided, uniform probabilities will be used.
seed (int or None, optional) – Random seed for reproducibility, default is None.
Returns –
- list of tuples
If interactions is None, each edge is represented as (source, target) where source and target are vertex labels like “v1”, “v2”, … Otherwise, each edge is represented as (source, interaction, target) where interaction is one of the values from the interactions list.
Notes – The algorithm implements a Barabasi-Albert preferential attachment model, which produces scale-free networks similar to those observed in biological systems. The initial network consists of a complete graph among the first m nodes.