Remove all edges from the graph without altering nodes. Examples -------- >>> G = nx.path_graph(4) # or DiGraph >>> G.clear_edges() >>> list(G.nodes) [0, 1, 2, 3] >>> list(G.edges) []
(self)
| 1540 | |
| 1541 | @clear_mutation_cache |
| 1542 | def clear_edges(self): |
| 1543 | """Remove all edges from the graph without altering nodes. |
| 1544 | |
| 1545 | Examples |
| 1546 | -------- |
| 1547 | >>> G = nx.path_graph(4) # or DiGraph |
| 1548 | >>> G.clear_edges() |
| 1549 | >>> list(G.nodes) |
| 1550 | [0, 1, 2, 3] |
| 1551 | >>> list(G.edges) |
| 1552 | [] |
| 1553 | """ |
| 1554 | self._convert_arrow_to_dynamic() |
| 1555 | self._op = dag_utils.clear_edges(self) |
| 1556 | self._op.eval(leaf=False) |
| 1557 | self.cache.clear() |
| 1558 | |
| 1559 | @patch_docstring(RefGraph.is_directed) |
| 1560 | def is_directed(self): |
no test coverage detected