title: Efficient extraction of a subgraph according to some edge attribute in NetworkX
body: <p>One can easily extract a subgraph from a NetworkX graph by specifying a list of nodes, but I couldn't find an efficient way to perform subgraph extraction by edge. For example, to extract the subgraph consists of edges with weights exceeding some user-defined threshold. </p>
  
  <p>Currently I'm doing it in the following way: </p>
  
  <pre><code>## extracts all edges satisfy the weight threshold (my_network is directed):
  eligible_edges = [(from_node,to_node,edge_attributes) for from_node,to_node,edge_attributes in my_network.edges(data=True) if edge_attributes['weight'] &gt; threshold]
  new_network = NetworkX.DiGraph()
  new_network.add_edges_from(eligible_edges)
  </code></pre>
  
  <p>Is there a better way to do this? </p>
  
  <p>Thanks for your kind answers. </p>