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
GNetworkX graph

A graph

sourcenode in G
distancethe distance of the wanted nodes from source
Returns
set()

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