RandomCategoricalInitializer

class defSim.agents_init.RandomCategoricalInitializer.RandomCategoricalInitializer(**kwargs)

Bases: defSim.agents_init.agents_init.AttributesInitializer

Implements the AttributesInitializer as a random initialization of arbitrary discrete features.

__init__(**kwargs)
Parameters
  • num_features (int=5) – How many different attributes each node has.

  • num_traits (int=3) – The range of values each attribute can take. 3 means that an attribute can be either 0, 1 or 2

initialize_attributes(network: networkx.classes.graph.Graph, **kwargs)

Randomly initializes a number of discrete features for each node.

Parameters

network – The graph object whose nodes’ attributes are modified.