pub fn random_attachment(
graph: &Graph,
nodes_to_add: usize,
edges_per_step: usize,
seed: Option<[u8; 32]>,
)Expand description
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 purely at random. This sampling is done
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.
§Arguments
graph- The graph you wish to add nodes and edges tonodes_to_add- The amount of nodes you wish to add to the graph (steps)edges_per_step- The amount of edges a joining node should add to the graphseed- (Optional) An array of u8 bytes to be used as the input seed, Default None
§Examples
use raphtory::prelude::*;
use raphtory::graphgen::random_attachment::random_attachment;
let graph = Graph::new();
random_attachment(&graph, 1000, 10, None);