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 one of those edges. Parameters ---------- edges : iterable An iterable of edges in this grap
(self, edges)
| 1823 | |
| 1824 | @clear_mutation_cache |
| 1825 | def edge_subgraph(self, edges): |
| 1826 | """Returns a independent deep copy subgraph induced by the specified edges. |
| 1827 | |
| 1828 | The induced subgraph contains each edge in `edges` and each |
| 1829 | node incident to any one of those edges. |
| 1830 | |
| 1831 | Parameters |
| 1832 | ---------- |
| 1833 | edges : iterable |
| 1834 | An iterable of edges in this graph. |
| 1835 | |
| 1836 | Returns |
| 1837 | ------- |
| 1838 | G : Graph |
| 1839 | An edge-induced subgraph of this graph with the same edge |
| 1840 | attributes. |
| 1841 | |
| 1842 | Notes |
| 1843 | ----- |
| 1844 | Unlike NetworkX return a view, here return a independent deep copy subgraph. |
| 1845 | |
| 1846 | Examples |
| 1847 | -------- |
| 1848 | >>> G = nx.path_graph(5) # or DiGraph |
| 1849 | >>> H = G.edge_subgraph([(0, 1), (3, 4)]) |
| 1850 | >>> list(H.nodes) |
| 1851 | [0, 1, 3, 4] |
| 1852 | >>> list(H.edges) |
| 1853 | [(0, 1), (3, 4)] |
| 1854 | |
| 1855 | """ |
| 1856 | self._convert_arrow_to_dynamic() |
| 1857 | |
| 1858 | induced_edges = json.dumps(list(edges)) |
| 1859 | g = self.__class__(create_empty_in_engine=False) |
| 1860 | g.graph.update(self.graph) |
| 1861 | op = dag_utils.create_subgraph(self, edges=induced_edges) |
| 1862 | graph_def = op.eval(leaf=False) |
| 1863 | g._key = graph_def.key |
| 1864 | g._session = self._session |
| 1865 | g._op = op |
| 1866 | g.cache.warmup() |
| 1867 | return g |
| 1868 | |
| 1869 | @clear_mutation_cache |
| 1870 | def _project_to_simple(self, v_prop=None, e_prop=None): |