MCPcopy Create free account
hub / github.com/easy-graph/Easy-Graph / DiGraph_add_nodes

Function DiGraph_add_nodes

cpp_easygraph/classes/directed_graph.cpp:164–184  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

162}
163
164py::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
186py::object DiGraph_add_nodes_from(py::args args, py::kwargs kwargs) {
187 DiGraph& self = args[0].cast<DiGraph&>();

Callers

nothing calls this directly

Calls 1

DiGraph_add_one_nodeFunction · 0.85

Tested by

no test coverage detected