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

Function DiGraph_add_edges

cpp_easygraph/classes/directed_graph.cpp:312–332  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

310}
311
312py::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
334py::object DiGraph_add_edges_from(py::args args, py::kwargs attr) {
335 DiGraph& self = args[0].cast<DiGraph&>();

Callers

nothing calls this directly

Calls 1

DiGraph_add_one_edgeFunction · 0.85

Tested by

no test coverage detected