Network.node_attributes
- Network.node_attributes(key, names=None, values=None)[source]
Get or set multiple attributes of a node.
- Parameters
key (hashable) – The identifier of the node.
names (list, optional) – A list of attribute names.
values (list, optional) – A list of attribute values.
- Returns
dict, list or None – If the parameter
names
is empty, the function returns a dictionary of all attribute name-value pairs of the node. If the parameternames
is not empty, the function returns a list of the values corresponding to the requested attribute names. The function returnsNone
if it is used as a “setter”.- Raises
KeyError – If the node does not exist.