networkx.algorithms.traversal.breadth_first_search.descendants_at_distance

descendants_at_distance(G, source, distance)[source]

Returns all nodes at a fixed distance from source in G.

Parameters
  • G (NetworkX DiGraph) – A directed graph

  • source (node in G)

  • distance (the distance of the wanted nodes from source)

Returns

The descendants of source in G at the given distance from source

Return type

set()