@@ -227,6 +227,38 @@ PyObject* igraphmodule_set_status_handler(PyObject* self, PyObject* o) {
227227 Py_RETURN_NONE ;
228228}
229229
230+ PyObject * igraphmodule_align_layout (PyObject * self , PyObject * args , PyObject * kwds ) {
231+ static char * kwlist [] = {"graph" , "layout" , NULL };
232+ PyObject * graph_o , * layout_o ;
233+ PyObject * res ;
234+ igraph_t * graph ;
235+ igraph_matrix_t layout ;
236+
237+ if (!PyArg_ParseTupleAndKeywords (args , kwds , "OO" , kwlist , & graph_o , & layout_o )) {
238+ return NULL ;
239+ }
240+
241+ if (igraphmodule_PyObject_to_igraph_t (graph_o , & graph )) {
242+ return NULL ;
243+ }
244+
245+ if (igraphmodule_PyObject_to_matrix_t (layout_o , & layout , "layout" )) {
246+ return NULL ;
247+ }
248+
249+ if (igraph_layout_align (graph , & layout )) {
250+ igraphmodule_handle_igraph_error ();
251+ igraph_matrix_destroy (& layout );
252+ return NULL ;
253+ }
254+
255+ res = igraphmodule_matrix_t_to_PyList (& layout , IGRAPHMODULE_TYPE_FLOAT );
256+
257+ igraph_matrix_destroy (& layout );
258+
259+ return res ;
260+ }
261+
230262PyObject * igraphmodule_convex_hull (PyObject * self , PyObject * args , PyObject * kwds ) {
231263 static char * kwlist [] = {"vs" , "coords" , NULL };
232264 PyObject * vs , * o , * o1 = 0 , * o2 = 0 , * o1_float , * o2_float , * coords = Py_False ;
@@ -790,6 +822,10 @@ static PyMethodDef igraphmodule_methods[] =
790822 METH_VARARGS | METH_KEYWORDS ,
791823 "_power_law_fit(data, xmin=-1, force_continuous=False, p_precision=0.01)\n--\n\n"
792824 },
825+ {"_align_layout" , (PyCFunction )igraphmodule_align_layout ,
826+ METH_VARARGS | METH_KEYWORDS ,
827+ "_align_layout(graph, layout)\n--\n\n"
828+ },
793829 {"convex_hull" , (PyCFunction )igraphmodule_convex_hull ,
794830 METH_VARARGS | METH_KEYWORDS ,
795831 "convex_hull(vs, coords=False)\n--\n\n"
0 commit comments