MCPcopy Create free account
hub / github.com/alibaba/GraphScope / edge_subgraph

Function edge_subgraph

python/graphscope/nx/classes/function.py:126–152  ·  view source on GitHub ↗

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 presen

(G, edges)

Source from the content-addressed store, hash-verified

124
125
126def edge_subgraph(G, edges):
127 """Returns a independent deep copy subgraph induced by the specified edges.
128
129 The induced subgraph contains each edge in `edges` and each
130 node incident to any of those edges.
131
132 Parameters
133 ----------
134 G : NetworkX Graph
135 edges : iterable
136 An iterable of edges. Edges not present in `G` are ignored.
137
138 Returns
139 -------
140 subgraph : SubGraph
141 A edge-induced subgraph of subgraph of `G`.
142
143 Examples
144 --------
145 >>> G = nx.path_graph(5)
146 >>> H = G.edge_subgraph([(0, 1), (3, 4)])
147 >>> list(H.nodes)
148 [0, 1, 3, 4]
149 >>> list(H.edges)
150 [(0, 1), (3, 4)]
151 """
152 return G.edge_subgraph(edges)
153
154
155@patch_docstring(func.number_of_selfloops)

Callers

nothing calls this directly

Calls 1

edge_subgraphMethod · 0.80

Tested by

no test coverage detected