Returns the subgraph induced by the specified edges.
The induced subgraph contains each edge in
edgesand each node incident to any one of those edges.
An iterable of edges in this graph.
An edge-induced subgraph of this graph with the same edge attributes.
The graph, edge, and node attributes in the returned subgraph view are references to the corresponding attributes in the original graph. The view is read-only.
To create a full graph version of the subgraph with its own copy of the edge or node attributes, use:
>>> G = nx.path_graph(5) >>> H = G.edge_subgraph([(0, 1), (3, 4)]) >>> list(H.nodes) [0, 1, 3, 4] >>> list(H.edges) [(0, 1), (3, 4)]