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) edge between u and v.
(self, ebunch)
| 1007 | |
| 1008 | @clear_mutation_cache |
| 1009 | def remove_edges_from(self, ebunch): |
| 1010 | """Remove all edges specified in ebunch. |
| 1011 | |
| 1012 | Parameters |
| 1013 | ---------- |
| 1014 | ebunch: list or container of edge tuples |
| 1015 | Each edge given in the list or container will be removed |
| 1016 | from the graph. The edges can be: |
| 1017 | |
| 1018 | - 2-tuples (u, v) edge between u and v. |
| 1019 | - 3-tuples (u, v, k) where k is ignored. |
| 1020 | |
| 1021 | See Also |
| 1022 | -------- |
| 1023 | remove_edge : remove a single edge |
| 1024 | |
| 1025 | Notes |
| 1026 | ----- |
| 1027 | Will fail silently if an edge in ebunch is not in the graph. |
| 1028 | |
| 1029 | Examples |
| 1030 | -------- |
| 1031 | >>> G = nx.path_graph(4) # or DiGraph |
| 1032 | >>> ebunch = [(1, 2), (2, 3)] |
| 1033 | >>> G.remove_edges_from(ebunch) |
| 1034 | """ |
| 1035 | for e in ebunch: |
| 1036 | ne = len(e) |
| 1037 | if ne < 2: |
| 1038 | raise ValueError("Edge tuple %s must be a 2-tuple or 3-tuple." % (e,)) |
| 1039 | self.remove_edge(e[0], e[1]) |
| 1040 | |
| 1041 | @clear_mutation_cache |
| 1042 | def set_edge_data(self, u, v, data): |