Remove all edges specified in ebunch. Parameters ---------- ebunch: list or container of edge tuples Each edge given in the list or container will be removed from the graph. The edges can be: - 2-tuples (u, v) All edges between u and
(self, ebunch)
| 342 | del self._adj[v][u] |
| 343 | |
| 344 | def remove_edges_from(self, ebunch): |
| 345 | """Remove all edges specified in ebunch. |
| 346 | |
| 347 | Parameters |
| 348 | ---------- |
| 349 | ebunch: list or container of edge tuples |
| 350 | Each edge given in the list or container will be removed |
| 351 | from the graph. The edges can be: |
| 352 | |
| 353 | - 2-tuples (u, v) All edges between u and v are removed. |
| 354 | - 3-tuples (u, v, key) The edge identified by key is removed. |
| 355 | - 4-tuples (u, v, key, data) where data is ignored. |
| 356 | |
| 357 | See Also |
| 358 | -------- |
| 359 | remove_edge : remove a single edge |
| 360 | |
| 361 | Notes |
| 362 | ----- |
| 363 | Will fail silently if an edge in ebunch is not in the graph. |
| 364 | |
| 365 | Examples |
| 366 | -------- |
| 367 | Removing multiple copies of edges |
| 368 | |
| 369 | >>> G = eg.MultiGraph() |
| 370 | >>> keys = G.add_edges_from([(1, 2), (1, 2), (1, 2)]) |
| 371 | >>> G.remove_edges_from([(1, 2), (1, 2)]) |
| 372 | >>> list(G.edges()) |
| 373 | [(1, 2)] |
| 374 | >>> G.remove_edges_from([(1, 2), (1, 2)]) # silently ignore extra copy |
| 375 | >>> list(G.edges) # now empty graph |
| 376 | [] |
| 377 | """ |
| 378 | for e in ebunch: |
| 379 | try: |
| 380 | self.remove_edge(*e[:3]) |
| 381 | except EasyGraphError: |
| 382 | pass |
| 383 | |
| 384 | def has_edge(self, u, v, key=None): |
| 385 | """Returns True if the graph has an edge between nodes u and v. |
nothing calls this directly
no test coverage detected