Random Graph

class RandomNode(mother_node=None, seed=None)

Bases: object

Random Node within a random dependency graph.

Parameters
  • mother_node (RandomNode, optional) – Mother node of this random node. By default, nodes are considered to be roots.

  • seed (int, optional) – Random seed used to initialize the pseudo-random number generator.

yaml_tag = 'RandomNode'

YAML serialization tag.

property is_random_root: bool

Is this random node a root node?

Returns

Boolean root node indicator.

Return type

is_root (bool)

set_seed(seed)

Set an initialization seed for the pseudo-random number generator.

Note that setting a seed will convert any random node to a base node!

Parameters

seed (int) – Random number seed.

Return type

None

property random_mother: Optional[hermespy.core.random_node.RandomNode]

The mother node of this random number generator.

Note that setting the mother node will convert any random node to a child node!

Returns

The mother node. None if this node is a root.

Return type

mother_node (Optional[RandomNode])

classmethod to_yaml(representer, node)

Serialize a RandomNode object to YAML.

Parameters
  • representer (SafeRepresenter) – A handle to a representer used to generate valid YAML code. The representer gets passed down the serialization tree to each node.

  • node (RandomNode) – The RandomNode instance to be serialized.

Returns

The serialized YAML node. None if the object state is default.

Return type

Node

classmethod from_yaml(constructor, node)

Recall a new RandomNode instance from YAML.

Parameters
  • constructor (SafeConstructor) – A handle to the constructor extracting the YAML information.

  • node (Node) – YAML node representing the RandomNode serialization.

Returns

Newly created RandomNode instance.

Return type

RandomNode