Hello, I got an error when I try to convert c++ float* datatype to igraph_real_t. This is the error I got:
error: cannot convert 'float*' to 'igraph_real_t* {aka double*}' in assignment
matrix_data = data;
The background is I generated an adjacency matrix by using python, and then convert the ndarray to c_char_p datatype, and passing this value to cpp program. The following are my python code:
lib = ctypes.CDLL('./librunWalktrap.so')
dataTemp = simlarity_matrix_np.ctypes.data
dataptr = simlarity_matrix_np.ctypes.data_as(ctypes.c_char_p)
rows, cols = simlarity_matrix_np.shape
func_c_walktrap = lib.py2c_walktrap(dataptr, rows, cols)
After I passing my c_char_p which is the adjacency matrix to c++ program, I met a problem about how to use my adjacency matrix to genrate the graph. The following code is what I tried to generate the matrix and graph, but I got the error like I mentioned above:
int py2c_walktrap(float* data, int rows, int cols) {
igraph_matrix_t m;
igraph_real_t matrix_data;
igraph_integer_t nrow;
igraph_integer_t ncol;
igraph_matrix_storage_t storage;
nrow = rows;
ncol = cols;
matrix_data = data;
igraph_matrix_init_array(&m, &matrix_data, nrow, ncol, storage);
}
Do you guys have any idea about what should I do? Thank you very much!