| 162 | } |
| 163 | |
| 164 | py::object DiGraph_add_nodes(DiGraph& self, py::list nodes_for_adding, py::list nodes_attr) { |
| 165 | self.dirty_nodes = true; |
| 166 | self.dirty_adj = true; |
| 167 | if (py::len(nodes_attr) != 0) { |
| 168 | if (py::len(nodes_for_adding) != py::len(nodes_attr)) { |
| 169 | PyErr_Format(PyExc_AssertionError, "Nodes and Attributes lists must have same length."); |
| 170 | return py::none(); |
| 171 | } |
| 172 | } |
| 173 | for (int i = 0; i < py::len(nodes_for_adding); i++) { |
| 174 | py::object one_node_for_adding = nodes_for_adding[i]; |
| 175 | py::dict node_attr; |
| 176 | if (py::len(nodes_attr)) { |
| 177 | node_attr = nodes_attr[i].cast<py::dict>(); |
| 178 | } else { |
| 179 | node_attr = py::dict(); |
| 180 | } |
| 181 | DiGraph_add_one_node(self, one_node_for_adding, node_attr); |
| 182 | } |
| 183 | return py::none(); |
| 184 | } |
| 185 | |
| 186 | py::object DiGraph_add_nodes_from(py::args args, py::kwargs kwargs) { |
| 187 | DiGraph& self = args[0].cast<DiGraph&>(); |
nothing calls this directly
no test coverage detected