Graph.neighborhood

Graph.neighborhood(key, ring=1)[source]

Return the nodes in the neighborhood of a node.

Parameters
  • key (hashable) – The identifier of the node.

  • ring (int, optional) – The size of the neighborhood.

Returns

list[hashable] – A list of node identifiers.