title: K-th order neighbors in graph - Python networkx
body: <p>I have a directed graph in which I want to efficiently find a list of all K-th order neighbors of a node. K-th order neighbors are defined as all nodes which can be reached from the node in question in <em>exactly</em> <code>K</code> hops.</p>
  
  <p>I looked at <code>networkx</code> and the only function relevant was <code>neighbors</code>. However, this just returns the order 1 neighbors. For higher order, we need to iterate to determine the full set. I believe there should be a more efficient way of accessing K-th order neighbors in <code>networkx</code>.</p>
  
  <p>Is there a function which efficiently returns the K-th order neighbors, without incrementally building the set?</p>
  
  <p>EDIT: In case there exist other graph libraries in Python which might be useful here, please do mention those.</p>