| 310 | } |
| 311 | |
| 312 | py::object DiGraph_add_edges(DiGraph& self, py::list edges_for_adding, py::list edges_attr) { |
| 313 | self.dirty_nodes = true; |
| 314 | self.dirty_adj = true; |
| 315 | if (py::len(edges_attr) != 0) { |
| 316 | if (py::len(edges_for_adding) != py::len(edges_attr)) { |
| 317 | PyErr_Format(PyExc_AssertionError, "Edges and Attributes lists must have same length."); |
| 318 | return py::none(); |
| 319 | } |
| 320 | } |
| 321 | for (int i = 0; i < py::len(edges_for_adding); i++) { |
| 322 | py::tuple one_edge_for_adding = edges_for_adding[i].cast<py::tuple>(); |
| 323 | py::dict edge_attr; |
| 324 | if (py::len(edges_attr)) { |
| 325 | edge_attr = edges_attr[i].cast<py::dict>(); |
| 326 | } else { |
| 327 | edge_attr = py::dict(); |
| 328 | } |
| 329 | DiGraph_add_one_edge(self, one_edge_for_adding[0], one_edge_for_adding[1], edge_attr); |
| 330 | } |
| 331 | return py::none(); |
| 332 | } |
| 333 | |
| 334 | py::object DiGraph_add_edges_from(py::args args, py::kwargs attr) { |
| 335 | DiGraph& self = args[0].cast<DiGraph&>(); |
nothing calls this directly
no test coverage detected