Skip to content

Commit c6cab4f

Browse files
committed
chore: updated to igraph 1.0.0-rc1
1 parent fbb332f commit c6cab4f

File tree

6 files changed

+308
-153
lines changed

6 files changed

+308
-153
lines changed

src/_igraph/convert.c

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2436,6 +2436,40 @@ PyObject* igraphmodule_matrix_int_t_to_PyList(const igraph_matrix_int_t *m) {
24362436
return list;
24372437
}
24382438

2439+
/**
2440+
* \ingroup python_interface_conversion
2441+
* \brief Converts an igraph \c igraph_matrix_list_t to a Python list of lists of lists
2442+
*
2443+
* \param v the \c igraph_matrix_list_t containing the matrix list to be converted
2444+
* \return the Python list as a \c PyObject*, or \c NULL if an error occurred
2445+
*/
2446+
PyObject* igraphmodule_matrix_list_t_to_PyList(const igraph_matrix_list_t *m) {
2447+
PyObject *list, *item;
2448+
Py_ssize_t n, i;
2449+
2450+
n = igraph_matrix_list_size(m);
2451+
if (n < 0) {
2452+
return igraphmodule_handle_igraph_error();
2453+
}
2454+
2455+
list = PyList_New(n);
2456+
if (!list) {
2457+
return NULL;
2458+
}
2459+
2460+
for (i = 0; i < n; i++) {
2461+
item = igraphmodule_matrix_t_to_PyList(igraph_matrix_list_get_ptr(m, i),
2462+
IGRAPHMODULE_TYPE_FLOAT);
2463+
if (item == NULL) {
2464+
Py_DECREF(list);
2465+
return NULL;
2466+
}
2467+
PyList_SetItem(list, i, item); /* will not fail */
2468+
}
2469+
2470+
return list;
2471+
}
2472+
24392473
/**
24402474
* \ingroup python_interface_conversion
24412475
* \brief Converts an igraph \c igraph_vector_ptr_t to a Python list of lists

src/_igraph/convert.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,4 +195,5 @@ PyObject* igraphmodule_vector_int_t_to_PyList(const igraph_vector_int_t *v);
195195
PyObject* igraphmodule_matrix_t_to_PyList(const igraph_matrix_t *m,
196196
igraphmodule_conv_t type);
197197
PyObject* igraphmodule_matrix_int_t_to_PyList(const igraph_matrix_int_t *m);
198+
PyObject* igraphmodule_matrix_list_t_to_PyList(const igraph_matrix_list_t *m);
198199
#endif

0 commit comments

Comments
 (0)