Network.get_any_nodes

Network.get_any_nodes(n, exclude_leaves=False)[source]

Get a list of identifiers of a random set of n nodes.

Deprecated since version 1.13.3: Use node_sample() instead.

Parameters
  • n (int) – The number of random nodes.

  • exclude_leaves (bool, optional) – If True, exclude the leaves (nodes with only one connected edge) from the set.

Returns

list[hashable] – The identifiers of the nodes.