BaseNetwork.nodes_attribute

BaseNetwork.nodes_attribute(name, value=None, keys=None)

Get or set an attribute of multiple nodes.

Parameters
  • name (str) – The name of the attribute.

  • value (obj, optional) – The value of the attribute. Default is None.

  • keys (list of int, optional) – A list of node identifiers.

Returns

list or None – The value of the attribute for each node, or None if the function is used as a “setter”.

Raises

KeyError – If any of the nodes does not exist.