rand_node_attr_from

Adds a randomly chosen value from a specified list as a node attribute.

sasviya.network.utils.random_attr_generator.rand_node_attr_from(g, choices, name='rand_item', nodes_subset=None, seed=None)

Parameters

g : SAS graph object

Specifies the input graph to add the attribute to.

choices : list

Specifies the list of attribute values to choose from.

name : str, optional

Specifies the name of the attribute to add. The default is “rand_item”.

nodes_subset : Container or None, optional

Specifies the subset of nodes to restrict the attribute. The default is None.

seed : int or None, optional

Specifies the random seed for reproducibility. The default is None.

Last updated: July 28, 2026