| 89 | } |
| 90 | |
| 91 | py::object Graph_add_nodes(Graph& self, py::list nodes_for_adding, py::list nodes_attr) { |
| 92 | self.dirty_nodes = true; |
| 93 | self.dirty_adj = true; |
| 94 | self.linkgraph_dirty = true; |
| 95 | if (py::len(nodes_attr) != 0) { |
| 96 | if (py::len(nodes_for_adding) != py::len(nodes_attr)) { |
| 97 | PyErr_Format(PyExc_AssertionError, "Nodes and Attributes lists must have same length."); |
| 98 | return py::none(); |
| 99 | } |
| 100 | } |
| 101 | for (int i = 0; i < py::len(nodes_for_adding); i++) { |
| 102 | py::object one_node_for_adding = nodes_for_adding[i]; |
| 103 | py::dict node_attr; |
| 104 | if (py::len(nodes_attr)) { |
| 105 | node_attr = nodes_attr[i].cast<py::dict>(); |
| 106 | } else { |
| 107 | node_attr = py::dict(); |
| 108 | } |
| 109 | _add_one_node(self, one_node_for_adding, node_attr); |
| 110 | } |
| 111 | return py::none(); |
| 112 | } |
| 113 | |
| 114 | py::object Graph_add_nodes_from(py::args args, py::kwargs kwargs) { |
| 115 | Graph& self = args[0].cast<Graph&>(); |
nothing calls this directly
no test coverage detected