graph_gen

Generate Raphtory graphs from attachment models

Functions

FunctionDescription
ba_preferential_attachmentGenerates a graph using the preferential attachment model.
random_attachmentGenerates a graph using the random attachment model

Function Details

ba_preferential_attachment

Signature: ba_preferential_attachment(g, nodes_to_add, edges_per_step, seed=None)

Generates a graph using the preferential attachment model.

Given a graph this function will add a user defined number of nodes, each with a user defined number of edges. This is an iterative algorithm where at each step a node is added and its neighbours are chosen from the pool of nodes already within the network. For this model the neighbours are chosen proportionally based upon their degree, favouring nodes with higher degree (more connections). This sampling is conducted without replacement.

Note: If the provided graph doesnt have enough nodes/edges for the initial sample, the min number of both will be added before generation begins.

Parameters

NameTypeDefaultDescription
edges_per_stepAny-
gAny-
nodes_to_addAny-
seedAny, optionalNone

random_attachment

Signature: random_attachment(g, nodes_to_add, edges_per_step, seed=None)

Generates a graph using the random attachment model

This function is a graph generation model based upon: Callaway, Duncan S., et al. "Are randomly grown graphs really random?." Physical Review E 64.4 (2001): 041902.

Parameters

NameTypeDefaultDescription
edges_per_stepAny-
gAny-
nodes_to_addAny-
seedAny, optionalNone