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

Function Graph_add_nodes

cpp_easygraph/classes/graph.cpp:91–112  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

89}
90
91py::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
114py::object Graph_add_nodes_from(py::args args, py::kwargs kwargs) {
115 Graph& self = args[0].cast<Graph&>();

Callers

nothing calls this directly

Calls 1

_add_one_nodeFunction · 0.85

Tested by

no test coverage detected