graphscope.nx.classes.function.edge_subgraph

graphscope.nx.classes.function.edge_subgraph(G, edges)[source]

Returns a independent deep copy subgraph induced by the specified edges.

The induced subgraph contains each edge in edges and each node incident to any of those edges.

Parameters:
  • G (NetworkX Graph) –

  • edges (iterable) – An iterable of edges. Edges not present in G are ignored.

Returns:

subgraph – A edge-induced subgraph of subgraph of G.

Return type:

SubGraph

Examples

>>> 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)]