diff --git a/src/include/igraph.h b/src/include/igraph.h deleted file mode 100644 index 5b8c14736a..0000000000 --- a/src/include/igraph.h +++ /dev/null @@ -1,102 +0,0 @@ -/* -*- mode: C -*- */ -/* - IGraph library. - Copyright (C) 2003-2012 Gabor Csardi - 334 Harvard street, Cambridge, MA 02139 USA - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA - -*/ - -#ifndef IGRAPH_H -#define IGRAPH_H - -#ifndef _GNU_SOURCE - #define _GNU_SOURCE 1 -#endif - -#include "igraph_version.h" -#include "igraph_memory.h" -#include "igraph_error.h" -#include "igraph_random.h" -#include "igraph_progress.h" -#include "igraph_statusbar.h" - -#include "igraph_types.h" -#include "igraph_complex.h" -#include "igraph_vector.h" -#include "igraph_matrix.h" -#include "igraph_array.h" -#include "igraph_dqueue.h" -#include "igraph_stack.h" -#include "igraph_heap.h" -#include "igraph_psumtree.h" -#include "igraph_strvector.h" -#include "igraph_vector_ptr.h" -#include "igraph_spmatrix.h" -#include "igraph_sparsemat.h" -#include "igraph_qsort.h" - -#include "igraph_constants.h" -#include "igraph_datatype.h" -#include "igraph_iterators.h" -#include "igraph_interface.h" -#include "igraph_constructors.h" -#include "igraph_games.h" -#include "igraph_microscopic_update.h" -#include "igraph_centrality.h" -#include "igraph_paths.h" -#include "igraph_components.h" -#include "igraph_structural.h" -#include "igraph_transitivity.h" -#include "igraph_neighborhood.h" -#include "igraph_topology.h" -#include "igraph_bipartite.h" -#include "igraph_cliques.h" -#include "igraph_layout.h" -#include "igraph_visitor.h" -#include "igraph_community.h" -#include "igraph_conversion.h" -#include "igraph_foreign.h" -#include "igraph_motifs.h" -#include "igraph_operators.h" -#include "igraph_flow.h" -#include "igraph_nongraph.h" -#include "igraph_cocitation.h" -#include "igraph_adjlist.h" -#include "igraph_attributes.h" -#include "igraph_blas.h" -#include "igraph_lapack.h" -#include "igraph_arpack.h" -#include "igraph_mixing.h" -#include "igraph_separators.h" -#include "igraph_cohesive_blocks.h" -#include "igraph_eigen.h" -#include "igraph_hrg.h" -#include "igraph_threading.h" -#include "igraph_interrupt.h" -#include "igraph_scg.h" -#include "igraph_matching.h" -#include "igraph_embedding.h" -#include "igraph_scan.h" -#include "igraph_graphlets.h" -#include "igraph_epidemics.h" -#include "igraph_lsap.h" -#include "igraph_coloring.h" -#include "igraph_eulerian.h" -#include "igraph_graphicality.h" - -#endif diff --git a/src/include/igraph_adjlist.h b/src/include/igraph_adjlist.h deleted file mode 100644 index ee56bdb801..0000000000 --- a/src/include/igraph_adjlist.h +++ /dev/null @@ -1,189 +0,0 @@ -/* -*- mode: C -*- */ -/* - IGraph library. - Copyright (C) 2009-2012 Gabor Csardi - 334 Harvard street, Cambridge, MA 02139 USA - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA - -*/ - -#ifndef IGRAPH_ADJLIST_H -#define IGRAPH_ADJLIST_H - -#include "igraph_decls.h" -#include "igraph_constants.h" -#include "igraph_types.h" -#include "igraph_datatype.h" - -__BEGIN_DECLS - -typedef struct igraph_adjlist_t { - igraph_integer_t length; - igraph_vector_int_t *adjs; -} igraph_adjlist_t; - -IGRAPH_EXPORT int igraph_adjlist_init(const igraph_t *graph, igraph_adjlist_t *al, - igraph_neimode_t mode, igraph_loops_t loops, - igraph_multiple_t multiple); -IGRAPH_EXPORT int igraph_adjlist_init_empty(igraph_adjlist_t *al, igraph_integer_t no_of_nodes); -IGRAPH_EXPORT igraph_integer_t igraph_adjlist_size(const igraph_adjlist_t *al); -IGRAPH_EXPORT int igraph_adjlist_init_complementer(const igraph_t *graph, - igraph_adjlist_t *al, - igraph_neimode_t mode, - igraph_bool_t loops); -IGRAPH_EXPORT void igraph_adjlist_destroy(igraph_adjlist_t *al); -IGRAPH_EXPORT void igraph_adjlist_clear(igraph_adjlist_t *al); -IGRAPH_EXPORT void igraph_adjlist_sort(igraph_adjlist_t *al); -IGRAPH_EXPORT int igraph_adjlist_simplify(igraph_adjlist_t *al); -IGRAPH_DEPRECATED IGRAPH_EXPORT int igraph_adjlist_remove_duplicate(const igraph_t *graph, - igraph_adjlist_t *al); -IGRAPH_EXPORT int igraph_adjlist_print(const igraph_adjlist_t *al); -IGRAPH_EXPORT int igraph_adjlist_fprint(const igraph_adjlist_t *al, FILE *outfile); -IGRAPH_EXPORT igraph_bool_t igraph_adjlist_has_edge(igraph_adjlist_t* al, igraph_integer_t from, igraph_integer_t to, igraph_bool_t directed); -IGRAPH_EXPORT int igraph_adjlist_replace_edge(igraph_adjlist_t* al, igraph_integer_t from, igraph_integer_t oldto, igraph_integer_t newto, igraph_bool_t directed); - -/** - * \define igraph_adjlist_get - * \brief Query a vector in an adjacency list. - * - * Returns a pointer to an igraph_vector_int_t object from an - * adjacency list. The vector can be modified as desired. - * \param al The adjacency list object. - * \param no The vertex whose adjacent vertices will be returned. - * \return Pointer to the igraph_vector_int_t object. - * - * Time complexity: O(1). - */ -#define igraph_adjlist_get(al,no) (&(al)->adjs[(long int)(no)]) - -IGRAPH_EXPORT int igraph_adjlist(igraph_t *graph, const igraph_adjlist_t *adjlist, - igraph_neimode_t mode, igraph_bool_t duplicate); - -typedef struct igraph_inclist_t { - igraph_integer_t length; - igraph_vector_int_t *incs; -} igraph_inclist_t; - -IGRAPH_EXPORT int igraph_inclist_init(const igraph_t *graph, - igraph_inclist_t *il, - igraph_neimode_t mode, - igraph_loops_t loops); -IGRAPH_EXPORT int igraph_inclist_init_empty(igraph_inclist_t *il, igraph_integer_t n); -IGRAPH_EXPORT igraph_integer_t igraph_inclist_size(const igraph_inclist_t *al); -IGRAPH_EXPORT void igraph_inclist_destroy(igraph_inclist_t *il); -IGRAPH_EXPORT void igraph_inclist_clear(igraph_inclist_t *il); -IGRAPH_DEPRECATED IGRAPH_EXPORT int igraph_inclist_remove_duplicate(const igraph_t *graph, - igraph_inclist_t *il); -IGRAPH_EXPORT int igraph_inclist_print(const igraph_inclist_t *il); -IGRAPH_EXPORT int igraph_inclist_fprint(const igraph_inclist_t *il, FILE *outfile); - -/** - * \define igraph_inclist_get - * \brief Query a vector in an incidence list. - * - * Returns a pointer to an igraph_vector_int_t object from an - * incidence list containing edge ids. The vector can be modified, - * resized, etc. as desired. - * \param il Pointer to the incidence list. - * \param no The vertex for which the incident edges are returned. - * \return Pointer to an igraph_vector_int_t object. - * - * Time complexity: O(1). - */ -#define igraph_inclist_get(il,no) (&(il)->incs[(long int)(no)]) - -typedef struct igraph_lazy_adjlist_t { - const igraph_t *graph; - igraph_integer_t length; - igraph_vector_int_t **adjs; - igraph_neimode_t mode; - igraph_loops_t loops; - igraph_multiple_t multiple; - igraph_vector_t dummy; -} igraph_lazy_adjlist_t; - -IGRAPH_EXPORT int igraph_lazy_adjlist_init(const igraph_t *graph, - igraph_lazy_adjlist_t *al, - igraph_neimode_t mode, - igraph_loops_t loops, - igraph_multiple_t multiple); -IGRAPH_EXPORT void igraph_lazy_adjlist_destroy(igraph_lazy_adjlist_t *al); -IGRAPH_EXPORT void igraph_lazy_adjlist_clear(igraph_lazy_adjlist_t *al); -IGRAPH_EXPORT igraph_integer_t igraph_lazy_adjlist_size(const igraph_lazy_adjlist_t *al); - -/** - * \define igraph_lazy_adjlist_get - * \brief Query neighbor vertices. - * - * If the function is called for the first time for a vertex then the - * result is stored in the adjacency list and no further query - * operations are needed when the neighbors of the same vertex are - * queried again. - * \param al The lazy adjacency list. - * \param no The vertex ID to query. - * \return Pointer to a vector. It is allowed to modify it and - * modification does not affect the original graph. - * - * Time complexity: O(d), the number of neighbor vertices for the - * first time, O(1) for subsequent calls. - */ -#define igraph_lazy_adjlist_get(al,no) \ - ((al)->adjs[(long int)(no)] != 0 ? ((al)->adjs[(long int)(no)]) : \ - (igraph_i_lazy_adjlist_get_real(al, no))) -IGRAPH_EXPORT igraph_vector_int_t *igraph_i_lazy_adjlist_get_real(igraph_lazy_adjlist_t *al, igraph_integer_t no); - -typedef struct igraph_lazy_inclist_t { - const igraph_t *graph; - igraph_integer_t length; - igraph_vector_int_t **incs; - igraph_neimode_t mode; - igraph_vector_t dummy; - igraph_loops_t loops; -} igraph_lazy_inclist_t; - -IGRAPH_EXPORT int igraph_lazy_inclist_init(const igraph_t *graph, - igraph_lazy_inclist_t *il, - igraph_neimode_t mode, - igraph_loops_t loops); -IGRAPH_EXPORT void igraph_lazy_inclist_destroy(igraph_lazy_inclist_t *il); -IGRAPH_EXPORT void igraph_lazy_inclist_clear(igraph_lazy_inclist_t *il); -IGRAPH_EXPORT igraph_integer_t igraph_lazy_inclist_size(const igraph_lazy_inclist_t *il); - -/** - * \define igraph_lazy_inclist_get - * \brief Query incident edges. - * - * If the function is called for the first time for a vertex, then the - * result is stored in the incidence list and no further query - * operations are needed when the incident edges of the same vertex are - * queried again. - * \param al The lazy incidence list object. - * \param no The vertex id to query. - * \return Pointer to a vector. It is allowed to modify it and - * modification does not affect the original graph. - * - * Time complexity: O(d), the number of incident edges for the first - * time, O(1) for subsequent calls with the same \p no argument. - */ -#define igraph_lazy_inclist_get(al,no) \ - ((al)->incs[(long int)(no)] != 0 ? ((al)->incs[(long int)(no)]) : \ - (igraph_i_lazy_inclist_get_real(al, no))) -IGRAPH_EXPORT igraph_vector_int_t *igraph_i_lazy_inclist_get_real(igraph_lazy_inclist_t *al, igraph_integer_t no); - -__END_DECLS - -#endif diff --git a/src/include/igraph_arpack.h b/src/include/igraph_arpack.h deleted file mode 100644 index c28af921db..0000000000 --- a/src/include/igraph_arpack.h +++ /dev/null @@ -1,332 +0,0 @@ -/* -*- mode: C -*- */ -/* - IGraph library. - Copyright (C) 2007-2012 Gabor Csardi - 334 Harvard street, Cambridge, MA 02139 USA - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA - -*/ - -#ifndef IGRAPH_ARPACK_H -#define IGRAPH_ARPACK_H - -#include "igraph_decls.h" -#include "igraph_types.h" -#include "igraph_vector.h" -#include "igraph_matrix.h" - -__BEGIN_DECLS - -/** - * \section about_arpack ARPACK interface in igraph - * - * - * ARPACK is a library for solving large scale eigenvalue problems. - * The package is designed to compute a few eigenvalues and corresponding - * eigenvectors of a general \c n by \c n matrix \c A. It is - * most appropriate for large sparse or structured matrices \c A where - * structured means that a matrix-vector product w <- Av requires - * order \c n rather than the usual order n^2 floating point - * operations. Please see - * http://www.caam.rice.edu/software/ARPACK/ for details. - * - * - * - * The eigenvalue calculation in ARPACK (in the simplest - * case) involves the calculation of the \c Av product where \c A - * is the matrix we work with and \c v is an arbitrary vector. A - * user-defined function of type \ref igraph_arpack_function_t - * is expected to perform this product. If the product can be done - * efficiently, e.g. if the matrix is sparse, then ARPACK is usually - * able to calculate the eigenvalues very quickly. - * - * - * In igraph, eigenvalue/eigenvector calculations usually - * involve the following steps: - * \olist - * \oli Initialization of an \ref igraph_arpack_options_t data - * structure using \ref igraph_arpack_options_init. - * \oli Setting some options in the initialized \ref - * igraph_arpack_options_t object. - * \oli Defining a function of type \ref igraph_arpack_function_t. - * The input of this function is a vector, and the output - * should be the output matrix multiplied by the input vector. - * \oli Calling \ref igraph_arpack_rssolve() (is the matrix is - * symmetric), or \ref igraph_arpack_rnsolve(). - * \endolist - * The \ref igraph_arpack_options_t object can be used multiple - * times. - * - * - * - * If we have many eigenvalue problems to solve, then it might worth - * to create an \ref igraph_arpack_storage_t object, and initialize it - * via \ref igraph_arpack_storage_init(). This structure contains all - * memory needed for ARPACK (with the given upper limit regerding to - * the size of the eigenvalue problem). Then many problems can be - * solved using the same \ref igraph_arpack_storage_t object, without - * always reallocating the required memory. - * The \ref igraph_arpack_storage_t object needs to be destroyed by - * calling \ref igraph_arpack_storage_destroy() on it, when it is not - * needed any more. - * - * - * - * igraph does not contain all - * ARPACK routines, only the ones dealing with symmetric and - * non-symmetric eigenvalue problems using double precision real - * numbers. - * - * - */ - -/** - * \struct igraph_arpack_options_t - * \brief Options for ARPACK - * - * This data structure contains the options of thee ARPACK eigenvalue - * solver routines. It must be initialized by calling \ref - * igraph_arpack_options_init() on it. Then it can be used for - * multiple ARPACK calls, as the ARPACK solvers do not modify it. - * - * Input options: - * \member bmat Character. Whether to solve a standard ('I') ot a - * generalized problem ('B'). - * \member n Dimension of the eigenproblem. - * \member which Specifies which eigenvalues/vectors to - * compute. Possible values for symmetric matrices: - * \clist \cli LA - * Compute \c nev largest (algebraic) eigenvalues. - * \cli SA - * Compute \c nev smallest (algebraic) eigenvalues. - * \cli LM - * Compute \c nev largest (in magnitude) eigenvalues. - * \cli SM - * Compute \c nev smallest (in magnitude) eigenvalues. - * \cli BE - * Compute \c nev eigenvalues, half from each end of - * the spectrum. When \c nev is odd, compute one - * more from the high en than from the low - * end. \endclist - * Possible values for non-symmetric matrices: - * \clist \cli LM - * Compute \c nev largest (in magnitude) eigenvalues. - * \cli SM - * Compute \c nev smallest (in magnitude) eigenvalues. - * \cli LR - * Compute \c nev eigenvalues of largest real part. - * \cli SR - * Compute \c nev eigenvalues of smallest real part. - * \cli LI - * Compute \c nev eigenvalues of largest imaginary part. - * \cli SI - * Compute \c nev eigenvalues of smallest imaginary - * part. \endclist - * \member nev The number of eigenvalues to be computed. - * \member tol Stopping criterion: the relative accuracy - * of the Ritz value is considered acceptable if its error is less - * than \c tol times its estimated value. If this is set to zero - * then machine precision is used. - * \member ncv Number of Lanczos vectors to be generated. Setting this - * to zero means that \ref igraph_arpack_rssolve and \ref igraph_arpack_rnsolve - * will determine a suitable value for \c ncv automatically. - * \member ldv Numberic scalar. It should be set to - * zero in the current igraph implementation. - * \member ishift Either zero or one. If zero then the shifts are - * provided by the user via reverse communication. If one then exact - * shifts with respect to the reduced tridiagonal matrix \c T. - * Please always set this to one. - * \member mxiter Maximum number of Arnoldi update iterations allowed. - * \member nb Blocksize to be used in the recurrence. Please always - * leave this on the default value, one. - * \member mode The type of the eigenproblem to be solved. - * Possible values if the input matrix is symmetric: - * \olist - * \oli A*x=lambda*x, A is symmetric. - * \oli A*x=lambda*M*x, A is - * symmetric, M is symmetric positive definite. - * \oli K*x=lambda*M*x, K is - * symmetric, M is symmetric positive semi-definite. - * \oli K*x=lambda*KG*x, K is - * symmetric positive semi-definite, KG is symmetric - * indefinite. - * \oli A*x=lambda*M*x, A is - * symmetric, M is symmetric positive - * semi-definite. (Cayley transformed mode.) \endolist - * Please note that only \c mode ==1 was tested and other values - * might not work properly. - * Possible values if the input matrix is not symmetric: - * \olist - * \oli A*x=lambda*x. - * \oli A*x=lambda*M*x, M is - * symmetric positive definite. - * \oli A*x=lambda*M*x, M is - * symmetric semi-definite. - * \oli A*x=lambda*M*x, M is - * symmetric semi-definite. \endolist - * Please note that only \c mode == 1 was tested and other values - * might not work properly. - * \member start Whether to use the supplied starting vector (1), or - * use a random starting vector (0). The starting vector must be - * supplied in the first column of the \c vectors argument of the - * \ref igraph_arpack_rssolve() of \ref igraph_arpack_rnsolve() call. - * - * Output options: - * \member info Error flag of ARPACK. Possible values: - * \clist \cli 0 - * Normal exit. - * \cli 1 - * Maximum number of iterations taken. - * \cli 3 - * No shifts could be applied during a cycle of the - * Implicitly restarted Arnoldi iteration. One possibility - * is to increase the size of \c ncv relative to \c - * nev. \endclist - * ARPACK can return other error flags as well, but these are - * converted to igraph errors, see \ref igraph_error_type_t. - * \member ierr Error flag of the second ARPACK call (one eigenvalue - * computation usually involves two calls to ARPACK). This is - * always zero, as other error codes are converted to igraph errors. - * \member noiter Number of Arnoldi iterations taken. - * \member nconv Number of converged Ritz values. This - * represents the number of Ritz values that satisfy the - * convergence critetion. - * \member numop Total number of matrix-vector multiplications. - * \member numopb Not used currently. - * \member numreo Total number of steps of re-orthogonalization. - * - * Internal options: - * \member lworkl Do not modify this option. - * \member sigma The shift for the shift-invert mode. - * \member sigmai The imaginary part of the shift, for the - * non-symmetric or complex shift-invert mode. - * \member iparam Do not modify this option. - * \member ipntr Do not modify this option. - * - */ - -typedef struct igraph_arpack_options_t { - /* INPUT */ - char bmat[1]; /* I-standard problem, G-generalized */ - int n; /* Dimension of the eigenproblem */ - char which[2]; /* LA, SA, LM, SM, BE */ - int nev; /* Number of eigenvalues to be computed */ - igraph_real_t tol; /* Stopping criterion */ - int ncv; /* Number of columns in V */ - int ldv; /* Leading dimension of V */ - int ishift; /* 0-reverse comm., 1-exact with tridiagonal */ - int mxiter; /* Maximum number of update iterations to take */ - int nb; /* Block size on the recurrence, only 1 works */ - int mode; /* The kind of problem to be solved (1-5) - 1: A*x=l*x, A symmetric - 2: A*x=l*M*x, A symm. M pos. def. - 3: K*x = l*M*x, K symm., M pos. semidef. - 4: K*x = l*KG*x, K s. pos. semidef. KG s. indef. - 5: A*x = l*M*x, A symm., M symm. pos. semidef. */ - int start; /* 0: random, 1: use the supplied vector */ - int lworkl; /* Size of temporary storage, default is fine */ - igraph_real_t sigma; /* The shift for modes 3,4,5 */ - igraph_real_t sigmai; /* The imaginary part of shift for rnsolve */ - /* OUTPUT */ - int info; /* What happened, see docs */ - int ierr; /* What happened in the dseupd call */ - int noiter; /* The number of iterations taken */ - int nconv; - int numop; /* Number of OP*x operations */ - int numopb; /* Number of B*x operations if BMAT='G' */ - int numreo; /* Number of steps of re-orthogonalizations */ - /* INTERNAL */ - int iparam[11]; - int ipntr[14]; -} igraph_arpack_options_t; - -/** - * \struct igraph_arpack_storage_t - * \brief Storage for ARPACK - * - * Public members, do not modify them directly, these are considered - * to be read-only. - * \member maxn Maximum rank of matrix. - * \member maxncv Maximum NCV. - * \member maxldv Maximum LDV. - * - * These members are considered to be private: - * \member workl Working memory. - * \member workd Working memory. - * \member d Memory for eigenvalues. - * \member resid Memory for residuals. - * \member ax Working memory. - * \member select Working memory. - * \member di Memory for eigenvalues, non-symmetric case only. - * \member workev Working memory, non-symmetric case only. - */ - -typedef struct igraph_arpack_storage_t { - int maxn, maxncv, maxldv; - igraph_real_t *v; - igraph_real_t *workl; - igraph_real_t *workd; - igraph_real_t *d; - igraph_real_t *resid; - igraph_real_t *ax; - int *select; - igraph_real_t *di; /* These two only for non-symmetric problems */ - igraph_real_t *workev; -} igraph_arpack_storage_t; - -IGRAPH_EXPORT void igraph_arpack_options_init(igraph_arpack_options_t *o); - -IGRAPH_EXPORT int igraph_arpack_storage_init(igraph_arpack_storage_t *s, long int maxn, - long int maxncv, long int maxldv, igraph_bool_t symm); -IGRAPH_EXPORT void igraph_arpack_storage_destroy(igraph_arpack_storage_t *s); - -/** - * \typedef igraph_arpack_function_t - * Type of the ARPACK callback function - * - * \param to Pointer to an \c igraph_real_t, the result of the - * matrix-vector product is expected to be stored here. - * \param from Pointer to an \c igraph_real_t, the input matrix should - * be multiplied by the vector stored here. - * \param n The length of the vector (which is the same as the order - * of the input matrix). - * \param extra Extra argument to the matrix-vector calculation - * function. This is coming from the \ref igraph_arpack_rssolve() - * or \ref igraph_arpack_rnsolve() function. - * \return Error code, if not zero, then the ARPACK solver considers - * this as an error, stops and calls the igraph error handler. - */ - -typedef int igraph_arpack_function_t(igraph_real_t *to, const igraph_real_t *from, - int n, void *extra); - -IGRAPH_EXPORT int igraph_arpack_rssolve(igraph_arpack_function_t *fun, void *extra, - igraph_arpack_options_t *options, - igraph_arpack_storage_t *storage, - igraph_vector_t *values, igraph_matrix_t *vectors); - -IGRAPH_EXPORT int igraph_arpack_rnsolve(igraph_arpack_function_t *fun, void *extra, - igraph_arpack_options_t *options, - igraph_arpack_storage_t *storage, - igraph_matrix_t *values, igraph_matrix_t *vectors); - -IGRAPH_EXPORT int igraph_arpack_unpack_complex(igraph_matrix_t *vectors, igraph_matrix_t *values, - long int nev); - -__END_DECLS - -#endif diff --git a/src/include/igraph_array.h b/src/include/igraph_array.h deleted file mode 100644 index 627433ad65..0000000000 --- a/src/include/igraph_array.h +++ /dev/null @@ -1,61 +0,0 @@ -/* -*- mode: C -*- */ -/* - IGraph library. - Copyright (C) 2009-2012 Gabor Csardi - 334 Harvard street, Cambridge, MA 02139 USA - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA - -*/ - -#ifndef IGRAPH_ARRAY_H -#define IGRAPH_ARRAY_H - -#include "igraph_decls.h" - -__BEGIN_DECLS - -/* -------------------------------------------------- */ -/* 3D array */ -/* -------------------------------------------------- */ - -#define BASE_IGRAPH_REAL -#include "igraph_pmt.h" -#include "igraph_array_pmt.h" -#include "igraph_pmt_off.h" -#undef BASE_IGRAPH_REAL - -#define BASE_LONG -#include "igraph_pmt.h" -#include "igraph_array_pmt.h" -#include "igraph_pmt_off.h" -#undef BASE_LONG - -#define BASE_CHAR -#include "igraph_pmt.h" -#include "igraph_array_pmt.h" -#include "igraph_pmt_off.h" -#undef BASE_CHAR - -#define BASE_BOOL -#include "igraph_pmt.h" -#include "igraph_array_pmt.h" -#include "igraph_pmt_off.h" -#undef BASE_BOOL - -__END_DECLS - -#endif diff --git a/src/include/igraph_array_pmt.h b/src/include/igraph_array_pmt.h deleted file mode 100644 index 18c73ae8d0..0000000000 --- a/src/include/igraph_array_pmt.h +++ /dev/null @@ -1,51 +0,0 @@ -/* -*- mode: C -*- */ -/* - IGraph library. - Copyright (C) 2007-2012 Gabor Csardi - 334 Harvard street, Cambridge, MA 02139 USA - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA - -*/ - -typedef struct TYPE(igraph_array3) { - TYPE(igraph_vector) data; - long int n1, n2, n3, n1n2; -} TYPE(igraph_array3); - -#ifndef IGRAPH_ARRAY3_INIT_FINALLY -#define IGRAPH_ARRAY3_INIT_FINALLY(a, n1, n2, n3) \ - do { IGRAPH_CHECK(igraph_array3_init(a, n1, n2, n3)); \ - IGRAPH_FINALLY(igraph_array3_destroy, a); } while (0) -#endif - -#ifndef ARRAY3 - #define ARRAY3(m,i,j,k) ((m).data.stor_begin[(m).n1n2*(k)+(m).n1*(j)+(i)]) -#endif - -IGRAPH_EXPORT int FUNCTION(igraph_array3, init)(TYPE(igraph_array3) *a, long int n1, long int n2, - long int n3); -IGRAPH_EXPORT void FUNCTION(igraph_array3, destroy)(TYPE(igraph_array3) *a); -IGRAPH_EXPORT long int FUNCTION(igraph_array3, size)(const TYPE(igraph_array3) *a); -IGRAPH_EXPORT long int FUNCTION(igraph_array3, n)(const TYPE(igraph_array3) *a, long int idx); -IGRAPH_EXPORT int FUNCTION(igraph_array3, resize)(TYPE(igraph_array3) *a, long int n1, long int n2, - long int n3); -IGRAPH_EXPORT void FUNCTION(igraph_array3, null)(TYPE(igraph_array3) *a); -IGRAPH_EXPORT BASE FUNCTION(igraph_array3, sum)(const TYPE(igraph_array3) *a); -IGRAPH_EXPORT void FUNCTION(igraph_array3, scale)(TYPE(igraph_array3) *a, BASE by); -IGRAPH_EXPORT void FUNCTION(igraph_array3, fill)(TYPE(igraph_array3) *a, BASE e); -IGRAPH_EXPORT int FUNCTION(igraph_array3, update)(TYPE(igraph_array3) *to, - const TYPE(igraph_array3) *from); diff --git a/src/include/igraph_attributes.h b/src/include/igraph_attributes.h deleted file mode 100644 index 37c8739471..0000000000 --- a/src/include/igraph_attributes.h +++ /dev/null @@ -1,826 +0,0 @@ -/* -*- mode: C -*- */ -/* - IGraph library. - Copyright (C) 2005-2012 Gabor Csardi - 334 Harvard street, Cambridge, MA 02139 USA - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA - -*/ - -#ifndef IGRAPH_ATTRIBUTES_H -#define IGRAPH_ATTRIBUTES_H - -#include "igraph_decls.h" -#include "igraph_datatype.h" -#include "igraph_types.h" -#include "igraph_vector.h" -#include "igraph_strvector.h" -#include "igraph_vector_ptr.h" -#include "igraph_iterators.h" - -__BEGIN_DECLS - -/* -------------------------------------------------- */ -/* Attributes */ -/* -------------------------------------------------- */ - -/** - * \section about_attributes - * - * Attributes are numbers or strings (or basically any kind - * of data) associated with the vertices or edges of a graph, or - * with the graph itself. Eg. you may label vertices with symbolic names - * or attach numeric weights to the edges of a graph. - * - * igraph attributes are designed to be flexible and extensible. - * In igraph attributes are implemented via an interface abstraction: - * any type implementing the functions in the interface, can be used - * for storing vertex, edge and graph attributes. This means that - * different attribute implementations can be used together with - * igraph. This is reasonable: if igraph is used from Python attributes can be - * of any Python type, from GNU R all R types are allowed. There is an - * experimental attribute implementation to be used when programming - * in C, but by default it is currently turned off. - * - * First we briefly look over how attribute handlers can be - * implemented. This is not something a user does every day. It is - * rather typically the job of the high level interface writers. (But - * it is possible to write an interface without implementing - * attributes.) Then we show the experimental C attribute handler. - */ - -/** - * \section about_attribute_table - * It is possible to attach an attribute handling - * interface to \a igraph. This is simply a table of functions, of - * type \ref igraph_attribute_table_t. These functions are invoked to - * notify the attribute handling code about the structural changes in - * a graph. See the documentation of this type for details. - * - * By default there is no attribute interface attached to \a igraph, - * to attach one, call \ref igraph_set_attribute_table with your new - * table. - * - */ - -/** - * \section about_attribute_combination - * - * Several graph operations may collapse multiple vertices or edges into - * a single one. Attribute combination lists are used to indicate to the attribute - * handler how to combine the attributes of the original vertices or edges and - * how to derive the final attribute value that is to be assigned to the collapsed - * vertex or edge. For example, \ref igraph_simplify() removes loops and combines - * multiple edges into a single one; in case of a graph with an edge attribute - * named \c weight the attribute combination list can tell the attribute handler - * whether the weight of a collapsed edge should be the sum, the mean or some other - * function of the weights of the original edges that were collapsed into one. - * - * One attribute combination list may contain several attribute combination - * records, one for each vertex or edge attribute that is to be handled during the - * operation. - */ - -/** - * \typedef igraph_attribute_type_t - * The possible types of the attributes. - * - * Note that this is only the - * type communicated by the attribute interface towards igraph - * functions. Eg. in the GNU R attribute handler, it is safe to say - * that all complex R object attributes are strings, as long as this - * interface is able to serialize them into strings. See also \ref - * igraph_attribute_table_t. - * \enumval IGRAPH_ATTRIBUTE_DEFAULT Currently not used for anything. - * \enumval IGRAPH_ATTRIBUTE_NUMERIC Numeric attribute. - * \enumval IGRAPH_ATTRIBUTE_BOOLEAN Logical values, true or false. - * \enumval IGRAPH_ATTRIBUTE_STRING Attribute that can be converted to - * a string. - * \enumval IGRAPH_ATTRIBUTE_R_OBJECT An R object. This is usually - * ignored by the igraph functions. - * \enumval IGRAPH_ATTRIBUTE_PY_OBJECT A Python object. Usually - * ignored by the igraph functions. - * - */ -typedef enum { IGRAPH_ATTRIBUTE_DEFAULT = 0, - IGRAPH_ATTRIBUTE_NUMERIC = 1, - IGRAPH_ATTRIBUTE_BOOLEAN = 5, - IGRAPH_ATTRIBUTE_STRING = 2, - IGRAPH_ATTRIBUTE_R_OBJECT = 3, - IGRAPH_ATTRIBUTE_PY_OBJECT = 4 - } igraph_attribute_type_t; - -typedef struct igraph_attribute_record_t { - const char *name; - igraph_attribute_type_t type; - const void *value; -} igraph_attribute_record_t; - -typedef enum { IGRAPH_ATTRIBUTE_GRAPH = 0, - IGRAPH_ATTRIBUTE_VERTEX, - IGRAPH_ATTRIBUTE_EDGE - } igraph_attribute_elemtype_t; - -/** - * \typedef igraph_attribute_combination_type_t - * The possible types of attribute combinations. - * - * \enumval IGRAPH_ATTRIBUTE_COMBINE_IGNORE Ignore old attributes, use an empty value. - * \enumval IGRAPH_ATTRIBUTE_COMBINE_DEFAULT Use the default way to combine attributes (decided by the attribute handler implementation). - * \enumval IGRAPH_ATTRIBUTE_COMBINE_FUNCTION Supply your own function to combine - * attributes. - * \enumval IGRAPH_ATTRIBUTE_COMBINE_SUM Take the sum of the attributes. - * \enumval IGRAPH_ATTRIBUTE_COMBINE_PROD Take the product of the attributes. - * \enumval IGRAPH_ATTRIBUTE_COMBINE_MIN Take the minimum attribute. - * \enumval IGRAPH_ATTRIBUTE_COMBINE_MAX Take the maximum attribute. - * \enumval IGRAPH_ATTRIBUTE_COMBINE_RANDOM Take a random attribute. - * \enumval IGRAPH_ATTRIBUTE_COMBINE_FIRST Take the first attribute. - * \enumval IGRAPH_ATTRIBUTE_COMBINE_LAST Take the last attribute. - * \enumval IGRAPH_ATTRIBUTE_COMBINE_MEAN Take the mean of the attributes. - * \enumval IGRAPH_ATTRIBUTE_COMBINE_MEDIAN Take the median of the attributes. - * \enumval IGRAPH_ATTRIBUTE_COMBINE_CONCAT Concatenate the attributes. - */ -typedef enum { - IGRAPH_ATTRIBUTE_COMBINE_IGNORE = 0, - IGRAPH_ATTRIBUTE_COMBINE_DEFAULT = 1, - IGRAPH_ATTRIBUTE_COMBINE_FUNCTION = 2, - IGRAPH_ATTRIBUTE_COMBINE_SUM = 3, - IGRAPH_ATTRIBUTE_COMBINE_PROD = 4, - IGRAPH_ATTRIBUTE_COMBINE_MIN = 5, - IGRAPH_ATTRIBUTE_COMBINE_MAX = 6, - IGRAPH_ATTRIBUTE_COMBINE_RANDOM = 7, - IGRAPH_ATTRIBUTE_COMBINE_FIRST = 8, - IGRAPH_ATTRIBUTE_COMBINE_LAST = 9, - IGRAPH_ATTRIBUTE_COMBINE_MEAN = 10, - IGRAPH_ATTRIBUTE_COMBINE_MEDIAN = 11, - IGRAPH_ATTRIBUTE_COMBINE_CONCAT = 12 -} igraph_attribute_combination_type_t; - -typedef void (*igraph_function_pointer_t)(void); - -typedef struct igraph_attribute_combination_record_t { - const char *name; /* can be NULL, meaning: the rest */ - igraph_attribute_combination_type_t type; - igraph_function_pointer_t func; -} igraph_attribute_combination_record_t; - -typedef struct igraph_attribute_combination_t { - igraph_vector_ptr_t list; -} igraph_attribute_combination_t; - -#define IGRAPH_NO_MORE_ATTRIBUTES ((const char*)0) - -IGRAPH_EXPORT int igraph_attribute_combination_init(igraph_attribute_combination_t *comb); -IGRAPH_EXPORT int igraph_attribute_combination(igraph_attribute_combination_t *comb, ...); -IGRAPH_EXPORT void igraph_attribute_combination_destroy(igraph_attribute_combination_t *comb); -IGRAPH_EXPORT int igraph_attribute_combination_add(igraph_attribute_combination_t *comb, - const char *name, - igraph_attribute_combination_type_t type, - igraph_function_pointer_t func); -IGRAPH_EXPORT int igraph_attribute_combination_remove(igraph_attribute_combination_t *comb, - const char *name); -IGRAPH_EXPORT int igraph_attribute_combination_query(const igraph_attribute_combination_t *comb, - const char *name, - igraph_attribute_combination_type_t *type, - igraph_function_pointer_t *func); - -/** - * \struct igraph_attribute_table_t - * \brief Table of functions to perform operations on attributes - * - * This type collects the functions defining an attribute handler. - * It has the following members: - * \member init This function is called whenever a new graph object is - * created, right after it is created but before any vertices or - * edges are added. It is supposed to set the \c attr member of the \c - * igraph_t object. It is expected to return an error code. - * \member destroy This function is called whenever the graph object - * is destroyed, right before freeing the allocated memory. - * \member copy This function is called when copying a graph with \ref - * igraph_copy, after the structure of the graph has been already - * copied. It is expected to return an error code. - * \member add_vertices Called when vertices are added to a - * graph, before adding the vertices themselves. - * The number of vertices to add is supplied as an - * argument. Expected to return an error code. - * \member permute_vertices Typically called when a new graph is - * created based on an existing one, e.g. if vertices are removed - * from a graph. The supplied index vector defines which old vertex - * a new vertex corresponds to. Its length must be the same as the - * number of vertices in the new graph. - * \member combine_vertices This function is called when the creation - * of a new graph involves a merge (contraction, etc.) of vertices - * from another graph. The function is after the new graph was created. - * An argument specifies how several vertices from the old graph map to a - * single vertex in the new graph. - * \member add_edges Called when new edges have been added. The number - * of new edges are supplied as well. It is expected to return an - * error code. - * \member permute_edges Typically called when a new graph is created and - * some of the new edges should carry the attributes of some of the - * old edges. The idx vector shows the mapping between the old edges and - * the new ones. Its length is the same as the number of edges in the new - * graph, and for each edge it gives the id of the old edge (the edge in - * the old graph). - * \member combine_edges This function is called when the creation - * of a new graph involves a merge (contraction, etc.) of edges - * from another graph. The function is after the new graph was created. - * An argument specifies how several edges from the old graph map to a - * single edge in the new graph. - * \member get_info Query the attributes of a graph, the names and - * types should be returned. - * \member has_attr Check whether a graph has the named - * graph/vertex/edge attribute. - * \member gettype Query the type of a graph/vertex/edge attribute. - * \member get_numeric_graph_attr Query a numeric graph attribute. The - * value should be placed as the first element of the \p value - * vector. - * \member get_string_graph_attr Query a string graph attribute. The - * value should be placed as the first element of the \p value - * string vector. - * \member get_bool_graph_attr Query a boolean graph attribute. The - * value should be placed as the first element of the \p value - * boolean vector. - * \member get_numeric_vertex_attr Query a numeric vertex attribute, - * for the vertices included in \p vs. - * \member get_string_vertex_attr Query a string vertex attribute, - * for the vertices included in \p vs. - * \member get_bool_vertex_attr Query a boolean vertex attribute, - * for the vertices included in \p vs. - * \member get_numeric_edge_attr Query a numeric edge attribute, for - * the edges included in \p es. - * \member get_string_edge_attr Query a string edge attribute, for the - * edges included in \p es. - * \member get_bool_edge_attr Query a boolean edge attribute, for the - * edges included in \p es. - * - * Note that the get_*_*_attr are allowed to - * convert the attributes to numeric or string. E.g. if a vertex attribute - * is a GNU R complex data type, then - * get_string_vertex_attribute may serialize it - * into a string, but this probably makes sense only if - * add_vertices is able to deserialize it. - */ - -typedef struct igraph_attribute_table_t { - int (*init)(igraph_t *graph, igraph_vector_ptr_t *attr); - void (*destroy)(igraph_t *graph); - int (*copy)(igraph_t *to, const igraph_t *from, igraph_bool_t ga, - igraph_bool_t va, igraph_bool_t ea); - int (*add_vertices)(igraph_t *graph, long int nv, igraph_vector_ptr_t *attr); - int (*permute_vertices)(const igraph_t *graph, - igraph_t *newgraph, - const igraph_vector_t *idx); - int (*combine_vertices)(const igraph_t *graph, - igraph_t *newgraph, - const igraph_vector_ptr_t *merges, - const igraph_attribute_combination_t *comb); - int (*add_edges)(igraph_t *graph, const igraph_vector_t *edges, - igraph_vector_ptr_t *attr); - int (*permute_edges)(const igraph_t *graph, - igraph_t *newgraph, const igraph_vector_t *idx); - int (*combine_edges)(const igraph_t *graph, - igraph_t *newgraph, - const igraph_vector_ptr_t *merges, - const igraph_attribute_combination_t *comb); - int (*get_info)(const igraph_t *graph, - igraph_strvector_t *gnames, igraph_vector_t *gtypes, - igraph_strvector_t *vnames, igraph_vector_t *vtypes, - igraph_strvector_t *enames, igraph_vector_t *etypes); - igraph_bool_t (*has_attr)(const igraph_t *graph, igraph_attribute_elemtype_t type, - const char *name); - int (*gettype)(const igraph_t *graph, igraph_attribute_type_t *type, - igraph_attribute_elemtype_t elemtype, const char *name); - int (*get_numeric_graph_attr)(const igraph_t *graph, const char *name, - igraph_vector_t *value); - int (*get_string_graph_attr)(const igraph_t *graph, const char *name, - igraph_strvector_t *value); - int (*get_bool_graph_attr)(const igraph_t *igraph, const char *name, - igraph_vector_bool_t *value); - int (*get_numeric_vertex_attr)(const igraph_t *graph, const char *name, - igraph_vs_t vs, - igraph_vector_t *value); - int (*get_string_vertex_attr)(const igraph_t *graph, const char *name, - igraph_vs_t vs, - igraph_strvector_t *value); - int (*get_bool_vertex_attr)(const igraph_t *graph, const char *name, - igraph_vs_t vs, - igraph_vector_bool_t *value); - int (*get_numeric_edge_attr)(const igraph_t *graph, const char *name, - igraph_es_t es, - igraph_vector_t *value); - int (*get_string_edge_attr)(const igraph_t *graph, const char *name, - igraph_es_t es, - igraph_strvector_t *value); - int (*get_bool_edge_attr)(const igraph_t *graph, const char *name, - igraph_es_t es, - igraph_vector_bool_t *value); -} igraph_attribute_table_t; - -IGRAPH_EXPORT IGRAPH_DEPRECATED igraph_attribute_table_t * igraph_i_set_attribute_table(const igraph_attribute_table_t * table); -IGRAPH_EXPORT igraph_attribute_table_t * igraph_set_attribute_table(const igraph_attribute_table_t * table); - -IGRAPH_EXPORT igraph_bool_t igraph_has_attribute_table(void); - -/* Experimental attribute handler in C */ - -IGRAPH_EXPORT extern const igraph_attribute_table_t igraph_cattribute_table; - -IGRAPH_EXPORT igraph_real_t igraph_cattribute_GAN(const igraph_t *graph, const char *name); -IGRAPH_EXPORT igraph_bool_t igraph_cattribute_GAB(const igraph_t *graph, const char *name); -IGRAPH_EXPORT const char* igraph_cattribute_GAS(const igraph_t *graph, const char *name); -IGRAPH_EXPORT igraph_real_t igraph_cattribute_VAN(const igraph_t *graph, const char *name, - igraph_integer_t vid); -IGRAPH_EXPORT igraph_bool_t igraph_cattribute_VAB(const igraph_t *graph, const char *name, - igraph_integer_t vid); -IGRAPH_EXPORT const char* igraph_cattribute_VAS(const igraph_t *graph, const char *name, - igraph_integer_t vid); -IGRAPH_EXPORT igraph_real_t igraph_cattribute_EAN(const igraph_t *graph, const char *name, - igraph_integer_t eid); -IGRAPH_EXPORT igraph_bool_t igraph_cattribute_EAB(const igraph_t *graph, const char *name, - igraph_integer_t eid); -IGRAPH_EXPORT const char* igraph_cattribute_EAS(const igraph_t *graph, const char *name, - igraph_integer_t eid); - -IGRAPH_EXPORT int igraph_cattribute_VANV(const igraph_t *graph, const char *name, - igraph_vs_t vids, igraph_vector_t *result); -IGRAPH_EXPORT int igraph_cattribute_EANV(const igraph_t *graph, const char *name, - igraph_es_t eids, igraph_vector_t *result); -IGRAPH_EXPORT int igraph_cattribute_VASV(const igraph_t *graph, const char *name, - igraph_vs_t vids, igraph_strvector_t *result); -IGRAPH_EXPORT int igraph_cattribute_EASV(const igraph_t *graph, const char *name, - igraph_es_t eids, igraph_strvector_t *result); -IGRAPH_EXPORT int igraph_cattribute_VABV(const igraph_t *graph, const char *name, - igraph_vs_t vids, igraph_vector_bool_t *result); -IGRAPH_EXPORT int igraph_cattribute_EABV(const igraph_t *graph, const char *name, - igraph_es_t eids, igraph_vector_bool_t *result); - -IGRAPH_EXPORT int igraph_cattribute_list(const igraph_t *graph, - igraph_strvector_t *gnames, igraph_vector_t *gtypes, - igraph_strvector_t *vnames, igraph_vector_t *vtypes, - igraph_strvector_t *enames, igraph_vector_t *etypes); -IGRAPH_EXPORT igraph_bool_t igraph_cattribute_has_attr(const igraph_t *graph, - igraph_attribute_elemtype_t type, - const char *name); - -IGRAPH_EXPORT int igraph_cattribute_GAN_set(igraph_t *graph, const char *name, - igraph_real_t value); -IGRAPH_EXPORT int igraph_cattribute_GAB_set(igraph_t *graph, const char *name, - igraph_bool_t value); -IGRAPH_EXPORT int igraph_cattribute_GAS_set(igraph_t *graph, const char *name, - const char *value); -IGRAPH_EXPORT int igraph_cattribute_VAN_set(igraph_t *graph, const char *name, - igraph_integer_t vid, igraph_real_t value); -IGRAPH_EXPORT int igraph_cattribute_VAB_set(igraph_t *graph, const char *name, - igraph_integer_t vid, igraph_bool_t value); -IGRAPH_EXPORT int igraph_cattribute_VAS_set(igraph_t *graph, const char *name, - igraph_integer_t vid, const char *value); -IGRAPH_EXPORT int igraph_cattribute_EAN_set(igraph_t *graph, const char *name, - igraph_integer_t eid, igraph_real_t value); -IGRAPH_EXPORT int igraph_cattribute_EAB_set(igraph_t *graph, const char *name, - igraph_integer_t eid, igraph_bool_t value); -IGRAPH_EXPORT int igraph_cattribute_EAS_set(igraph_t *graph, const char *name, - igraph_integer_t eid, const char *value); - -IGRAPH_EXPORT int igraph_cattribute_VAN_setv(igraph_t *graph, const char *name, - const igraph_vector_t *v); -IGRAPH_EXPORT int igraph_cattribute_VAB_setv(igraph_t *graph, const char *name, - const igraph_vector_bool_t *v); -IGRAPH_EXPORT int igraph_cattribute_VAS_setv(igraph_t *graph, const char *name, - const igraph_strvector_t *sv); -IGRAPH_EXPORT int igraph_cattribute_EAN_setv(igraph_t *graph, const char *name, - const igraph_vector_t *v); -IGRAPH_EXPORT int igraph_cattribute_EAB_setv(igraph_t *graph, const char *name, - const igraph_vector_bool_t *v); -IGRAPH_EXPORT int igraph_cattribute_EAS_setv(igraph_t *graph, const char *name, - const igraph_strvector_t *sv); - -IGRAPH_EXPORT void igraph_cattribute_remove_g(igraph_t *graph, const char *name); -IGRAPH_EXPORT void igraph_cattribute_remove_v(igraph_t *graph, const char *name); -IGRAPH_EXPORT void igraph_cattribute_remove_e(igraph_t *graph, const char *name); -IGRAPH_EXPORT void igraph_cattribute_remove_all(igraph_t *graph, igraph_bool_t g, - igraph_bool_t v, igraph_bool_t e); - -/** - * \define GAN - * Query a numeric graph attribute. - * - * This is shorthand for \ref igraph_cattribute_GAN(). - * \param graph The graph. - * \param n The name of the attribute. - * \return The value of the attribute. - */ -#define GAN(graph,n) (igraph_cattribute_GAN((graph), (n))) -/** - * \define GAB - * Query a boolean graph attribute. - * - * This is shorthand for \ref igraph_cattribute_GAB(). - * \param graph The graph. - * \param n The name of the attribute. - * \return The value of the attribute. - */ -#define GAB(graph,n) (igraph_cattribute_GAB((graph), (n))) -/** - * \define GAS - * Query a string graph attribute. - * - * This is shorthand for \ref igraph_cattribute_GAS(). - * \param graph The graph. - * \param n The name of the attribute. - * \return The value of the attribute. - */ -#define GAS(graph,n) (igraph_cattribute_GAS((graph), (n))) -/** - * \define VAN - * Query a numeric vertex attribute. - * - * This is shorthand for \ref igraph_cattribute_VAN(). - * \param graph The graph. - * \param n The name of the attribute. - * \param v The id of the vertex. - * \return The value of the attribute. - */ -#define VAN(graph,n,v) (igraph_cattribute_VAN((graph), (n), (v))) -/** - * \define VAB - * Query a boolean vertex attribute. - * - * This is shorthand for \ref igraph_cattribute_VAB(). - * \param graph The graph. - * \param n The name of the attribute. - * \param v The id of the vertex. - * \return The value of the attribute. - */ -#define VAB(graph,n,v) (igraph_cattribute_VAB((graph), (n), (v))) -/** - * \define VAS - * Query a string vertex attribute. - * - * This is shorthand for \ref igraph_cattribute_VAS(). - * \param graph The graph. - * \param n The name of the attribute. - * \param v The id of the vertex. - * \return The value of the attribute. - */ -#define VAS(graph,n,v) (igraph_cattribute_VAS((graph), (n), (v))) -/** - * \define VANV - * Query a numeric vertex attribute for all vertices. - * - * This is a shorthand for \ref igraph_cattribute_VANV(). - * \param graph The graph. - * \param n The name of the attribute. - * \param vec Pointer to an initialized vector, the result is - * stored here. It will be resized, if needed. - * \return Error code. - */ -#define VANV(graph,n,vec) (igraph_cattribute_VANV((graph),(n), \ - igraph_vss_all(), (vec))) -/** - * \define VABV - * Query a boolean vertex attribute for all vertices. - * - * This is a shorthand for \ref igraph_cattribute_VABV(). - * \param graph The graph. - * \param n The name of the attribute. - * \param vec Pointer to an initialized boolean vector, the result is - * stored here. It will be resized, if needed. - * \return Error code. - */ -#define VABV(graph,n,vec) (igraph_cattribute_VABV((graph),(n), \ - igraph_vss_all(), (vec))) -/** - * \define VASV - * Query a string vertex attribute for all vertices. - * - * This is a shorthand for \ref igraph_cattribute_VASV(). - * \param graph The graph. - * \param n The name of the attribute. - * \param vec Pointer to an initialized string vector, the result is - * stored here. It will be resized, if needed. - * \return Error code. - */ -#define VASV(graph,n,vec) (igraph_cattribute_VASV((graph),(n), \ - igraph_vss_all(), (vec))) -/** - * \define EAN - * Query a numeric edge attribute. - * - * This is shorthand for \ref igraph_cattribute_EAN(). - * \param graph The graph. - * \param n The name of the attribute. - * \param e The id of the edge. - * \return The value of the attribute. - */ -#define EAN(graph,n,e) (igraph_cattribute_EAN((graph), (n), (e))) -/** - * \define EAB - * Query a boolean edge attribute. - * - * This is shorthand for \ref igraph_cattribute_EAB(). - * \param graph The graph. - * \param n The name of the attribute. - * \param e The id of the edge. - * \return The value of the attribute. - */ -#define EAB(graph,n,e) (igraph_cattribute_EAB((graph), (n), (e))) -/** - * \define EAS - * Query a string edge attribute. - * - * This is shorthand for \ref igraph_cattribute_EAS(). - * \param graph The graph. - * \param n The name of the attribute. - * \param e The id of the edge. - * \return The value of the attribute. - */ -#define EAS(graph,n,e) (igraph_cattribute_EAS((graph), (n), (e))) -/** - * \define EANV - * Query a numeric edge attribute for all edges. - * - * This is a shorthand for \ref igraph_cattribute_EANV(). - * \param graph The graph. - * \param n The name of the attribute. - * \param vec Pointer to an initialized vector, the result is - * stored here. It will be resized, if needed. - * \return Error code. - */ -#define EANV(graph,n,vec) (igraph_cattribute_EANV((graph),(n), \ - igraph_ess_all(IGRAPH_EDGEORDER_ID), (vec))) -/** - * \define EABV - * Query a boolean edge attribute for all edges. - * - * This is a shorthand for \ref igraph_cattribute_EABV(). - * \param graph The graph. - * \param n The name of the attribute. - * \param vec Pointer to an initialized vector, the result is - * stored here. It will be resized, if needed. - * \return Error code. - */ -#define EABV(graph,n,vec) (igraph_cattribute_EABV((graph),(n), \ - igraph_ess_all(IGRAPH_EDGEORDER_ID), (vec))) - -/** - * \define EASV - * Query a string edge attribute for all edges. - * - * This is a shorthand for \ref igraph_cattribute_EASV(). - * \param graph The graph. - * \param n The name of the attribute. - * \param vec Pointer to an initialized string vector, the result is - * stored here. It will be resized, if needed. - * \return Error code. - */ -#define EASV(graph,n,vec) (igraph_cattribute_EASV((graph),(n), \ - igraph_ess_all(IGRAPH_EDGEORDER_ID), (vec))) -/** - * \define SETGAN - * Set a numeric graph attribute - * - * This is a shorthand for \ref igraph_cattribute_GAN_set(). - * \param graph The graph. - * \param n The name of the attribute. - * \param value The new value of the attribute. - * \return Error code. - */ -#define SETGAN(graph,n,value) (igraph_cattribute_GAN_set((graph),(n),(value))) -/** - * \define SETGAB - * Set a boolean graph attribute - * - * This is a shorthand for \ref igraph_cattribute_GAB_set(). - * \param graph The graph. - * \param n The name of the attribute. - * \param value The new value of the attribute. - * \return Error code. - */ -#define SETGAB(graph,n,value) (igraph_cattribute_GAB_set((graph),(n),(value))) -/** - * \define SETGAS - * Set a string graph attribute - * - * This is a shorthand for \ref igraph_cattribute_GAS_set(). - * \param graph The graph. - * \param n The name of the attribute. - * \param value The new value of the attribute. - * \return Error code. - */ -#define SETGAS(graph,n,value) (igraph_cattribute_GAS_set((graph),(n),(value))) -/** - * \define SETVAN - * Set a numeric vertex attribute - * - * This is a shorthand for \ref igraph_cattribute_VAN_set(). - * \param graph The graph. - * \param n The name of the attribute. - * \param vid Ids of the vertices to set. - * \param value The new value of the attribute. - * \return Error code. - */ -#define SETVAN(graph,n,vid,value) (igraph_cattribute_VAN_set((graph),(n),(vid),(value))) -/** - * \define SETVAB - * Set a boolean vertex attribute - * - * This is a shorthand for \ref igraph_cattribute_VAB_set(). - * \param graph The graph. - * \param n The name of the attribute. - * \param vid Ids of the vertices to set. - * \param value The new value of the attribute. - * \return Error code. - */ -#define SETVAB(graph,n,vid,value) (igraph_cattribute_VAB_set((graph),(n),(vid),(value))) -/** - * \define SETVAS - * Set a string vertex attribute - * - * This is a shorthand for \ref igraph_cattribute_VAS_set(). - * \param graph The graph. - * \param n The name of the attribute. - * \param vid Ids of the vertices to set. - * \param value The new value of the attribute. - * \return Error code. - */ -#define SETVAS(graph,n,vid,value) (igraph_cattribute_VAS_set((graph),(n),(vid),(value))) -/** - * \define SETEAN - * Set a numeric edge attribute - * - * This is a shorthand for \ref igraph_cattribute_EAN_set(). - * \param graph The graph. - * \param n The name of the attribute. - * \param eid Ids of the edges to set. - * \param value The new value of the attribute. - * \return Error code. - */ -#define SETEAN(graph,n,eid,value) (igraph_cattribute_EAN_set((graph),(n),(eid),(value))) -/** - * \define SETEAB - * Set a boolean edge attribute - * - * This is a shorthand for \ref igraph_cattribute_EAB_set(). - * \param graph The graph. - * \param n The name of the attribute. - * \param eid Ids of the edges to set. - * \param value The new value of the attribute. - * \return Error code. - */ -#define SETEAB(graph,n,eid,value) (igraph_cattribute_EAB_set((graph),(n),(eid),(value))) -/** - * \define SETEAS - * Set a string edge attribute - * - * This is a shorthand for \ref igraph_cattribute_EAS_set(). - * \param graph The graph. - * \param n The name of the attribute. - * \param eid Ids of the edges to set. - * \param value The new value of the attribute. - * \return Error code. - */ -#define SETEAS(graph,n,eid,value) (igraph_cattribute_EAS_set((graph),(n),(eid),(value))) - -/** - * \define SETVANV - * Set a numeric vertex attribute for all vertices - * - * This is a shorthand for \ref igraph_cattribute_VAN_setv(). - * \param graph The graph. - * \param n The name of the attribute. - * \param v Vector containing the new values of the attributes. - * \return Error code. - */ -#define SETVANV(graph,n,v) (igraph_cattribute_VAN_setv((graph),(n),(v))) -/** - * \define SETVABV - * Set a boolean vertex attribute for all vertices - * - * This is a shorthand for \ref igraph_cattribute_VAB_setv(). - * \param graph The graph. - * \param n The name of the attribute. - * \param v Vector containing the new values of the attributes. - * \return Error code. - */ -#define SETVABV(graph,n,v) (igraph_cattribute_VAB_setv((graph),(n),(v))) -/** - * \define SETVASV - * Set a string vertex attribute for all vertices - * - * This is a shorthand for \ref igraph_cattribute_VAS_setv(). - * \param graph The graph. - * \param n The name of the attribute. - * \param v Vector containing the new values of the attributes. - * \return Error code. - */ -#define SETVASV(graph,n,v) (igraph_cattribute_VAS_setv((graph),(n),(v))) -/** - * \define SETEANV - * Set a numeric edge attribute for all edges - * - * This is a shorthand for \ref igraph_cattribute_EAN_setv(). - * \param graph The graph. - * \param n The name of the attribute. - * \param v Vector containing the new values of the attributes. - */ -#define SETEANV(graph,n,v) (igraph_cattribute_EAN_setv((graph),(n),(v))) -/** - * \define SETEABV - * Set a boolean edge attribute for all edges - * - * This is a shorthand for \ref igraph_cattribute_EAB_setv(). - * \param graph The graph. - * \param n The name of the attribute. - * \param v Vector containing the new values of the attributes. - */ -#define SETEABV(graph,n,v) (igraph_cattribute_EAB_setv((graph),(n),(v))) -/** - * \define SETEASV - * Set a string edge attribute for all edges - * - * This is a shorthand for \ref igraph_cattribute_EAS_setv(). - * \param graph The graph. - * \param n The name of the attribute. - * \param v Vector containing the new values of the attributes. - */ -#define SETEASV(graph,n,v) (igraph_cattribute_EAS_setv((graph),(n),(v))) - -/** - * \define DELGA - * Remove a graph attribute. - * - * A shorthand for \ref igraph_cattribute_remove_g(). - * \param graph The graph. - * \param n The name of the attribute to remove. - */ -#define DELGA(graph,n) (igraph_cattribute_remove_g((graph),(n))) -/** - * \define DELVA - * Remove a vertex attribute. - * - * A shorthand for \ref igraph_cattribute_remove_v(). - * \param graph The graph. - * \param n The name of the attribute to remove. - */ -#define DELVA(graph,n) (igraph_cattribute_remove_v((graph),(n))) -/** - * \define DELEA - * Remove an edge attribute. - * - * A shorthand for \ref igraph_cattribute_remove_e(). - * \param graph The graph. - * \param n The name of the attribute to remove. - */ -#define DELEA(graph,n) (igraph_cattribute_remove_e((graph),(n))) -/** - * \define DELGAS - * Remove all graph attributes. - * - * Calls \ref igraph_cattribute_remove_all(). - * \param graph The graph. - */ -#define DELGAS(graph) (igraph_cattribute_remove_all((graph),1,0,0)) -/** - * \define DELVAS - * Remove all vertex attributes. - * - * Calls \ref igraph_cattribute_remove_all(). - * \param graph The graph. - */ -#define DELVAS(graph) (igraph_cattribute_remove_all((graph),0,1,0)) -/** - * \define DELEAS - * Remove all edge attributes. - * - * Calls \ref igraph_cattribute_remove_all(). - * \param graph The graph. - */ -#define DELEAS(graph) (igraph_cattribute_remove_all((graph),0,0,1)) -/** - * \define DELALL - * Remove all attributes. - * - * All graph, vertex and edges attributes will be removed. - * Calls \ref igraph_cattribute_remove_all(). - * \param graph The graph. - */ -#define DELALL(graph) (igraph_cattribute_remove_all((graph),1,1,1)) - -__END_DECLS - -#endif diff --git a/src/include/igraph_bipartite.h b/src/include/igraph_bipartite.h deleted file mode 100644 index 13771e7a5c..0000000000 --- a/src/include/igraph_bipartite.h +++ /dev/null @@ -1,97 +0,0 @@ -/* -*- mode: C -*- */ -/* - IGraph library. - Copyright (C) 2009-2012 Gabor Csardi - 334 Harvard street, Cambridge, MA 02139 USA - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA - -*/ - -#ifndef IGRAPH_BIPARTITE_H -#define IGRAPH_BIPARTITE_H - -#include "igraph_decls.h" -#include "igraph_constants.h" -#include "igraph_types.h" -#include "igraph_vector.h" -#include "igraph_matrix.h" -#include "igraph_datatype.h" - -__BEGIN_DECLS - -/* -------------------------------------------------- */ -/* Bipartite networks */ -/* -------------------------------------------------- */ - -IGRAPH_EXPORT int igraph_full_bipartite(igraph_t *graph, - igraph_vector_bool_t *types, - igraph_integer_t n1, igraph_integer_t n2, - igraph_bool_t directed, - igraph_neimode_t mode); - -IGRAPH_EXPORT int igraph_create_bipartite(igraph_t *g, const igraph_vector_bool_t *types, - const igraph_vector_t *edges, - igraph_bool_t directed); - -IGRAPH_EXPORT int igraph_bipartite_projection_size(const igraph_t *graph, - const igraph_vector_bool_t *types, - igraph_integer_t *vcount1, - igraph_integer_t *ecount1, - igraph_integer_t *vcount2, - igraph_integer_t *ecount2); - -IGRAPH_EXPORT int igraph_bipartite_projection(const igraph_t *graph, - const igraph_vector_bool_t *types, - igraph_t *proj1, - igraph_t *proj2, - igraph_vector_t *multiplicity1, - igraph_vector_t *multiplicity2, - igraph_integer_t probe1); - -IGRAPH_EXPORT int igraph_incidence(igraph_t *graph, igraph_vector_bool_t *types, - const igraph_matrix_t *incidence, igraph_bool_t directed, - igraph_neimode_t mode, igraph_bool_t multiple); - -IGRAPH_EXPORT int igraph_get_incidence(const igraph_t *graph, - const igraph_vector_bool_t *types, - igraph_matrix_t *res, - igraph_vector_t *row_ids, - igraph_vector_t *col_ids); - -IGRAPH_EXPORT int igraph_is_bipartite(const igraph_t *graph, - igraph_bool_t *res, - igraph_vector_bool_t *types); - -IGRAPH_EXPORT int igraph_bipartite_game(igraph_t *graph, igraph_vector_bool_t *types, - igraph_erdos_renyi_t type, - igraph_integer_t n1, igraph_integer_t n2, - igraph_real_t p, igraph_integer_t m, - igraph_bool_t directed, igraph_neimode_t mode); - -IGRAPH_EXPORT int igraph_bipartite_game_gnp(igraph_t *graph, igraph_vector_bool_t *types, - igraph_integer_t n1, igraph_integer_t n2, - igraph_real_t p, igraph_bool_t directed, - igraph_neimode_t mode); - -IGRAPH_EXPORT int igraph_bipartite_game_gnm(igraph_t *graph, igraph_vector_bool_t *types, - igraph_integer_t n1, igraph_integer_t n2, - igraph_integer_t m, igraph_bool_t directed, - igraph_neimode_t mode); - -__END_DECLS - -#endif diff --git a/src/include/igraph_blas.h b/src/include/igraph_blas.h deleted file mode 100644 index 4daf5df89d..0000000000 --- a/src/include/igraph_blas.h +++ /dev/null @@ -1,68 +0,0 @@ -/* -*- mode: C -*- */ -/* - IGraph library. - Copyright (C) 2007-2012 Gabor Csardi - 334 Harvard street, Cambridge, MA 02139 USA - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA - -*/ - -#ifndef IGRAPH_BLAS_H -#define IGRAPH_BLAS_H - -#include "igraph_decls.h" -#include "igraph_types.h" -#include "igraph_vector.h" -#include "igraph_matrix.h" - -__BEGIN_DECLS - -/** - * \section about_blas BLAS interface in igraph - * - * - * BLAS is a highly optimized library for basic linear algebra operations - * such as vector-vector, matrix-vector and matrix-matrix product. - * Please see http://www.netlib.org/blas/ for details and a reference - * implementation in Fortran. igraph contains some wrapper functions - * that can be used to call BLAS routines in a somewhat more - * user-friendly way. Not all BLAS routines are included in igraph, - * and even those which are included might not have wrappers; - * the extension of the set of wrapped functions will probably be driven - * by igraph's internal requirements. The wrapper functions usually - * substitute double-precision floating point arrays used by BLAS with - * \type igraph_vector_t and \type igraph_matrix_t instances and also - * remove those parameters (such as the number of rows/columns) that - * can be inferred from the passed arguments directly. - * - */ - -IGRAPH_EXPORT void igraph_blas_dgemv(igraph_bool_t transpose, igraph_real_t alpha, - const igraph_matrix_t* a, const igraph_vector_t* x, - igraph_real_t beta, igraph_vector_t* y); -IGRAPH_EXPORT void igraph_blas_dgemv_array(igraph_bool_t transpose, igraph_real_t alpha, - const igraph_matrix_t* a, const igraph_real_t* x, - igraph_real_t beta, igraph_real_t* y); - -IGRAPH_EXPORT igraph_real_t igraph_blas_dnrm2(const igraph_vector_t *v); - -IGRAPH_EXPORT int igraph_blas_ddot(const igraph_vector_t *v1, const igraph_vector_t *v2, - igraph_real_t *res); - -__END_DECLS - -#endif diff --git a/src/include/igraph_centrality.h b/src/include/igraph_centrality.h deleted file mode 100644 index c6f5abbc8f..0000000000 --- a/src/include/igraph_centrality.h +++ /dev/null @@ -1,204 +0,0 @@ -/* -*- mode: C -*- */ -/* - IGraph library. - Copyright (C) 2009-2012 Gabor Csardi - 334 Harvard street, Cambridge, MA 02139 USA - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA - -*/ - -#ifndef IGRAPH_CENTRALITY_H -#define IGRAPH_CENTRALITY_H - -#include "igraph_decls.h" -#include "igraph_constants.h" -#include "igraph_types.h" -#include "igraph_datatype.h" -#include "igraph_iterators.h" -#include "igraph_arpack.h" - -__BEGIN_DECLS - -/* -------------------------------------------------- */ -/* Centrality */ -/* -------------------------------------------------- */ - -IGRAPH_EXPORT int igraph_closeness(const igraph_t *graph, igraph_vector_t *res, - igraph_vector_t *reachable_count, igraph_bool_t *all_reachable, - const igraph_vs_t vids, igraph_neimode_t mode, - const igraph_vector_t *weights, igraph_bool_t normalized); -IGRAPH_EXPORT int igraph_closeness_cutoff(const igraph_t *graph, igraph_vector_t *res, - igraph_vector_t *reachable_count, igraph_bool_t *all_reachable, - const igraph_vs_t vids, igraph_neimode_t mode, - const igraph_vector_t *weights, - igraph_bool_t normalized, - igraph_real_t cutoff); - -IGRAPH_EXPORT int igraph_harmonic_centrality(const igraph_t *graph, igraph_vector_t *res, - const igraph_vs_t vids, igraph_neimode_t mode, - const igraph_vector_t *weights, - igraph_bool_t normalized); -IGRAPH_EXPORT int igraph_harmonic_centrality_cutoff(const igraph_t *graph, igraph_vector_t *res, - const igraph_vs_t vids, igraph_neimode_t mode, - const igraph_vector_t *weights, - igraph_bool_t normalized, - igraph_real_t cutoff); - -IGRAPH_EXPORT int igraph_betweenness(const igraph_t *graph, igraph_vector_t *res, - const igraph_vs_t vids, igraph_bool_t directed, - const igraph_vector_t *weights); -IGRAPH_EXPORT int igraph_betweenness_cutoff(const igraph_t *graph, igraph_vector_t *res, - const igraph_vs_t vids, igraph_bool_t directed, - const igraph_vector_t *weights, igraph_real_t cutoff); -IGRAPH_EXPORT int igraph_edge_betweenness(const igraph_t *graph, igraph_vector_t *result, - igraph_bool_t directed, - const igraph_vector_t *weigths); -IGRAPH_EXPORT int igraph_edge_betweenness_cutoff(const igraph_t *graph, igraph_vector_t *result, - igraph_bool_t directed, - const igraph_vector_t *weights, igraph_real_t cutoff); - -/** - * \typedef igraph_pagerank_algo_t - * \brief PageRank algorithm implementation - * - * Algorithms to calculate PageRank. - * \enumval IGRAPH_PAGERANK_ALGO_ARPACK Use the ARPACK library, this - * was the PageRank implementation in igraph from version 0.5, until - * version 0.7. - * \enumval IGRAPH_PAGERANK_ALGO_PRPACK Use the PRPACK - * library. Currently this implementation is recommended. - */ - -typedef enum { - IGRAPH_PAGERANK_ALGO_ARPACK = 1, - IGRAPH_PAGERANK_ALGO_PRPACK = 2 -} igraph_pagerank_algo_t; - -IGRAPH_EXPORT int igraph_pagerank(const igraph_t *graph, igraph_pagerank_algo_t algo, - igraph_vector_t *vector, - igraph_real_t *value, const igraph_vs_t vids, - igraph_bool_t directed, igraph_real_t damping, - const igraph_vector_t *weights, igraph_arpack_options_t *options); -IGRAPH_EXPORT int igraph_personalized_pagerank(const igraph_t *graph, - igraph_pagerank_algo_t algo, igraph_vector_t *vector, - igraph_real_t *value, const igraph_vs_t vids, - igraph_bool_t directed, igraph_real_t damping, - const igraph_vector_t *reset, - const igraph_vector_t *weights, igraph_arpack_options_t *options); -IGRAPH_EXPORT int igraph_personalized_pagerank_vs(const igraph_t *graph, - igraph_pagerank_algo_t algo, - igraph_vector_t *vector, - igraph_real_t *value, const igraph_vs_t vids, - igraph_bool_t directed, igraph_real_t damping, - igraph_vs_t reset_vids, - const igraph_vector_t *weights, igraph_arpack_options_t *options); - -IGRAPH_EXPORT int igraph_eigenvector_centrality(const igraph_t *graph, igraph_vector_t *vector, - igraph_real_t *value, - igraph_bool_t directed, igraph_bool_t scale, - const igraph_vector_t *weights, - igraph_arpack_options_t *options); - -IGRAPH_EXPORT int igraph_hub_score(const igraph_t *graph, igraph_vector_t *vector, - igraph_real_t *value, igraph_bool_t scale, - const igraph_vector_t *weights, - igraph_arpack_options_t *options); -IGRAPH_EXPORT int igraph_authority_score(const igraph_t *graph, igraph_vector_t *vector, - igraph_real_t *value, igraph_bool_t scale, - const igraph_vector_t *weights, - igraph_arpack_options_t *options); - -IGRAPH_EXPORT int igraph_constraint(const igraph_t *graph, igraph_vector_t *res, - igraph_vs_t vids, const igraph_vector_t *weights); - -IGRAPH_EXPORT int igraph_convergence_degree(const igraph_t *graph, igraph_vector_t *result, - igraph_vector_t *ins, igraph_vector_t *outs); - -IGRAPH_EXPORT igraph_real_t igraph_centralization(const igraph_vector_t *scores, - igraph_real_t theoretical_max, - igraph_bool_t normalized); - -IGRAPH_EXPORT int igraph_centralization_degree(const igraph_t *graph, igraph_vector_t *res, - igraph_neimode_t mode, igraph_bool_t loops, - igraph_real_t *centralization, - igraph_real_t *theoretical_max, - igraph_bool_t normalized); -IGRAPH_EXPORT int igraph_centralization_degree_tmax(const igraph_t *graph, - igraph_integer_t nodes, - igraph_neimode_t mode, - igraph_bool_t loops, - igraph_real_t *res); - -IGRAPH_EXPORT int igraph_centralization_betweenness(const igraph_t *graph, - igraph_vector_t *res, - igraph_bool_t directed, - igraph_real_t *centralization, - igraph_real_t *theoretical_max, - igraph_bool_t normalized); -IGRAPH_EXPORT int igraph_centralization_betweenness_tmax(const igraph_t *graph, - igraph_integer_t nodes, - igraph_bool_t directed, - igraph_real_t *res); - -IGRAPH_EXPORT int igraph_centralization_closeness(const igraph_t *graph, - igraph_vector_t *res, - igraph_neimode_t mode, - igraph_real_t *centralization, - igraph_real_t *theoretical_max, - igraph_bool_t normalized); -IGRAPH_EXPORT int igraph_centralization_closeness_tmax(const igraph_t *graph, - igraph_integer_t nodes, - igraph_neimode_t mode, - igraph_real_t *res); - -IGRAPH_EXPORT int igraph_centralization_eigenvector_centrality( - const igraph_t *graph, - igraph_vector_t *vector, - igraph_real_t *value, - igraph_bool_t directed, - igraph_bool_t scale, - igraph_arpack_options_t *options, - igraph_real_t *centralization, - igraph_real_t *theoretical_max, - igraph_bool_t normalized); -IGRAPH_EXPORT int igraph_centralization_eigenvector_centrality_tmax( - const igraph_t *graph, - igraph_integer_t nodes, - igraph_bool_t directed, - igraph_bool_t scale, - igraph_real_t *res); - - -/* Deprecated functions: */ - -IGRAPH_EXPORT IGRAPH_DEPRECATED int igraph_closeness_estimate(const igraph_t *graph, igraph_vector_t *res, - const igraph_vs_t vids, igraph_neimode_t mode, - igraph_real_t cutoff, - const igraph_vector_t *weights, - igraph_bool_t normalized); - -IGRAPH_EXPORT IGRAPH_DEPRECATED int igraph_betweenness_estimate(const igraph_t *graph, igraph_vector_t *res, - const igraph_vs_t vids, igraph_bool_t directed, - igraph_real_t cutoff, const igraph_vector_t *weights); - -IGRAPH_EXPORT IGRAPH_DEPRECATED int igraph_edge_betweenness_estimate(const igraph_t *graph, igraph_vector_t *result, - igraph_bool_t directed, igraph_real_t cutoff, - const igraph_vector_t *weights); - -__END_DECLS - -#endif diff --git a/src/include/igraph_cliques.h b/src/include/igraph_cliques.h deleted file mode 100644 index 179b3f788b..0000000000 --- a/src/include/igraph_cliques.h +++ /dev/null @@ -1,114 +0,0 @@ -/* -*- mode: C -*- */ -/* - IGraph library. - Copyright (C) 2009-2012 Gabor Csardi - 334 Harvard street, Cambridge, MA 02139 USA - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA - -*/ - -#ifndef IGRAPH_CLIQUES_H -#define IGRAPH_CLIQUES_H - -#include "igraph_decls.h" -#include "igraph_types.h" -#include "igraph_datatype.h" -#include "igraph_vector_ptr.h" - -__BEGIN_DECLS - -/* -------------------------------------------------- */ -/* Cliques, maximal independent vertex sets */ -/* -------------------------------------------------- */ - -IGRAPH_EXPORT int igraph_maximal_cliques(const igraph_t *graph, igraph_vector_ptr_t *res, - igraph_integer_t min_size, igraph_integer_t max_size); -IGRAPH_EXPORT int igraph_maximal_cliques_file(const igraph_t *graph, - FILE *outfile, - igraph_integer_t min_size, - igraph_integer_t max_size); -IGRAPH_EXPORT int igraph_maximal_cliques_count(const igraph_t *graph, - igraph_integer_t *res, - igraph_integer_t min_size, - igraph_integer_t max_size); -IGRAPH_EXPORT int igraph_maximal_cliques_subset(const igraph_t *graph, - igraph_vector_int_t *subset, - igraph_vector_ptr_t *res, - igraph_integer_t *no, - FILE *outfile, - igraph_integer_t min_size, - igraph_integer_t max_size); -IGRAPH_EXPORT int igraph_maximal_cliques_hist(const igraph_t *graph, - igraph_vector_t *hist, - igraph_integer_t min_size, - igraph_integer_t max_size); - -IGRAPH_EXPORT int igraph_cliques(const igraph_t *graph, igraph_vector_ptr_t *res, - igraph_integer_t min_size, igraph_integer_t max_size); -IGRAPH_EXPORT int igraph_clique_size_hist(const igraph_t *graph, igraph_vector_t *hist, - igraph_integer_t min_size, igraph_integer_t max_size); -IGRAPH_EXPORT int igraph_largest_cliques(const igraph_t *graph, - igraph_vector_ptr_t *cliques); -IGRAPH_EXPORT int igraph_clique_number(const igraph_t *graph, igraph_integer_t *no); -IGRAPH_EXPORT int igraph_weighted_cliques(const igraph_t *graph, - const igraph_vector_t *vertex_weights, igraph_vector_ptr_t *res, - igraph_real_t min_weight, igraph_real_t max_weight, igraph_bool_t maximal); -IGRAPH_EXPORT int igraph_largest_weighted_cliques(const igraph_t *graph, - const igraph_vector_t *vertex_weights, igraph_vector_ptr_t *res); -IGRAPH_EXPORT int igraph_weighted_clique_number(const igraph_t *graph, - const igraph_vector_t *vertex_weights, igraph_real_t *res); -IGRAPH_EXPORT int igraph_independent_vertex_sets(const igraph_t *graph, - igraph_vector_ptr_t *res, - igraph_integer_t min_size, - igraph_integer_t max_size); -IGRAPH_EXPORT int igraph_largest_independent_vertex_sets(const igraph_t *graph, - igraph_vector_ptr_t *res); -IGRAPH_EXPORT int igraph_maximal_independent_vertex_sets(const igraph_t *graph, - igraph_vector_ptr_t *res); -IGRAPH_EXPORT int igraph_independence_number(const igraph_t *graph, igraph_integer_t *no); - -/** - * \typedef igraph_clique_handler_t - * \brief Type of clique handler functions. - * - * Callback type, called when a clique was found. - * - * See the details at the documentation of \ref - * igraph_cliques_callback(). - * - * \param clique The current clique. Destroying and freeing - * this vector is left to the user. - * Use \ref igraph_vector_destroy() and \ref igraph_free() - * to do this. - * \param arg This extra argument was passed to \ref - * igraph_cliques_callback() when it was called. - * \return Boolean, whether to continue with the clique search. - */ -typedef igraph_bool_t igraph_clique_handler_t(igraph_vector_t *clique, void *arg); - -IGRAPH_EXPORT int igraph_cliques_callback(const igraph_t *graph, - igraph_integer_t min_size, igraph_integer_t max_size, - igraph_clique_handler_t *cliquehandler_fn, void *arg); - -IGRAPH_EXPORT int igraph_maximal_cliques_callback(const igraph_t *graph, - igraph_clique_handler_t *cliquehandler_fn, void *arg, - igraph_integer_t min_size, igraph_integer_t max_size); - - -__END_DECLS - -#endif diff --git a/src/include/igraph_cocitation.h b/src/include/igraph_cocitation.h deleted file mode 100644 index 32699b1080..0000000000 --- a/src/include/igraph_cocitation.h +++ /dev/null @@ -1,66 +0,0 @@ -/* -*- mode: C -*- */ -/* - IGraph library. - Copyright (C) 2009-2012 Gabor Csardi - 334 Harvard street, Cambridge, MA 02139 USA - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA - -*/ - -#ifndef IGRAPH_COCITATION_H -#define IGRAPH_COCITATION_H - -#include "igraph_decls.h" -#include "igraph_types.h" -#include "igraph_matrix.h" -#include "igraph_datatype.h" -#include "igraph_iterators.h" - -__BEGIN_DECLS - -/* -------------------------------------------------- */ -/* Cocitation and other similarity measures */ -/* -------------------------------------------------- */ - -IGRAPH_EXPORT int igraph_cocitation(const igraph_t *graph, igraph_matrix_t *res, - const igraph_vs_t vids); -IGRAPH_EXPORT int igraph_bibcoupling(const igraph_t *graph, igraph_matrix_t *res, - const igraph_vs_t vids); - -IGRAPH_EXPORT int igraph_similarity_jaccard(const igraph_t *graph, igraph_matrix_t *res, - const igraph_vs_t vids, igraph_neimode_t mode, - igraph_bool_t loops); -IGRAPH_EXPORT int igraph_similarity_jaccard_pairs(const igraph_t *graph, igraph_vector_t *res, - const igraph_vector_t *pairs, igraph_neimode_t mode, igraph_bool_t loops); -IGRAPH_EXPORT int igraph_similarity_jaccard_es(const igraph_t *graph, igraph_vector_t *res, - const igraph_es_t es, igraph_neimode_t mode, igraph_bool_t loops); - -IGRAPH_EXPORT int igraph_similarity_dice(const igraph_t *graph, igraph_matrix_t *res, - const igraph_vs_t vids, igraph_neimode_t mode, - igraph_bool_t loops); -IGRAPH_EXPORT int igraph_similarity_dice_pairs(const igraph_t *graph, igraph_vector_t *res, - const igraph_vector_t *pairs, igraph_neimode_t mode, igraph_bool_t loops); -IGRAPH_EXPORT int igraph_similarity_dice_es(const igraph_t *graph, igraph_vector_t *res, - const igraph_es_t es, igraph_neimode_t mode, igraph_bool_t loops); - -IGRAPH_EXPORT int igraph_similarity_inverse_log_weighted(const igraph_t *graph, - igraph_matrix_t *res, const igraph_vs_t vids, - igraph_neimode_t mode); - -__END_DECLS - -#endif diff --git a/src/include/igraph_cohesive_blocks.h b/src/include/igraph_cohesive_blocks.h deleted file mode 100644 index b26a5f3d58..0000000000 --- a/src/include/igraph_cohesive_blocks.h +++ /dev/null @@ -1,42 +0,0 @@ -/* -*- mode: C -*- */ -/* - IGraph library. - Copyright (C) 2010-2012 Gabor Csardi - 334 Harvard street, Cambridge, MA 02139 USA - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA - -*/ - -#ifndef IGRAPH_COHESIVE_BLOCKS_H -#define IGRAPH_COHESIVE_BLOCKS_H - -#include "igraph_decls.h" -#include "igraph_datatype.h" -#include "igraph_vector.h" -#include "igraph_vector_ptr.h" - -__BEGIN_DECLS - -IGRAPH_EXPORT int igraph_cohesive_blocks(const igraph_t *graph, - igraph_vector_ptr_t *blocks, - igraph_vector_t *cohesion, - igraph_vector_t *parent, - igraph_t *block_tree); - -__END_DECLS - -#endif diff --git a/src/include/igraph_coloring.h b/src/include/igraph_coloring.h deleted file mode 100644 index 02876ebd94..0000000000 --- a/src/include/igraph_coloring.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - Heuristic graph coloring algorithms. - Copyright (C) 2017 Szabolcs Horvat - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA -*/ - -#ifndef IGRAPH_COLORING_H -#define IGRAPH_COLORING_H - -#include "igraph_decls.h" -#include "igraph_datatype.h" - -__BEGIN_DECLS - -/** - * \typedef igraph_coloring_greedy_t - * \brief Ordering heuristics for greedy graph coloring. - * - * Ordering heuristics for \ref igraph_vertex_coloring_greedy(). - * - * \enumval IGRAPH_COLORING_GREEDY_COLORED_NEIGHBORS Choose vertex with largest number of already colored neighbors. - * - */ -typedef enum { - IGRAPH_COLORING_GREEDY_COLORED_NEIGHBORS = 0 -} igraph_coloring_greedy_t; - -IGRAPH_EXPORT int igraph_vertex_coloring_greedy(const igraph_t *graph, igraph_vector_int_t *colors, igraph_coloring_greedy_t heuristic); - -__END_DECLS - -#endif /* IGRAPH_COLORING_H */ diff --git a/src/include/igraph_community.h b/src/include/igraph_community.h deleted file mode 100644 index aaaa2461eb..0000000000 --- a/src/include/igraph_community.h +++ /dev/null @@ -1,253 +0,0 @@ -/* -*- mode: C -*- */ -/* - IGraph library. - Copyright (C) 2009-2012 Gabor Csardi - 334 Harvard street, Cambridge, MA 02139 USA - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA - -*/ - -#ifndef IGRAPH_COMMUNITY_H -#define IGRAPH_COMMUNITY_H - -#include "igraph_decls.h" -#include "igraph_constants.h" -#include "igraph_datatype.h" -#include "igraph_types.h" -#include "igraph_arpack.h" -#include "igraph_vector_ptr.h" - -__BEGIN_DECLS - -/* -------------------------------------------------- */ -/* K-Cores */ -/* -------------------------------------------------- */ - -IGRAPH_EXPORT int igraph_coreness(const igraph_t *graph, igraph_vector_t *cores, - igraph_neimode_t mode); - -/* -------------------------------------------------- */ -/* Community Structure */ -/* -------------------------------------------------- */ - -/* TODO: cut.community */ -/* TODO: edge.type.matrix */ -/* TODO: */ - -IGRAPH_EXPORT int igraph_community_optimal_modularity(const igraph_t *graph, - igraph_real_t *modularity, - igraph_vector_t *membership, - const igraph_vector_t *weights); - -IGRAPH_EXPORT int igraph_community_spinglass(const igraph_t *graph, - const igraph_vector_t *weights, - igraph_real_t *modularity, - igraph_real_t *temperature, - igraph_vector_t *membership, - igraph_vector_t *csize, - igraph_integer_t spins, - igraph_bool_t parupdate, - igraph_real_t starttemp, - igraph_real_t stoptemp, - igraph_real_t coolfact, - igraph_spincomm_update_t update_rule, - igraph_real_t gamma, - /* the rest is for the NegSpin implementation */ - igraph_spinglass_implementation_t implementation, - /* igraph_matrix_t *adhesion, */ - /* igraph_matrix_t *normalised_adhesion, */ - /* igraph_real_t *polarization, */ - igraph_real_t lambda); - -IGRAPH_EXPORT int igraph_community_spinglass_single(const igraph_t *graph, - const igraph_vector_t *weights, - igraph_integer_t vertex, - igraph_vector_t *community, - igraph_real_t *cohesion, - igraph_real_t *adhesion, - igraph_integer_t *inner_links, - igraph_integer_t *outer_links, - igraph_integer_t spins, - igraph_spincomm_update_t update_rule, - igraph_real_t gamma); - -IGRAPH_EXPORT int igraph_community_walktrap(const igraph_t *graph, - const igraph_vector_t *weights, - int steps, - igraph_matrix_t *merges, - igraph_vector_t *modularity, - igraph_vector_t *membership); - -IGRAPH_EXPORT int igraph_community_infomap(const igraph_t * graph, - const igraph_vector_t *e_weights, - const igraph_vector_t *v_weights, - int nb_trials, - igraph_vector_t *membership, - igraph_real_t *codelength); - -IGRAPH_EXPORT int igraph_community_edge_betweenness(const igraph_t *graph, - igraph_vector_t *result, - igraph_vector_t *edge_betweenness, - igraph_matrix_t *merges, - igraph_vector_t *bridges, - igraph_vector_t *modularity, - igraph_vector_t *membership, - igraph_bool_t directed, - const igraph_vector_t *weights); -IGRAPH_EXPORT int igraph_community_eb_get_merges(const igraph_t *graph, - const igraph_bool_t directed, - const igraph_vector_t *edges, - const igraph_vector_t *weights, - igraph_matrix_t *merges, - igraph_vector_t *bridges, - igraph_vector_t *modularity, - igraph_vector_t *membership); - -IGRAPH_EXPORT int igraph_community_fastgreedy(const igraph_t *graph, - const igraph_vector_t *weights, - igraph_matrix_t *merges, - igraph_vector_t *modularity, - igraph_vector_t *membership); - -IGRAPH_EXPORT int igraph_community_to_membership(const igraph_matrix_t *merges, - igraph_integer_t nodes, - igraph_integer_t steps, - igraph_vector_t *membership, - igraph_vector_t *csize); -IGRAPH_EXPORT int igraph_le_community_to_membership(const igraph_matrix_t *merges, - igraph_integer_t steps, - igraph_vector_t *membership, - igraph_vector_t *csize); - -IGRAPH_EXPORT int igraph_modularity(const igraph_t *graph, - const igraph_vector_t *membership, - const igraph_vector_t *weights, - const igraph_real_t resolution, - const igraph_bool_t directed, - igraph_real_t *modularity); - -IGRAPH_EXPORT int igraph_modularity_matrix(const igraph_t *graph, - const igraph_vector_t *weights, - const igraph_real_t resolution, - igraph_matrix_t *modmat, - igraph_bool_t directed); - -IGRAPH_EXPORT int igraph_reindex_membership(igraph_vector_t *membership, - igraph_vector_t *new_to_old, - igraph_integer_t *nb_clusters); - -typedef enum { IGRAPH_LEVC_HIST_SPLIT = 1, - IGRAPH_LEVC_HIST_FAILED, - IGRAPH_LEVC_HIST_START_FULL, - IGRAPH_LEVC_HIST_START_GIVEN - } igraph_leading_eigenvector_community_history_t; - -/** - * \typedef igraph_community_leading_eigenvector_callback_t - * Callback for the leading eigenvector community finding method. - * - * The leading eigenvector community finding implementation in igraph - * is able to call a callback function, after each eigenvalue - * calculation. This callback function must be of \c - * igraph_community_leading_eigenvector_callback_t type. - * The following arguments are passed to the callback: - * \param membership The actual membership vector, before recording - * the potential change implied by the newly found eigenvalue. - * \param comm The id of the community that the algorithm tried to - * split in the last iteration. The community ids are indexed from - * zero here! - * \param eigenvalue The eigenvalue the algorithm has just found. - * \param eigenvector The eigenvector corresponding to the eigenvalue - * the algorithm just found. - * \param arpack_multiplier A function that was passed to \ref - * igraph_arpack_rssolve() to solve the last eigenproblem. - * \param arpack_extra The extra argument that was passed to the - * ARPACK solver. - * \param extra Extra argument that as passed to \ref - * igraph_community_leading_eigenvector(). - * - * \sa \ref igraph_community_leading_eigenvector(), \ref - * igraph_arpack_function_t, \ref igraph_arpack_rssolve(). - */ - -typedef int igraph_community_leading_eigenvector_callback_t( - const igraph_vector_t *membership, - long int comm, - igraph_real_t eigenvalue, - const igraph_vector_t *eigenvector, - igraph_arpack_function_t *arpack_multiplier, - void *arpack_extra, - void *extra); - -IGRAPH_EXPORT int igraph_community_leading_eigenvector(const igraph_t *graph, - const igraph_vector_t *weights, - igraph_matrix_t *merges, - igraph_vector_t *membership, - igraph_integer_t steps, - igraph_arpack_options_t *options, - igraph_real_t *modularity, - igraph_bool_t start, - igraph_vector_t *eigenvalues, - igraph_vector_ptr_t *eigenvectors, - igraph_vector_t *history, - igraph_community_leading_eigenvector_callback_t *callback, - void *callback_extra); - -IGRAPH_EXPORT int igraph_community_fluid_communities(const igraph_t *graph, - igraph_integer_t no_of_communities, - igraph_vector_t *membership, - igraph_real_t *modularity); - -IGRAPH_EXPORT int igraph_community_label_propagation(const igraph_t *graph, - igraph_vector_t *membership, - const igraph_vector_t *weights, - const igraph_vector_t *initial, - const igraph_vector_bool_t *fixed, - igraph_real_t *modularity); - -IGRAPH_EXPORT int igraph_community_multilevel(const igraph_t *graph, - const igraph_vector_t *weights, - const igraph_real_t resolution, - igraph_vector_t *membership, - igraph_matrix_t *memberships, - igraph_vector_t *modularity); - -IGRAPH_EXPORT int igraph_community_leiden(const igraph_t *graph, - const igraph_vector_t *edge_weights, - const igraph_vector_t *node_weights, - const igraph_real_t resolution_parameter, - const igraph_real_t beta, - const igraph_bool_t start, - igraph_vector_t *membership, - igraph_integer_t *nb_clusters, - igraph_real_t *quality); -/* -------------------------------------------------- */ -/* Community Structure Comparison */ -/* -------------------------------------------------- */ - -IGRAPH_EXPORT int igraph_compare_communities(const igraph_vector_t *comm1, - const igraph_vector_t *comm2, - igraph_real_t* result, - igraph_community_comparison_t method); -IGRAPH_EXPORT int igraph_split_join_distance(const igraph_vector_t *comm1, - const igraph_vector_t *comm2, - igraph_integer_t* distance12, - igraph_integer_t* distance21); - -__END_DECLS - -#endif diff --git a/src/include/igraph_complex.h b/src/include/igraph_complex.h deleted file mode 100644 index 2ff0b45aa8..0000000000 --- a/src/include/igraph_complex.h +++ /dev/null @@ -1,104 +0,0 @@ -/* -*- mode: C -*- */ -/* - IGraph library. - Copyright (C) 2010-2012 Gabor Csardi - 334 Harvard street, Cambridge, MA 02139 USA - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA - -*/ - -#ifndef IGRAPH_COMPLEX_H -#define IGRAPH_COMPLEX_H - -#include "igraph_decls.h" -#include "igraph_types.h" - -__BEGIN_DECLS - -typedef struct igraph_complex_t { - igraph_real_t dat[2]; -} igraph_complex_t; - -#define IGRAPH_REAL(x) ((x).dat[0]) -#define IGRAPH_IMAG(x) ((x).dat[1]) -#define IGRAPH_COMPLEX_EQ(x,y) ((x).dat[0]==(y).dat[0] && (x).dat[1]==(y).dat[1]) - -IGRAPH_EXPORT igraph_complex_t igraph_complex(igraph_real_t x, igraph_real_t y); -IGRAPH_EXPORT igraph_complex_t igraph_complex_polar(igraph_real_t r, igraph_real_t theta); - -IGRAPH_EXPORT igraph_bool_t igraph_complex_eq_tol(igraph_complex_t z1, - igraph_complex_t z2, - igraph_real_t tol); - -IGRAPH_EXPORT igraph_real_t igraph_complex_mod(igraph_complex_t z); -IGRAPH_EXPORT igraph_real_t igraph_complex_arg(igraph_complex_t z); - -IGRAPH_EXPORT igraph_real_t igraph_complex_abs(igraph_complex_t z); -IGRAPH_EXPORT igraph_real_t igraph_complex_logabs(igraph_complex_t z); - -IGRAPH_EXPORT igraph_complex_t igraph_complex_add(igraph_complex_t z1, - igraph_complex_t z2); -IGRAPH_EXPORT igraph_complex_t igraph_complex_sub(igraph_complex_t z1, - igraph_complex_t z2); -IGRAPH_EXPORT igraph_complex_t igraph_complex_mul(igraph_complex_t z1, - igraph_complex_t z2); -IGRAPH_EXPORT igraph_complex_t igraph_complex_div(igraph_complex_t z1, - igraph_complex_t z2); - -IGRAPH_EXPORT igraph_complex_t igraph_complex_add_real(igraph_complex_t z, - igraph_real_t x); -IGRAPH_EXPORT igraph_complex_t igraph_complex_add_imag(igraph_complex_t z, - igraph_real_t y); -IGRAPH_EXPORT igraph_complex_t igraph_complex_sub_real(igraph_complex_t z, - igraph_real_t x); -IGRAPH_EXPORT igraph_complex_t igraph_complex_sub_imag(igraph_complex_t z, - igraph_real_t y); -IGRAPH_EXPORT igraph_complex_t igraph_complex_mul_real(igraph_complex_t z, - igraph_real_t x); -IGRAPH_EXPORT igraph_complex_t igraph_complex_mul_imag(igraph_complex_t z, - igraph_real_t y); -IGRAPH_EXPORT igraph_complex_t igraph_complex_div_real(igraph_complex_t z, - igraph_real_t x); -IGRAPH_EXPORT igraph_complex_t igraph_complex_div_imag(igraph_complex_t z, - igraph_real_t y); - -IGRAPH_EXPORT igraph_complex_t igraph_complex_conj(igraph_complex_t z); -IGRAPH_EXPORT igraph_complex_t igraph_complex_neg(igraph_complex_t z); -IGRAPH_EXPORT igraph_complex_t igraph_complex_inv(igraph_complex_t z); - -IGRAPH_EXPORT igraph_complex_t igraph_complex_sqrt(igraph_complex_t z); -IGRAPH_EXPORT igraph_complex_t igraph_complex_sqrt_real(igraph_real_t x); -IGRAPH_EXPORT igraph_complex_t igraph_complex_exp(igraph_complex_t z); -IGRAPH_EXPORT igraph_complex_t igraph_complex_pow(igraph_complex_t z1, - igraph_complex_t z2); -IGRAPH_EXPORT igraph_complex_t igraph_complex_pow_real(igraph_complex_t z, - igraph_real_t x); -IGRAPH_EXPORT igraph_complex_t igraph_complex_log(igraph_complex_t z); -IGRAPH_EXPORT igraph_complex_t igraph_complex_log10(igraph_complex_t z); -IGRAPH_EXPORT igraph_complex_t igraph_complex_log_b(igraph_complex_t z, - igraph_complex_t b); - -IGRAPH_EXPORT igraph_complex_t igraph_complex_sin(igraph_complex_t z); -IGRAPH_EXPORT igraph_complex_t igraph_complex_cos(igraph_complex_t z); -IGRAPH_EXPORT igraph_complex_t igraph_complex_tan(igraph_complex_t z); -IGRAPH_EXPORT igraph_complex_t igraph_complex_sec(igraph_complex_t z); -IGRAPH_EXPORT igraph_complex_t igraph_complex_csc(igraph_complex_t z); -IGRAPH_EXPORT igraph_complex_t igraph_complex_cot(igraph_complex_t z); - -__END_DECLS - -#endif diff --git a/src/include/igraph_components.h b/src/include/igraph_components.h deleted file mode 100644 index b9c4797286..0000000000 --- a/src/include/igraph_components.h +++ /dev/null @@ -1,61 +0,0 @@ -/* -*- mode: C -*- */ -/* - IGraph library. - Copyright (C) 2009-2012 Gabor Csardi - 334 Harvard street, Cambridge, MA 02139 USA - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA - -*/ - -#ifndef IGRAPH_COMPONENTS_H -#define IGRAPH_COMPONENTS_H - -#include "igraph_decls.h" -#include "igraph_constants.h" -#include "igraph_types.h" -#include "igraph_vector.h" -#include "igraph_vector_ptr.h" -#include "igraph_datatype.h" - -__BEGIN_DECLS - -/* -------------------------------------------------- */ -/* Components */ -/* -------------------------------------------------- */ - -IGRAPH_EXPORT int igraph_clusters(const igraph_t *graph, igraph_vector_t *membership, - igraph_vector_t *csize, igraph_integer_t *no, - igraph_connectedness_t mode); -IGRAPH_EXPORT int igraph_is_connected(const igraph_t *graph, igraph_bool_t *res, - igraph_connectedness_t mode); -IGRAPH_EXPORT void igraph_decompose_destroy(igraph_vector_ptr_t *complist); -IGRAPH_EXPORT int igraph_decompose(const igraph_t *graph, igraph_vector_ptr_t *components, - igraph_connectedness_t mode, - long int maxcompno, long int minelements); -IGRAPH_EXPORT int igraph_articulation_points(const igraph_t *graph, - igraph_vector_t *res); -IGRAPH_EXPORT int igraph_biconnected_components(const igraph_t *graph, - igraph_integer_t *no, - igraph_vector_ptr_t *tree_edges, - igraph_vector_ptr_t *component_edges, - igraph_vector_ptr_t *components, - igraph_vector_t *articulation_points); -IGRAPH_EXPORT int igraph_bridges(const igraph_t *graph, igraph_vector_t *bridges); - -__END_DECLS - -#endif diff --git a/src/include/igraph_constants.h b/src/include/igraph_constants.h deleted file mode 100644 index 3fcb305aba..0000000000 --- a/src/include/igraph_constants.h +++ /dev/null @@ -1,203 +0,0 @@ -/* -*- mode: C -*- */ -/* - IGraph library. - Copyright (C) 2009-2012 Gabor Csardi - 334 Harvard street, Cambridge, MA 02139 USA - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA - -*/ - -#ifndef IGRAPH_CONSTANTS_H -#define IGRAPH_CONSTANTS_H - -#include "igraph_decls.h" -#include "igraph_types.h" -#include "igraph_datatype.h" - -__BEGIN_DECLS - -/* -------------------------------------------------- */ -/* Constants */ -/* -------------------------------------------------- */ - -typedef enum { IGRAPH_UNDIRECTED = 0, IGRAPH_DIRECTED = 1 } igraph_i_directed_t; - -/* Note for the enum below: yes, IGRAPH_LOOPS_TWICE is 1, and IGRAPH_LOOPS_ONCE - * is 2. This is intentional, for the sake of backwards compatibility with - * earlier versions where we only had IGRAPH_LOOPS and it meant - * IGRAPH_LOOPS_TWICE */ -typedef enum { IGRAPH_NO_LOOPS = 0, IGRAPH_LOOPS = 1, IGRAPH_LOOPS_TWICE = 1, IGRAPH_LOOPS_ONCE = 2 } igraph_loops_t; - -typedef enum { IGRAPH_NO_MULTIPLE = 0, IGRAPH_MULTIPLE = 1 } igraph_multiple_t; - -typedef enum { IGRAPH_ASCENDING = 0, IGRAPH_DESCENDING = 1 } igraph_order_t; - -typedef enum { IGRAPH_MINIMUM = 0, IGRAPH_MAXIMUM = 1 } igraph_optimal_t; - -typedef enum { IGRAPH_OUT = 1, IGRAPH_IN = 2, IGRAPH_ALL = 3, - IGRAPH_TOTAL = 3 - } igraph_neimode_t; - -/* Reverse IGRAPH_OUT to IGRAPH_IN and vice versa. Leave other values alone. */ -#define IGRAPH_REVERSE_MODE(mode) \ - ((mode) == IGRAPH_IN ? IGRAPH_OUT : ((mode) == IGRAPH_OUT ? IGRAPH_IN : (mode))) - -typedef enum { IGRAPH_WEAK = 1, IGRAPH_STRONG = 2 } igraph_connectedness_t; - -typedef enum { IGRAPH_RECIPROCITY_DEFAULT = 0, - IGRAPH_RECIPROCITY_RATIO = 1 - } igraph_reciprocity_t; - -typedef enum { IGRAPH_ADJ_DIRECTED = 0, - IGRAPH_ADJ_UNDIRECTED = 1, IGRAPH_ADJ_MAX = 1, - IGRAPH_ADJ_UPPER, IGRAPH_ADJ_LOWER, IGRAPH_ADJ_MIN, - IGRAPH_ADJ_PLUS - } igraph_adjacency_t; - -typedef enum { IGRAPH_STAR_OUT = 0, IGRAPH_STAR_IN, - IGRAPH_STAR_UNDIRECTED, - IGRAPH_STAR_MUTUAL - } igraph_star_mode_t; - -typedef enum { IGRAPH_TREE_OUT = 0, IGRAPH_TREE_IN, - IGRAPH_TREE_UNDIRECTED - } igraph_tree_mode_t; - -typedef enum { IGRAPH_ERDOS_RENYI_GNP = 0, - IGRAPH_ERDOS_RENYI_GNM - } igraph_erdos_renyi_t; - -typedef enum { IGRAPH_GET_ADJACENCY_UPPER = 0, - IGRAPH_GET_ADJACENCY_LOWER, - IGRAPH_GET_ADJACENCY_BOTH - } igraph_get_adjacency_t; - -typedef enum { IGRAPH_DEGSEQ_SIMPLE = 0, - IGRAPH_DEGSEQ_VL, - IGRAPH_DEGSEQ_SIMPLE_NO_MULTIPLE, - IGRAPH_DEGSEQ_SIMPLE_NO_MULTIPLE_UNIFORM - } igraph_degseq_t; - -typedef enum { IGRAPH_REALIZE_DEGSEQ_SMALLEST = 0, - IGRAPH_REALIZE_DEGSEQ_LARGEST, - IGRAPH_REALIZE_DEGSEQ_INDEX - } igraph_realize_degseq_t; - -typedef enum { IGRAPH_RANDOM_TREE_PRUFER = 0, - IGRAPH_RANDOM_TREE_LERW - } igraph_random_tree_t; - -typedef enum { IGRAPH_FILEFORMAT_EDGELIST = 0, - IGRAPH_FILEFORMAT_NCOL, - IGRAPH_FILEFORMAT_PAJEK, - IGRAPH_FILEFORMAT_LGL, - IGRAPH_FILEFORMAT_GRAPHML - } igraph_fileformat_type_t; - -typedef enum { IGRAPH_REWIRING_SIMPLE = 0, - IGRAPH_REWIRING_SIMPLE_LOOPS - } igraph_rewiring_t; - -typedef enum { IGRAPH_EDGEORDER_ID = 0, - IGRAPH_EDGEORDER_FROM, - IGRAPH_EDGEORDER_TO - } igraph_edgeorder_type_t; - -typedef enum { IGRAPH_TO_DIRECTED_ARBITRARY = 0, - IGRAPH_TO_DIRECTED_MUTUAL, - IGRAPH_TO_DIRECTED_RANDOM, - IGRAPH_TO_DIRECTED_ACYCLIC - } igraph_to_directed_t; - -typedef enum { IGRAPH_TO_UNDIRECTED_EACH = 0, - IGRAPH_TO_UNDIRECTED_COLLAPSE, - IGRAPH_TO_UNDIRECTED_MUTUAL - } igraph_to_undirected_t; - -typedef enum { IGRAPH_VCONN_NEI_ERROR = 0, - IGRAPH_VCONN_NEI_NUMBER_OF_NODES, - IGRAPH_VCONN_NEI_IGNORE, - IGRAPH_VCONN_NEI_NEGATIVE - } igraph_vconn_nei_t; - -typedef enum { IGRAPH_SPINCOMM_UPDATE_SIMPLE = 0, - IGRAPH_SPINCOMM_UPDATE_CONFIG - } igraph_spincomm_update_t; - -typedef enum { IGRAPH_DONT_SIMPLIFY = 0, - IGRAPH_SIMPLIFY - } igraph_lazy_adlist_simplify_t; - -typedef enum { IGRAPH_TRANSITIVITY_NAN = 0, - IGRAPH_TRANSITIVITY_ZERO - } igraph_transitivity_mode_t; - -typedef enum { IGRAPH_SPINCOMM_IMP_ORIG = 0, - IGRAPH_SPINCOMM_IMP_NEG - } igraph_spinglass_implementation_t; - -typedef enum { IGRAPH_COMMCMP_VI = 0, - IGRAPH_COMMCMP_NMI, - IGRAPH_COMMCMP_SPLIT_JOIN, - IGRAPH_COMMCMP_RAND, - IGRAPH_COMMCMP_ADJUSTED_RAND - } igraph_community_comparison_t; - -typedef enum { IGRAPH_ADD_WEIGHTS_NO = 0, - IGRAPH_ADD_WEIGHTS_YES, - IGRAPH_ADD_WEIGHTS_IF_PRESENT - } igraph_add_weights_t; - -typedef enum { IGRAPH_BARABASI_BAG = 0, - IGRAPH_BARABASI_PSUMTREE, - IGRAPH_BARABASI_PSUMTREE_MULTIPLE - } igraph_barabasi_algorithm_t; - -typedef enum { IGRAPH_FAS_EXACT_IP = 0, - IGRAPH_FAS_APPROX_EADES - } igraph_fas_algorithm_t; - -typedef enum { IGRAPH_SUBGRAPH_AUTO = 0, - IGRAPH_SUBGRAPH_COPY_AND_DELETE, - IGRAPH_SUBGRAPH_CREATE_FROM_SCRATCH - } igraph_subgraph_implementation_t; - -typedef enum { IGRAPH_IMITATE_AUGMENTED = 0, - IGRAPH_IMITATE_BLIND, - IGRAPH_IMITATE_CONTRACTED - } igraph_imitate_algorithm_t; - -typedef igraph_real_t igraph_scalar_function_t(const igraph_vector_t *var, - const igraph_vector_t *par, - void* extra); -typedef void igraph_vector_function_t(const igraph_vector_t *var, - const igraph_vector_t *par, - igraph_vector_t* res, void* extra); - -typedef enum { IGRAPH_LAYOUT_GRID = 0, - IGRAPH_LAYOUT_NOGRID, - IGRAPH_LAYOUT_AUTOGRID - } igraph_layout_grid_t; - -typedef enum { IGRAPH_RANDOM_WALK_STUCK_ERROR = 0, - IGRAPH_RANDOM_WALK_STUCK_RETURN - } igraph_random_walk_stuck_t; - - -__END_DECLS - -#endif diff --git a/src/include/igraph_constructors.h b/src/include/igraph_constructors.h deleted file mode 100644 index d7b1987349..0000000000 --- a/src/include/igraph_constructors.h +++ /dev/null @@ -1,80 +0,0 @@ -/* -*- mode: C -*- */ -/* - IGraph library. - Copyright (C) 2009-2012 Gabor Csardi - 334 Harvard street, Cambridge, MA 02139 USA - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA - -*/ - -#ifndef IGRAPH_CONSTRUCTORS_H -#define IGRAPH_CONSTRUCTORS_H - -#include "igraph_decls.h" -#include "igraph_constants.h" -#include "igraph_types.h" -#include "igraph_matrix.h" -#include "igraph_datatype.h" -#include "igraph_graphicality.h" - -__BEGIN_DECLS - -/* -------------------------------------------------- */ -/* Constructors, deterministic */ -/* -------------------------------------------------- */ - -IGRAPH_EXPORT int igraph_create(igraph_t *graph, const igraph_vector_t *edges, igraph_integer_t n, - igraph_bool_t directed); -IGRAPH_EXPORT int igraph_small(igraph_t *graph, igraph_integer_t n, igraph_bool_t directed, - ...); -IGRAPH_EXPORT int igraph_adjacency(igraph_t *graph, const igraph_matrix_t *adjmatrix, - igraph_adjacency_t mode); -IGRAPH_EXPORT int igraph_weighted_adjacency(igraph_t *graph, const igraph_matrix_t *adjmatrix, - igraph_adjacency_t mode, const char* attr, - igraph_bool_t loops); -IGRAPH_EXPORT int igraph_star(igraph_t *graph, igraph_integer_t n, igraph_star_mode_t mode, - igraph_integer_t center); -IGRAPH_EXPORT int igraph_lattice(igraph_t *graph, const igraph_vector_t *dimvector, igraph_integer_t nei, - igraph_bool_t directed, igraph_bool_t mutual, igraph_bool_t circular); -IGRAPH_EXPORT int igraph_ring(igraph_t *graph, igraph_integer_t n, igraph_bool_t directed, - igraph_bool_t mutual, igraph_bool_t circular); -IGRAPH_EXPORT int igraph_tree(igraph_t *graph, igraph_integer_t n, igraph_integer_t children, - igraph_tree_mode_t type); -IGRAPH_EXPORT int igraph_from_prufer(igraph_t *graph, const igraph_vector_int_t *prufer); -IGRAPH_EXPORT int igraph_full(igraph_t *graph, igraph_integer_t n, igraph_bool_t directed, igraph_bool_t loops); -IGRAPH_EXPORT int igraph_full_citation(igraph_t *graph, igraph_integer_t n, - igraph_bool_t directed); -IGRAPH_EXPORT int igraph_atlas(igraph_t *graph, int number); -IGRAPH_EXPORT int igraph_extended_chordal_ring(igraph_t *graph, igraph_integer_t nodes, - const igraph_matrix_t *W, igraph_bool_t directed); -IGRAPH_EXPORT int igraph_linegraph(const igraph_t *graph, igraph_t *linegraph); - -IGRAPH_EXPORT int igraph_de_bruijn(igraph_t *graph, igraph_integer_t m, igraph_integer_t n); -IGRAPH_EXPORT int igraph_kautz(igraph_t *graph, igraph_integer_t m, igraph_integer_t n); -IGRAPH_EXPORT int igraph_famous(igraph_t *graph, const char *name); -IGRAPH_EXPORT int igraph_lcf_vector(igraph_t *graph, igraph_integer_t n, - const igraph_vector_t *shifts, - igraph_integer_t repeats); -IGRAPH_EXPORT int igraph_lcf(igraph_t *graph, igraph_integer_t n, ...); -IGRAPH_EXPORT int igraph_realize_degree_sequence(igraph_t *graph, - const igraph_vector_t *outdeg, const igraph_vector_t *indeg, - igraph_edge_type_sw_t allowed_edge_types, - igraph_realize_degseq_t method); - -__END_DECLS - -#endif diff --git a/src/include/igraph_conversion.h b/src/include/igraph_conversion.h deleted file mode 100644 index d191dc2880..0000000000 --- a/src/include/igraph_conversion.h +++ /dev/null @@ -1,66 +0,0 @@ -/* -*- mode: C -*- */ -/* - IGraph library. - Copyright (C) 2009-2012 Gabor Csardi - 334 Harvard street, Cambridge, MA 02139 USA - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA - -*/ - -#ifndef IGRAPH_CONVERSION_H -#define IGRAPH_CONVERSION_H - -#include "igraph_decls.h" -#include "igraph_constants.h" -#include "igraph_types.h" -#include "igraph_datatype.h" -#include "igraph_spmatrix.h" -#include "igraph_matrix.h" -#include "igraph_sparsemat.h" -#include "igraph_attributes.h" - -__BEGIN_DECLS - -/* -------------------------------------------------- */ -/* Conversion */ -/* -------------------------------------------------- */ - -IGRAPH_EXPORT int igraph_get_adjacency(const igraph_t *graph, igraph_matrix_t *res, - igraph_get_adjacency_t type, igraph_bool_t eids); -IGRAPH_EXPORT int igraph_get_adjacency_sparse(const igraph_t *graph, igraph_spmatrix_t *res, - igraph_get_adjacency_t type); - -IGRAPH_EXPORT int igraph_get_stochastic(const igraph_t *graph, - igraph_matrix_t *matrix, - igraph_bool_t column_wise); - -IGRAPH_EXPORT int igraph_get_stochastic_sparsemat(const igraph_t *graph, - igraph_sparsemat_t *sparsemat, - igraph_bool_t column_wise); - -IGRAPH_EXPORT int igraph_get_edgelist(const igraph_t *graph, igraph_vector_t *res, igraph_bool_t bycol); - -IGRAPH_EXPORT int igraph_to_directed(igraph_t *graph, - igraph_to_directed_t flags); -IGRAPH_EXPORT int igraph_to_undirected(igraph_t *graph, - igraph_to_undirected_t mode, - const igraph_attribute_combination_t *edge_comb); -IGRAPH_EXPORT int igraph_to_prufer(const igraph_t *graph, igraph_vector_int_t *prufer); - -__END_DECLS - -#endif diff --git a/src/include/igraph_datatype.h b/src/include/igraph_datatype.h deleted file mode 100644 index 5e2219255e..0000000000 --- a/src/include/igraph_datatype.h +++ /dev/null @@ -1,86 +0,0 @@ -/* -*- mode: C -*- */ -/* - IGraph library. - Copyright (C) 2009-2012 Gabor Csardi - 334 Harvard street, Cambridge, MA 02139 USA - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA - -*/ - -#ifndef IGRAPH_DATATYPE_H -#define IGRAPH_DATATYPE_H - -#include "igraph_decls.h" -#include "igraph_types.h" -#include "igraph_vector.h" - -__BEGIN_DECLS - -/** - * \ingroup internal - * \struct igraph_t - * \brief The internal data structure for storing graphs. - * - * It is simple and efficient. It has the following members: - * - n The number of vertices, redundant. - * - directed Whether the graph is directed. - * - from The first column of the edge list. - * - to The second column of the edge list. - * - oi The index of the edge list by the first column. Thus - * the first edge according to this order goes from - * \c from[oi[0]] to \c to[oi[0]]. The length of - * this vector is the same as the number of edges in the graph. - * - ii The index of the edge list by the second column. - * The length of this vector is the same as the number of edges. - * - os Contains pointers to the edgelist (\c from - * and \c to for every vertex. The first edge \em from - * vertex \c v is edge no. \c from[oi[os[v]]] if - * \c os[v]is This is basically the same as os, but this time - * for the incoming edges. - * - * For undirected graphs, the same edge list is stored, i.e. an - * undirected edge is stored only once. Currently, undirected edges - * are canonicalized so that the index of the 'from' vertex is not greater - * than the index of the 'to' vertex. Thus, if v1 <= v2, only the edge (v1, v2) - * needs to be searched for, not (v2, v1), to determine if v1 and v2 are connected. - * However, this fact is NOT guaranteed by the documented public API, - * and should not be relied upon by the implementation of any functions, - * except those belonging to the minimal API in type_indexededgelist.c. - * - * The storage requirements for a graph with \c |V| vertices - * and \c |E| edges is \c O(|E|+|V|). - */ -typedef struct igraph_s { - igraph_integer_t n; - igraph_bool_t directed; - igraph_vector_t from; - igraph_vector_t to; - igraph_vector_t oi; - igraph_vector_t ii; - igraph_vector_t os; - igraph_vector_t is; - void *attr; -} igraph_t; - -__END_DECLS - -#endif diff --git a/src/include/igraph_decls.h b/src/include/igraph_decls.h deleted file mode 100644 index f55e4fa6f6..0000000000 --- a/src/include/igraph_decls.h +++ /dev/null @@ -1,19 +0,0 @@ -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus - #define __BEGIN_DECLS extern "C" { - #define __END_DECLS } -#else - #define __BEGIN_DECLS /* empty */ - #define __END_DECLS /* empty */ -#endif - -/* This is to eliminate gcc warnings about unused parameters */ -#define IGRAPH_UNUSED(x) (void)(x) - -/* Include the definition of macros controlling symbol visibility */ -#include "igraph_export.h" - -/* Used instead of IGRAPH_EXPORT with functions that need to be tested, - * but are not part of the public API. */ -#define IGRAPH_PRIVATE_EXPORT IGRAPH_EXPORT diff --git a/src/include/igraph_dqueue.h b/src/include/igraph_dqueue.h deleted file mode 100644 index 5aab71f3e7..0000000000 --- a/src/include/igraph_dqueue.h +++ /dev/null @@ -1,73 +0,0 @@ -/* -*- mode: C -*- */ -/* - IGraph library. - Copyright (C) 2009-2012 Gabor Csardi - 334 Harvard street, Cambridge, MA 02139 USA - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA - -*/ - -#ifndef IGRAPH_DQUEUE_H -#define IGRAPH_DQUEUE_H - -#include "igraph_decls.h" -#include "igraph_types.h" - -__BEGIN_DECLS - -/* -------------------------------------------------- */ -/* double ended queue, very useful */ -/* -------------------------------------------------- */ - -#define BASE_IGRAPH_REAL -#include "igraph_pmt.h" -#include "igraph_dqueue_pmt.h" -#include "igraph_pmt_off.h" -#undef BASE_IGRAPH_REAL - -#define BASE_LONG -#include "igraph_pmt.h" -#include "igraph_dqueue_pmt.h" -#include "igraph_pmt_off.h" -#undef BASE_LONG - -#define BASE_CHAR -#include "igraph_pmt.h" -#include "igraph_dqueue_pmt.h" -#include "igraph_pmt_off.h" -#undef BASE_CHAR - -#define BASE_BOOL -#include "igraph_pmt.h" -#include "igraph_dqueue_pmt.h" -#include "igraph_pmt_off.h" -#undef BASE_BOOL - -#define BASE_INT -#include "igraph_pmt.h" -#include "igraph_dqueue_pmt.h" -#include "igraph_pmt_off.h" -#undef BASE_INT - -#define IGRAPH_DQUEUE_NULL { 0,0,0,0 } -#define IGRAPH_DQUEUE_INIT_FINALLY(v, size) \ - do { IGRAPH_CHECK(igraph_dqueue_init(v, size)); \ - IGRAPH_FINALLY(igraph_dqueue_destroy, v); } while (0) - -__END_DECLS - -#endif diff --git a/src/include/igraph_dqueue_pmt.h b/src/include/igraph_dqueue_pmt.h deleted file mode 100644 index d478bdce31..0000000000 --- a/src/include/igraph_dqueue_pmt.h +++ /dev/null @@ -1,49 +0,0 @@ -/* -*- mode: C -*- */ -/* - IGraph library. - Copyright (C) 2007-2012 Gabor Csardi - 334 Harvard street, Cambridge, MA 02139 USA - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA - -*/ - -/** - * Double ended queue data type. - * \ingroup internal - */ - -typedef struct TYPE(igraph_dqueue) { - BASE *begin; - BASE *end; - BASE *stor_begin; - BASE *stor_end; -} TYPE(igraph_dqueue); - -IGRAPH_EXPORT int FUNCTION(igraph_dqueue, init) (TYPE(igraph_dqueue)* q, long int size); -IGRAPH_EXPORT void FUNCTION(igraph_dqueue, destroy) (TYPE(igraph_dqueue)* q); -IGRAPH_EXPORT igraph_bool_t FUNCTION(igraph_dqueue, empty) (const TYPE(igraph_dqueue)* q); -IGRAPH_EXPORT void FUNCTION(igraph_dqueue, clear) (TYPE(igraph_dqueue)* q); -IGRAPH_EXPORT igraph_bool_t FUNCTION(igraph_dqueue, full) (TYPE(igraph_dqueue)* q); -IGRAPH_EXPORT long int FUNCTION(igraph_dqueue, size) (const TYPE(igraph_dqueue)* q); -IGRAPH_EXPORT BASE FUNCTION(igraph_dqueue, pop) (TYPE(igraph_dqueue)* q); -IGRAPH_EXPORT BASE FUNCTION(igraph_dqueue, pop_back)(TYPE(igraph_dqueue)* q); -IGRAPH_EXPORT BASE FUNCTION(igraph_dqueue, head) (const TYPE(igraph_dqueue)* q); -IGRAPH_EXPORT BASE FUNCTION(igraph_dqueue, back) (const TYPE(igraph_dqueue)* q); -IGRAPH_EXPORT int FUNCTION(igraph_dqueue, push) (TYPE(igraph_dqueue)* q, BASE elem); -IGRAPH_EXPORT int FUNCTION(igraph_dqueue, print)(const TYPE(igraph_dqueue)* q); -IGRAPH_EXPORT int FUNCTION(igraph_dqueue, fprint)(const TYPE(igraph_dqueue)* q, FILE *file); -IGRAPH_EXPORT BASE FUNCTION(igraph_dqueue, e)(const TYPE(igraph_dqueue) *q, long int idx); diff --git a/src/include/igraph_eigen.h b/src/include/igraph_eigen.h deleted file mode 100644 index 67ba26d4ad..0000000000 --- a/src/include/igraph_eigen.h +++ /dev/null @@ -1,111 +0,0 @@ -/* -*- mode: C -*- */ -/* - IGraph library. - Copyright (C) 2010-2012 Gabor Csardi - 334 Harvard street, Cambridge, MA 02139 USA - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA - -*/ - -#ifndef IGRAPH_EIGEN_H -#define IGRAPH_EIGEN_H - -#include "igraph_decls.h" -#include "igraph_arpack.h" -#include "igraph_lapack.h" -#include "igraph_sparsemat.h" - -__BEGIN_DECLS - -typedef enum { IGRAPH_EIGEN_AUTO = 0, - IGRAPH_EIGEN_LAPACK, - IGRAPH_EIGEN_ARPACK, - IGRAPH_EIGEN_COMP_AUTO, - IGRAPH_EIGEN_COMP_LAPACK, - IGRAPH_EIGEN_COMP_ARPACK - } igraph_eigen_algorithm_t; - -typedef enum { IGRAPH_EIGEN_LM = 0, - IGRAPH_EIGEN_SM, /* 1 */ - IGRAPH_EIGEN_LA, /* 2 */ - IGRAPH_EIGEN_SA, /* 3 */ - IGRAPH_EIGEN_BE, /* 4 */ - IGRAPH_EIGEN_LR, /* 5 */ - IGRAPH_EIGEN_SR, /* 6 */ - IGRAPH_EIGEN_LI, /* 7 */ - IGRAPH_EIGEN_SI, /* 8 */ - IGRAPH_EIGEN_ALL, /* 9 */ - IGRAPH_EIGEN_INTERVAL, /* 10 */ - IGRAPH_EIGEN_SELECT - } /* 11 */ -igraph_eigen_which_position_t; - -typedef struct igraph_eigen_which_t { - igraph_eigen_which_position_t pos; - int howmany; - int il, iu; - igraph_real_t vl, vu; - int vestimate; - igraph_lapack_dgeevx_balance_t balance; -} igraph_eigen_which_t; - -IGRAPH_EXPORT int igraph_eigen_matrix_symmetric(const igraph_matrix_t *A, - const igraph_sparsemat_t *sA, - igraph_arpack_function_t *fun, int n, - void *extra, - igraph_eigen_algorithm_t algorithm, - const igraph_eigen_which_t *which, - igraph_arpack_options_t *options, - igraph_arpack_storage_t *storage, - igraph_vector_t *values, - igraph_matrix_t *vectors); - -IGRAPH_EXPORT int igraph_eigen_matrix(const igraph_matrix_t *A, - const igraph_sparsemat_t *sA, - igraph_arpack_function_t *fun, int n, - void *extra, - igraph_eigen_algorithm_t algorithm, - const igraph_eigen_which_t *which, - igraph_arpack_options_t *options, - igraph_arpack_storage_t *storage, - igraph_vector_complex_t *values, - igraph_matrix_complex_t *vectors); - -IGRAPH_EXPORT int igraph_eigen_adjacency(const igraph_t *graph, - igraph_eigen_algorithm_t algorithm, - const igraph_eigen_which_t *which, - igraph_arpack_options_t *options, - igraph_arpack_storage_t *storage, - igraph_vector_t *values, - igraph_matrix_t *vectors, - igraph_vector_complex_t *cmplxvalues, - igraph_matrix_complex_t *cmplxvectors); - -IGRAPH_EXPORT int igraph_eigen_laplacian(const igraph_t *graph, - igraph_eigen_algorithm_t algorithm, - const igraph_eigen_which_t *which, - igraph_arpack_options_t *options, - igraph_arpack_storage_t *storage, - igraph_vector_t *values, - igraph_matrix_t *vectors, - igraph_vector_complex_t *cmplxvalues, - igraph_matrix_complex_t *cmplxvectors); - - -__END_DECLS - -#endif diff --git a/src/include/igraph_embedding.h b/src/include/igraph_embedding.h deleted file mode 100644 index 3eb97c67d7..0000000000 --- a/src/include/igraph_embedding.h +++ /dev/null @@ -1,68 +0,0 @@ -/* -*- mode: C -*- */ -/* - IGraph library. - Copyright (C) 2013 Gabor Csardi - 334 Harvard street, Cambridge, MA 02139 USA - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA - -*/ - -#ifndef IGRAPH_EMBEDDING_H -#define IGRAPH_EMBEDDING_H - -#include "igraph_decls.h" -#include "igraph_datatype.h" -#include "igraph_arpack.h" -#include "igraph_eigen.h" -#include "igraph_constants.h" - -__BEGIN_DECLS - -IGRAPH_EXPORT int igraph_adjacency_spectral_embedding(const igraph_t *graph, - igraph_integer_t no, - const igraph_vector_t *weights, - igraph_eigen_which_position_t which, - igraph_bool_t scaled, - igraph_matrix_t *X, - igraph_matrix_t *Y, - igraph_vector_t *D, - const igraph_vector_t *cvec, - igraph_arpack_options_t *options); - -typedef enum { - IGRAPH_EMBEDDING_D_A = 0, - IGRAPH_EMBEDDING_I_DAD, - IGRAPH_EMBEDDING_DAD, - IGRAPH_EMBEDDING_OAP -} igraph_laplacian_spectral_embedding_type_t; - -IGRAPH_EXPORT int igraph_laplacian_spectral_embedding(const igraph_t *graph, - igraph_integer_t no, - const igraph_vector_t *weights, - igraph_eigen_which_position_t which, - igraph_laplacian_spectral_embedding_type_t type, - igraph_bool_t scaled, - igraph_matrix_t *X, - igraph_matrix_t *Y, - igraph_vector_t *D, - igraph_arpack_options_t *options); - -IGRAPH_EXPORT int igraph_dim_select(const igraph_vector_t *sv, igraph_integer_t *dim); - -__END_DECLS - -#endif diff --git a/src/include/igraph_epidemics.h b/src/include/igraph_epidemics.h deleted file mode 100644 index 52c1122c38..0000000000 --- a/src/include/igraph_epidemics.h +++ /dev/null @@ -1,67 +0,0 @@ -/* -*- mode: C -*- */ -/* - IGraph library. - Copyright (C) 2014 Gabor Csardi - 334 Harvard street, Cambridge, MA 02139 USA - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA - -*/ - -#ifndef IGRAPH_EPIDEMICS_H -#define IGRAPH_EPIDEMICS_H - -#include "igraph_decls.h" -#include "igraph_datatype.h" -#include "igraph_vector.h" -#include "igraph_vector_ptr.h" - -__BEGIN_DECLS - -/** - * \struct igraph_sir_t - * \brief The result of one SIR model simulation. - * - * Data structure to store the results of one simulation - * of the SIR (susceptible-infected-recovered) model on a graph. - * - * It has the following members. They are all (real or integer) - * vectors, and they are of the same length. - * - * \member times A vector, the times of the events are stored here. - * \member no_s An integer vector, the number of susceptibles in - * each time step is stored here. - * \member no_i An integer vector, the number of infected individuals - * at each time step, is stored here. - * \member no_r An integer vector, the number of recovered individuals - * is stored here at each time step. - */ - -typedef struct igraph_sir_t { - igraph_vector_t times; - igraph_vector_int_t no_s, no_i, no_r; -} igraph_sir_t; - -IGRAPH_EXPORT int igraph_sir_init(igraph_sir_t *sir); -IGRAPH_EXPORT void igraph_sir_destroy(igraph_sir_t *sir); - -IGRAPH_EXPORT int igraph_sir(const igraph_t *graph, igraph_real_t beta, - igraph_real_t gamma, igraph_integer_t no_sim, - igraph_vector_ptr_t *result); - -__END_DECLS - -#endif diff --git a/src/include/igraph_error.h b/src/include/igraph_error.h deleted file mode 100644 index c9d6e54a46..0000000000 --- a/src/include/igraph_error.h +++ /dev/null @@ -1,997 +0,0 @@ -/* -*- mode: C -*- */ -/* - IGraph library. - Copyright (C) 2003-2012 Gabor Csardi - 334 Harvard street, Cambridge, MA 02139 USA - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA - -*/ - -#ifndef IGRAPH_ERROR_H -#define IGRAPH_ERROR_H - -#include "igraph_decls.h" - -#include - -__BEGIN_DECLS - -/* This file contains the igraph error handling. - * Most bits are taken literally from the GSL library (with the GSL_ - * prefix renamed to IGRAPH_), as I couldn't find a better way to do - * them. */ - -/* IGRAPH_NORETURN indicates to the compiler that a function does not return. - * There are standard facilities for this, namely _Noreturn in C11 and [[noreturn]] in C++11. - * However, since igraph is currently compiled with older standards, and since - * the standard 'noreturn' specification would need to be diferent between C and C++, - * we do not use these facilities. - */ -#if defined(__GNUC__) -/* Compilers that support the GNU C syntax. Use __noreturn__ instead of 'noreturn' as the latter is a macro in C11. */ -#define IGRAPH_NORETURN __attribute__((__noreturn__)) -#elif defined(_MSC_VER) -/* Compilers that support the MSVC syntax. */ -#define IGRAPH_NORETURN __declspec(noreturn) -#else -#define IGRAPH_NORETURN -#endif - -/** - * \section error_handling_basics Error handling basics - * - * \a igraph functions can run into various problems preventing them - * from normal operation. The user might have supplied invalid arguments, - * e.g. a non-square matrix when a square-matrix was expected, or the program - * has run out of memory while some more memory allocation is required, etc. - * - * - * By default \a igraph aborts the program when it runs into an - * error. While this behavior might be good enough for smaller programs, - * it is without doubt avoidable in larger projects. Please read further - * if your project requires more sophisticated error handling. You can - * safely skip the rest of this chapter otherwise. - * - */ - -/** - * \section error_handlers Error handlers - * - * - * If \a igraph runs into an error - an invalid argument was supplied - * to a function, or we've ran out of memory - the control is - * transferred to the \emb error handler \eme function. - * - * The default error handler is \ref igraph_error_handler_abort which - * prints an error message and aborts the program. - * - * - * The \ref igraph_set_error_handler() function can be used to set a new - * error handler function of type \ref igraph_error_handler_t; see the - * documentation of this type for details. - * - * - * There are two other predefined error handler functions, - * \ref igraph_error_handler_ignore and \ref igraph_error_handler_printignore. - * These deallocate the temporarily allocated memory (more about this - * later) and return with the error code. The latter also prints an - * error message. If you use these error handlers you need to take - * care about possible errors yourself by checking the return value of - * (almost) every non-void \a igraph function. - * - * Independently of the error handler installed, all functions in the - * library do their best to leave their arguments - * \em semantically unchanged if an error - * happens. By semantically we mean that the implementation of an - * object supplied as an argument might change, but its - * \quote meaning \endquote in most cases does not. The rare occasions - * when this rule is violated are documented in this manual. - * - */ - -/** - * \section error_codes Error codes - * - * Every \a igraph function which can fail return a - * single integer error code. Some functions are very simple and - * cannot run into any error, these may return other types, or - * \type void as well. The error codes are defined by the - * \ref igraph_error_type_t enumeration. - * - */ - -/** - * \section writing_error_handlers Writing error handlers - * - * - * The contents of the rest of this chapter might be useful only - * for those who want to create an interface to \a igraph from another - * language. Most readers can safely skip to the next chapter. - * - * - * - * You can write and install error handlers simply by defining a - * function of type \ref igraph_error_handler_t and calling - * \ref igraph_set_error_handler(). This feature is useful for interface - * writers, as \a igraph will have the chance to - * signal errors the appropriate way, e.g. the R interface defines an - * error handler which calls the error() - * function, as required by R, while the Python interface has an error - * handler which raises an exception according to the Python way. - * - * - * If you want to write an error handler, your error handler should - * call \ref IGRAPH_FINALLY_FREE() to deallocate all temporary memory to - * prevent memory leaks. Note that this may invalidate the error message - * buffer \p reason passed to the error handler. Do not access it after - * having called \ref IGRAPH_FINALLY_FREE(). - * - */ - -/** - * \section error_handling_internals Error handling internals - * - * - * If an error happens, the functions in the library call the - * \ref IGRAPH_ERROR() macro with a textual description of the error and an - * \a igraph error code. This macro calls (through the \ref - * igraph_error() function) the installed error handler. Another useful - * macro is \ref IGRAPH_CHECK(). This checks the return value of its - * argument, which is normally a function call, and calls \ref - * IGRAPH_ERROR() if it is not \c IGRAPH_SUCCESS. - * - */ - -/** - * \section deallocating_memory Deallocating memory - * - * - * If a function runs into an error (and the program is not aborted) - * the error handler should deallocate all temporary memory. This is - * done by storing the address and the destroy function of all temporary - * objects in a stack. The \ref IGRAPH_FINALLY function declares an object as - * temporary by placing its address in the stack. If an \a igraph function returns - * with success it calls \ref IGRAPH_FINALLY_CLEAN() with the - * number of objects to remove from the stack. If an error happens - * however, the error handler should call \ref IGRAPH_FINALLY_FREE() to - * deallocate each object added to the stack. This means that the - * temporary objects allocated in the calling function (and etc.) will - * be freed as well. - * - */ - -/** - * \section writing_functions_error_handling Writing \a igraph functions with - * proper error handling - * - * - * There are some simple rules to keep in order to have functions - * behaving well in erroneous situations. First, check the arguments - * of the functions and call \ref IGRAPH_ERROR() if they are invalid. Second, - * call \ref IGRAPH_FINALLY on each dynamically allocated object and call - * \ref IGRAPH_FINALLY_CLEAN() with the proper argument before returning. Third, use - * \ref IGRAPH_CHECK on all \a igraph function calls which can generate errors. - * - * - * The size of the stack used for this bookkeeping is fixed, and - * small. If you want to allocate several objects, write a destroy - * function which can deallocate all of these. See the - * adjlist.c file in the - * \a igraph source for an example. - * - * - * For some functions these mechanisms are simply not flexible - * enough. These functions should define their own error handlers and - * restore the error handler before they return. - * - */ - -/** - * \section error_handling_threads Error handling and threads - * - * - * It is likely that the \a igraph error handling - * method is \em not thread-safe, mainly because of - * the static global stack which is used to store the address of the - * temporarily allocated objects. This issue might be addressed in a - * later version of \a igraph. - * - */ - -/** - * \typedef igraph_error_handler_t - * \brief The type of error handler functions. - * - * This is the type of the error handler functions. - * \param reason Textual description of the error. - * \param file The source file in which the error is noticed. - * \param line The number of the line in the source file which triggered - * the error - * \param igraph_errno The \a igraph error code. - */ - -typedef void igraph_error_handler_t (const char *reason, const char *file, - int line, int igraph_errno); - -/** - * \var igraph_error_handler_abort - * \brief Abort program in case of error. - * - * The default error handler, prints an error message and aborts the - * program. - */ - -IGRAPH_EXPORT igraph_error_handler_t igraph_error_handler_abort; - -/** - * \var igraph_error_handler_ignore - * \brief Ignore errors. - * - * This error handler frees the temporarily allocated memory and returns - * with the error code. - */ - -IGRAPH_EXPORT igraph_error_handler_t igraph_error_handler_ignore; - -/** - * \var igraph_error_handler_printignore - * \brief Print and ignore errors. - * - * Frees temporarily allocated memory, prints an error message to the - * standard error and returns with the error code. - */ - -IGRAPH_EXPORT igraph_error_handler_t igraph_error_handler_printignore; - -/** - * \function igraph_set_error_handler - * \brief Sets a new error handler. - * - * Installs a new error handler. If called with 0, it installs the - * default error handler (which is currently - * \ref igraph_error_handler_abort). - * \param new_handler The error handler function to install. - * \return The old error handler function. This should be saved and - * restored if \p new_handler is not needed any - * more. - */ - -IGRAPH_EXPORT igraph_error_handler_t* igraph_set_error_handler(igraph_error_handler_t* new_handler); - -/** - * \typedef igraph_error_type_t - * \brief Error code type. - * These are the possible values returned by \a igraph functions. - * Note that these are interesting only if you defined an error handler - * with \ref igraph_set_error_handler(). Otherwise the program is aborted - * and the function causing the error never returns. - * - * \enumval IGRAPH_SUCCESS The function successfully completed its task. - * \enumval IGRAPH_FAILURE Something went wrong. You'll almost never - * meet this error as normally more specific error codes are used. - * \enumval IGRAPH_ENOMEM There wasn't enough memory to allocate - * on the heap. - * \enumval IGRAPH_PARSEERROR A parse error was found in a file. - * \enumval IGRAPH_EINVAL A parameter's value is invalid. E.g. negative - * number was specified as the number of vertices. - * \enumval IGRAPH_EXISTS A graph/vertex/edge attribute is already - * installed with the given name. - * \enumval IGRAPH_EINVEVECTOR Invalid vector of vertex ids. A vertex id - * is either negative or bigger than the number of vertices minus one. - * \enumval IGRAPH_EINVVID Invalid vertex id, negative or too big. - * \enumval IGRAPH_NONSQUARE A non-square matrix was received while a - * square matrix was expected. - * \enumval IGRAPH_EINVMODE Invalid mode parameter. - * \enumval IGRAPH_EFILE A file operation failed. E.g. a file doesn't exist, - * or the user has no rights to open it. - * \enumval IGRAPH_UNIMPLEMENTED Attempted to call an unimplemented or - * disabled (at compile-time) function. - * \enumval IGRAPH_DIVERGED A numeric algorithm failed to converge. - * \enumval IGRAPH_ARPACK_PROD Matrix-vector product failed (not used any more). - * \enumval IGRAPH_ARPACK_NPOS N must be positive. - * \enumval IGRAPH_ARPACK_NEVNPOS NEV must be positive. - * \enumval IGRAPH_ARPACK_NCVSMALL NCV must be bigger. - * \enumval IGRAPH_ARPACK_NONPOSI Maximum number of iterations should be positive. - * \enumval IGRAPH_ARPACK_WHICHINV Invalid WHICH parameter. - * \enumval IGRAPH_ARPACK_BMATINV Invalid BMAT parameter. - * \enumval IGRAPH_ARPACK_WORKLSMALL WORKL is too small. - * \enumval IGRAPH_ARPACK_TRIDERR LAPACK error in tridiagonal eigenvalue calculation. - * \enumval IGRAPH_ARPACK_ZEROSTART Starting vector is zero. - * \enumval IGRAPH_ARPACK_MODEINV MODE is invalid. - * \enumval IGRAPH_ARPACK_MODEBMAT MODE and BMAT are not compatible. - * \enumval IGRAPH_ARPACK_ISHIFT ISHIFT must be 0 or 1. - * \enumval IGRAPH_ARPACK_NEVBE NEV and WHICH='BE' are incompatible. - * \enumval IGRAPH_ARPACK_NOFACT Could not build an Arnoldi factorization. - * \enumval IGRAPH_ARPACK_FAILED No eigenvalues to sufficient accuracy. - * \enumval IGRAPH_ARPACK_HOWMNY HOWMNY is invalid. - * \enumval IGRAPH_ARPACK_HOWMNYS HOWMNY='S' is not implemented. - * \enumval IGRAPH_ARPACK_EVDIFF Different number of converged Ritz values. - * \enumval IGRAPH_ARPACK_SHUR Error from calculation of a real Schur form. - * \enumval IGRAPH_ARPACK_LAPACK LAPACK (dtrevc) error for calculating eigenvectors. - * \enumval IGRAPH_ARPACK_UNKNOWN Unknown ARPACK error. - * \enumval IGRAPH_ENEGLOOP Negative loop detected while calculating shortest paths. - * \enumval IGRAPH_EINTERNAL Internal error, likely a bug in igraph. - * \enumval IGRAPH_EDIVZERO Big integer division by zero. - * \enumval IGRAPH_GLP_EBOUND GLPK error (GLP_EBOUND). - * \enumval IGRAPH_GLP_EROOT GLPK error (GLP_EROOT). - * \enumval IGRAPH_GLP_ENOPFS GLPK error (GLP_ENOPFS). - * \enumval IGRAPH_GLP_ENODFS GLPK error (GLP_ENODFS). - * \enumval IGRAPH_GLP_EFAIL GLPK error (GLP_EFAIL). - * \enumval IGRAPH_GLP_EMIPGAP GLPK error (GLP_EMIPGAP). - * \enumval IGRAPH_GLP_ETMLIM GLPK error (GLP_ETMLIM). - * \enumval IGRAPH_GLP_ESTOP GLPK error (GLP_ESTOP). - * \enumval IGRAPH_EATTRIBUTES Attribute handler error. The user is not - * expected to find this; it is signalled if some igraph function is - * not using the attribute handler interface properly. - * \enumval IGRAPH_EATTRCOMBINE Unimplemented attribute combination - * method for the given attribute type. - * \enumval IGRAPH_ELAPACK A LAPACK call resulted in an error. - * \enumval IGRAPH_EDRL Internal error in the DrL layout generator. - * \enumval IGRAPH_EOVERFLOW Integer or double overflow. - * \enumval IGRAPH_EGLP Internal GLPK error. - * \enumval IGRAPH_CPUTIME CPU time exceeded. - * \enumval IGRAPH_EUNDERFLOW Integer or double underflow. - * \enumval IGRAPH_ERWSTUCK Random walk got stuck. - */ - -typedef enum { - IGRAPH_SUCCESS = 0, - IGRAPH_FAILURE = 1, - IGRAPH_ENOMEM = 2, - IGRAPH_PARSEERROR = 3, - IGRAPH_EINVAL = 4, - IGRAPH_EXISTS = 5, - IGRAPH_EINVEVECTOR = 6, - IGRAPH_EINVVID = 7, - IGRAPH_NONSQUARE = 8, - IGRAPH_EINVMODE = 9, - IGRAPH_EFILE = 10, - IGRAPH_UNIMPLEMENTED = 12, - IGRAPH_INTERRUPTED = 13, - IGRAPH_DIVERGED = 14, - IGRAPH_ARPACK_PROD = 15, /* unused, reserved */ - IGRAPH_ARPACK_NPOS = 16, - IGRAPH_ARPACK_NEVNPOS = 17, - IGRAPH_ARPACK_NCVSMALL = 18, - IGRAPH_ARPACK_NONPOSI = 19, - IGRAPH_ARPACK_WHICHINV = 20, - IGRAPH_ARPACK_BMATINV = 21, - IGRAPH_ARPACK_WORKLSMALL = 22, - IGRAPH_ARPACK_TRIDERR = 23, - IGRAPH_ARPACK_ZEROSTART = 24, - IGRAPH_ARPACK_MODEINV = 25, - IGRAPH_ARPACK_MODEBMAT = 26, - IGRAPH_ARPACK_ISHIFT = 27, - IGRAPH_ARPACK_NEVBE = 28, - IGRAPH_ARPACK_NOFACT = 29, - IGRAPH_ARPACK_FAILED = 30, - IGRAPH_ARPACK_HOWMNY = 31, - IGRAPH_ARPACK_HOWMNYS = 32, - IGRAPH_ARPACK_EVDIFF = 33, - IGRAPH_ARPACK_SHUR = 34, - IGRAPH_ARPACK_LAPACK = 35, - IGRAPH_ARPACK_UNKNOWN = 36, - IGRAPH_ENEGLOOP = 37, - IGRAPH_EINTERNAL = 38, - IGRAPH_ARPACK_MAXIT = 39, - IGRAPH_ARPACK_NOSHIFT = 40, - IGRAPH_ARPACK_REORDER = 41, - IGRAPH_EDIVZERO = 42, - IGRAPH_GLP_EBOUND = 43, - IGRAPH_GLP_EROOT = 44, - IGRAPH_GLP_ENOPFS = 45, - IGRAPH_GLP_ENODFS = 46, - IGRAPH_GLP_EFAIL = 47, - IGRAPH_GLP_EMIPGAP = 48, - IGRAPH_GLP_ETMLIM = 49, - IGRAPH_GLP_ESTOP = 50, - IGRAPH_EATTRIBUTES = 51, - IGRAPH_EATTRCOMBINE = 52, - IGRAPH_ELAPACK = 53, - IGRAPH_EDRL = 54, - IGRAPH_EOVERFLOW = 55, - IGRAPH_EGLP = 56, - IGRAPH_CPUTIME = 57, - IGRAPH_EUNDERFLOW = 58, - IGRAPH_ERWSTUCK = 59, - IGRAPH_STOP = 60 /* undocumented, used internally */ -} igraph_error_type_t; -/* Each enum value above must have a corresponding error string in - * igraph_i_error_strings[] in igraph_error.c - * - * Information on undocumented codes: - * - IGRAPH_STOP signals a request to stop in functions like igraph_i_maximal_cliques_bk() - */ - -/* We use IGRAPH_FILE_BASENAME instead of __FILE__ to ensure that full - * paths don't leak into the library code. IGRAPH_FILE_BASENAME is set up - * by the build system when compiling the individual files. However, when - * including igraph_error.h in user code, this macro is not defined so we - * fall back to __FILE__ here - */ -#ifndef IGRAPH_FILE_BASENAME -# define IGRAPH_FILE_BASENAME __FILE__ -#endif - -/** - * \define IGRAPH_ERROR - * \brief Trigger an error. - * - * \a igraph functions usually use this macro when they notice an error. - * It calls - * \ref igraph_error() with the proper parameters and if that returns - * the macro returns the "calling" function as well, with the error - * code. If for some (suspicious) reason you want to call the error - * handler without returning from the current function, call - * \ref igraph_error() directly. - * \param reason Textual description of the error. This should be - * something more descriptive than the text associated with the error - * code. E.g. if the error code is \c IGRAPH_EINVAL, - * its associated text (see \ref igraph_strerror()) is "Invalid - * value" and this string should explain which parameter was invalid - * and maybe why. - * \param igraph_errno The \a igraph error code. - */ - -#define IGRAPH_ERROR(reason, igraph_errno) \ - do { \ - igraph_error (reason, IGRAPH_FILE_BASENAME, __LINE__, igraph_errno) ; \ - return igraph_errno ; \ - } while (0) - -#define IGRAPH_ERROR_NO_RETURN(reason, igraph_errno) \ - do { \ - igraph_error (reason, IGRAPH_FILE_BASENAME, __LINE__, igraph_errno) ; \ - } while (0) - -/** - * \function igraph_error - * \brief Triggers an error. - * - * \a igraph functions usually call this function (most often via the - * \ref IGRAPH_ERROR macro) if they notice an error. - * It calls the currently installed error handler function with the - * supplied arguments. - * - * \param reason Textual description of the error. - * \param file The source file in which the error was noticed. - * \param line The number of line in the source file which triggered the - * error. - * \param igraph_errno The \a igraph error code. - * \return the error code (if it returns) - * - * \sa igraph_errorf(). - */ - -IGRAPH_EXPORT int igraph_error(const char *reason, const char *file, int line, - int igraph_errno); - -/** - * \define IGRAPH_ERRORF - * \brief Triggers an error, with printf-like syntax. - * - * \a igraph functions can use this macro when they notice an error and - * want to pass on extra information to the user about what went wrong. - * It calls \ref igraph_errorf() with the proper parameters and if that - * returns the macro returns the "calling" function as well, with the - * error code. If for some (suspicious) reason you want to call the - * error handler without returning from the current function, call - * \ref igraph_errorf() directly. - * \param reason Textual description of the error, a template string - * with the same syntax as the standard printf C library function. - * This should be something more descriptive than the text associated - * with the error code. E.g. if the error code is \c IGRAPH_EINVAL, - * its associated text (see \ref igraph_strerror()) is "Invalid - * value" and this string should explain which parameter was invalid - * and maybe what was expected and what was recieved. - * \param igraph_errno The \a igraph error code. - * \param ... The additional arguments to be substituted into the - * template string. - */ - -#define IGRAPH_ERRORF(reason, igraph_errno, ...) \ - do { \ - igraph_errorf(reason, IGRAPH_FILE_BASENAME, __LINE__, \ - igraph_errno, __VA_ARGS__) ; \ - return igraph_errno; \ - } while (0) - -/** - * \function igraph_errorf - * \brief Triggers an error, printf-like version. - * - * \param reason Textual description of the error, interpreted as - * a \c printf format string. - * \param file The source file in which the error was noticed. - * \param line The line in the source file which triggered the error. - * \param igraph_errno The \a igraph error code. - * \param ... Additional parameters, the values to substitute into the - * format string. - * - * \sa igraph_error(). - */ - -IGRAPH_EXPORT int igraph_errorf(const char *reason, const char *file, int line, - int igraph_errno, ...); - -IGRAPH_EXPORT int igraph_errorvf(const char *reason, const char *file, int line, - int igraph_errno, va_list ap); - -/** - * \function igraph_strerror - * \brief Textual description of an error. - * - * This is a simple utility function, it gives a short general textual - * description for an \a igraph error code. - * - * \param igraph_errno The \a igraph error code. - * \return pointer to the textual description of the error code. - */ - -IGRAPH_EXPORT const char* igraph_strerror(const int igraph_errno); - -#define IGRAPH_ERROR_SELECT_2(a,b) ((a) != IGRAPH_SUCCESS ? (a) : ((b) != IGRAPH_SUCCESS ? (b) : IGRAPH_SUCCESS)) -#define IGRAPH_ERROR_SELECT_3(a,b,c) ((a) != IGRAPH_SUCCESS ? (a) : IGRAPH_ERROR_SELECT_2(b,c)) -#define IGRAPH_ERROR_SELECT_4(a,b,c,d) ((a) != IGRAPH_SUCCESS ? (a) : IGRAPH_ERROR_SELECT_3(b,c,d)) -#define IGRAPH_ERROR_SELECT_5(a,b,c,d,e) ((a) != IGRAPH_SUCCESS ? (a) : IGRAPH_ERROR_SELECT_4(b,c,d,e)) - -/* Now comes the more convenient error handling macro arsenal. - * Ideas taken from exception.{h,c} by Laurent Deniau see - * http://cern.ch/Laurent.Deniau/html/oopc/oopc.html#Exceptions for more - * information. We don't use the exception handling code though. */ - -struct igraph_i_protectedPtr { - int all; - void *ptr; - void (*func)(void*); -}; - -typedef void igraph_finally_func_t (void*); - -IGRAPH_EXPORT void IGRAPH_FINALLY_REAL(void (*func)(void*), void* ptr); - -/** - * \function IGRAPH_FINALLY_CLEAN - * \brief Signals clean deallocation of objects. - * - * Removes the specified number of objects from the stack of - * temporarily allocated objects. Most often this is called just - * before returning from a function. - * \param num The number of objects to remove from the bookkeeping - * stack. - */ - -IGRAPH_EXPORT void IGRAPH_FINALLY_CLEAN(int num); - -/** - * \function IGRAPH_FINALLY_FREE - * \brief Deallocates all registered objects. - * - * Calls the destroy function for all objects in the stack of - * temporarily allocated objects. This is usually called only from an - * error handler. It is \em not appropriate to use it - * instead of destroying each unneeded object of a function, as it - * destroys the temporary objects of the caller function (and so on) - * as well. - */ - -IGRAPH_EXPORT void IGRAPH_FINALLY_FREE(void); - -/** - * \function IGRAPH_FINALLY_STACK_SIZE - * \brief The number of registered objects. - * - * Returns the number of objects in the stack of temporarily allocated - * objects. This function is handy if you write an own igraph routine and - * you want to make sure it handles errors properly. A properly written - * igraph routine should not leave pointers to temporarily allocated objects - * in the finally stack, because otherwise an \ref IGRAPH_FINALLY_FREE call - * in another igraph function would result in freeing these objects as well - * (and this is really hard to debug, since the error will be not in that - * function that shows erroneous behaviour). Therefore, it is advised to - * write your own test cases and examine \ref IGRAPH_FINALLY_STACK_SIZE - * before and after your test cases - the numbers should be equal. - */ -IGRAPH_EXPORT int IGRAPH_FINALLY_STACK_SIZE(void); - -/** - * \define IGRAPH_FINALLY_STACK_EMPTY - * \brief Returns true if there are no registered objects, false otherwise. - * - * This is just a shorthand notation for checking that - * \ref IGRAPH_FINALLY_STACK_SIZE() is zero. - */ -#define IGRAPH_FINALLY_STACK_EMPTY (IGRAPH_FINALLY_STACK_SIZE() == 0) - -/** - * \define IGRAPH_FINALLY - * \brief Registers an object for deallocation. - * \param func The address of the function which is normally called to - * destroy the object. - * \param ptr Pointer to the object itself. - * - * This macro places the address of an object, together with the - * address of its destructor in a stack. This stack is used if an - * error happens to deallocate temporarily allocated objects to - * prevent memory leaks. - */ - -#define IGRAPH_FINALLY(func, ptr) \ - do { \ - /* the following branch makes the compiler check the compatibility of \ - * func and ptr to detect cases when we are accidentally invoking an \ - * incorrect destructor function with the pointer */ \ - if (0) { func(ptr); } \ - IGRAPH_FINALLY_REAL((igraph_finally_func_t*)(func), (ptr)); \ - } while (0) - -#if !defined(GCC_VERSION_MAJOR) && defined(__GNUC__) - #define GCC_VERSION_MAJOR __GNUC__ -#endif - -#if defined(GCC_VERSION_MAJOR) && (GCC_VERSION_MAJOR >= 3) - #define IGRAPH_UNLIKELY(a) __builtin_expect((a), 0) - #define IGRAPH_LIKELY(a) __builtin_expect((a), 1) -#else - #define IGRAPH_UNLIKELY(a) a - #define IGRAPH_LIKELY(a) a -#endif - -#if IGRAPH_VERIFY_FINALLY_STACK == 1 -#define IGRAPH_CHECK(a) \ - do { \ - int enter_stack_size = IGRAPH_FINALLY_STACK_SIZE(); \ - int igraph_i_ret=(a); \ - if (IGRAPH_UNLIKELY(igraph_i_ret != 0)) {\ - IGRAPH_ERROR("", igraph_i_ret); \ - } \ - if (IGRAPH_UNLIKELY(enter_stack_size != IGRAPH_FINALLY_STACK_SIZE())) { \ - IGRAPH_ERROR("Non-matching number of IGRAPH_FINALLY and IGRAPH_FINALLY_CLEAN", IGRAPH_FAILURE); \ - } \ - } while (0) -#else -/** - * \define IGRAPH_CHECK - * \brief Checks the return value of a function call. - * - * \param a An expression, usually a function call. - * - * Executes the expression and checks its value. If this is not - * \c IGRAPH_SUCCESS, it calls \ref IGRAPH_ERROR with - * the value as the error code. Here is an example usage: - * \verbatim IGRAPH_CHECK(vector_push_back(&v, 100)); \endverbatim - * - * There is only one reason to use this macro when writing - * \a igraph functions. If the user installs an error handler which - * returns to the auxiliary calling code (like \ref - * igraph_error_handler_ignore and \ref - * igraph_error_handler_printignore), and the \a igraph function - * signalling the error is called from another \a igraph function - * then we need to make sure that the error is propagated back to - * the auxiliary (i.e. non-igraph) calling function. This is achieved - * by using IGRAPH_CHECK on every \a igraph - * call which can return an error code. - */ -#define IGRAPH_CHECK(a) do { \ - int igraph_i_ret=(a); \ - if (IGRAPH_UNLIKELY(igraph_i_ret != 0)) {\ - IGRAPH_ERROR("", igraph_i_ret); \ - } } while (0) -#endif - - - -/** - * \section about_igraph_warnings Warning messages - * - * - * \a igraph also supports warning messages in addition to error - * messages. Warning messages typically do not terminate the - * program, but they are usually crucial to the user. - * - * - * - * \a igraph warnings are handled similarly to errors. There is a - * separate warning handler function that is called whenever - * an \a igraph function triggers a warning. This handler can be - * set by the \ref igraph_set_warning_handler() function. There are - * two predefined simple warning handlers, - * \ref igraph_warning_handler_ignore() and - * \ref igraph_warning_handler_print(), the latter being the default. - * - * - * - * To trigger a warning, \a igraph functions typically use the - * \ref IGRAPH_WARNING() macro, the \ref igraph_warning() function, - * or if more flexibility is needed, \ref igraph_warningf(). - * - */ - -/** - * \typedef igraph_warning_handler_t - * \brief The type of igraph warning handler functions. - * - * Currently it is defined to have the same type as - * \ref igraph_error_handler_t, although the last (error code) - * argument is not used. - */ - -typedef igraph_error_handler_t igraph_warning_handler_t; - -/** - * \function igraph_set_warning_handler - * \brief Installs a warning handler. - * - * Install the supplied warning handler function. - * \param new_handler The new warning handler function to install. - * Supply a null pointer here to uninstall the current - * warning handler, without installing a new one. - * \return The current warning handler function. - */ - -IGRAPH_EXPORT igraph_warning_handler_t* igraph_set_warning_handler(igraph_warning_handler_t* new_handler); - -IGRAPH_EXPORT extern igraph_warning_handler_t igraph_warning_handler_ignore; -IGRAPH_EXPORT extern igraph_warning_handler_t igraph_warning_handler_print; - -/** - * \function igraph_warning - * \brief Triggers a warning. - * - * Call this function if you want to trigger a warning from within - * a function that uses \a igraph. - * \param reason Textual description of the warning. - * \param file The source file in which the warning was noticed. - * \param line The number of line in the source file which triggered the - * warning. - * \param igraph_errno Warnings could have potentially error codes as well, - * but this is currently not used in igraph. - * \return The supplied error code. - */ - -IGRAPH_EXPORT int igraph_warning(const char *reason, const char *file, int line, - int igraph_errno); - -/** - * \define IGRAPH_WARNINGF - * \brief Triggers a warning, with printf-like syntax. - * - * \a igraph functions can use this macro when they notice a warning and - * want to pass on extra information to the user about what went wrong. - * It calls \ref igraph_warningf() with the proper parameters and no - * error code. - * \param reason Textual description of the warning, a template string - * with the same syntax as the standard printf C library function. - * \param ... The additional arguments to be substituted into the - * template string. - */ - -#define IGRAPH_WARNINGF(reason, ...) \ - do { \ - igraph_warningf(reason, IGRAPH_FILE_BASENAME, __LINE__, \ - -1, __VA_ARGS__); \ - } while (0) - - - -/** - * \function igraph_warningf - * \brief Triggers a warning, printf-like version. - * - * This function is similar to \ref igraph_warning(), but - * uses a printf-like syntax. It substitutes the additional arguments - * into the \p reason template string and calls \ref igraph_warning(). - * \param reason Textual description of the warning, a template string - * with the same syntax as the standard printf C library function. - * \param file The source file in which the warning was noticed. - * \param line The number of line in the source file which triggered the - * warning. - * \param igraph_errno Warnings could have potentially error codes as well, - * but this is currently not used in igraph. - * \param ... The additional arguments to be substituted into the - * template string. - * \return The supplied error code. - */ - -IGRAPH_EXPORT int igraph_warningf(const char *reason, const char *file, int line, - int igraph_errno, ...); - -/** - * \define IGRAPH_WARNING - * \brief Triggers a warning. - * - * This is the usual way of triggering a warning from an igraph - * function. It calls \ref igraph_warning(). - * \param reason The warning message. - */ - -#define IGRAPH_WARNING(reason) \ - do { \ - igraph_warning(reason, IGRAPH_FILE_BASENAME, __LINE__, -1); \ - } while (0) - - -/** - * \section fatal_error_handlers Fatal errors - * - * - * In some rare situations, \a igraph may encounter an internal error - * that cannot be fully handled. In this case, it will call the - * current fatal error handler. The default fatal error handler - * simply prints the error and aborts the program. - * - * - * - * Fatal error handlers do not return. Typically, they might abort the - * the program immediately, or in the case of the high-level \a igraph - * interfaces, they might return to the top level using a - * longjmp(). The fatal error handler is only called when - * a serious error has occurred, and as a result igraph may be in an - * inconsistent state. The purpose of returning to the top level is to - * give the user a chance to save their work instead of aborting immediately. - * However, the program session should be restarted as soon as possible. - * - * - * - * Most projects that use \a igraph will use the default fatal error - * handler. - * - */ - -/** - * \typedef igraph_fatal_handler_t - * \brief The type of igraph fatal error handler functions. - * - * Functions of this type \em must not return. Typically they - * call abort() or do a longjmp(). - * - * \param reason Textual description of the error. - * \param file The source file in which the error is noticed. - * \param line The number of the line in the source file which triggered the error - */ - -typedef void igraph_fatal_handler_t (const char *reason, const char *file, int line); - -/** - * \function igraph_set_fatal_handler - * \brief Installs a fatal error handler. - * - * Installs the supplied fatal error handler function. - * - * - * Fatal error handler functions \em must not return. Typically, the fatal - * error handler would either call abort() or longjmp(). - * - * \param new_handler The new fatal error handler function to install. - * Supply a null pointer here to uninstall the current - * fatal error handler, without installing a new one. - * \return The current fatal error handler function. - */ - -IGRAPH_EXPORT igraph_fatal_handler_t* igraph_set_fatal_handler(igraph_fatal_handler_t* new_handler); - -/** - * \var igraph_fatal_handler_abort - * \brief Abort program in case of fatal error. - * - * The default fatal error handler, prints an error message and aborts the program. - */ - -IGRAPH_EXPORT igraph_fatal_handler_t igraph_fatal_handler_abort; - -/** - * \function igraph_fatal - * \brief Triggers a fatal error. - * - * This function triggers a fatal error. Typically it is called indirectly through - * \ref IGRAPH_FATAL() or \ref IGRAPH_ASSERT(). - * - * \param reason Textual description of the error. - * \param file The source file in which the error was noticed. - * \param line The number of line in the source file which triggered the error. - */ - -IGRAPH_EXPORT IGRAPH_NORETURN void igraph_fatal(const char *reason, const char *file, int line); - -/** - * \function igraph_fatalf - * \brief Triggers a fatal error, printf-like syntax. - * - * This function is similar to \ref igraph_fatal(), but - * uses a printf-like syntax. It substitutes the additional arguments - * into the \p reason template string and calls \ref igraph_fatal(). - * - * \param reason Textual description of the error. - * \param file The source file in which the error was noticed. - * \param line The number of line in the source file which triggered the error. - * \param ... The additional arguments to be substituted into the template string. - */ - -IGRAPH_EXPORT IGRAPH_NORETURN void igraph_fatalf(const char *reason, const char *file, int line, ...); - -/** - * \define IGRAPH_FATALF - * \brief Triggers a fatal error, with printf-like syntax. - * - * \a igraph functions can use this macro when a fatal error occurs and - * want to pass on extra information to the user about what went wrong. - * It calls \ref igraph_fatalf() with the proper parameters. - * \param reason Textual description of the error, a template string - * with the same syntax as the standard printf C library function. - * \param ... The additional arguments to be substituted into the - * template string. - */ - -#define IGRAPH_FATALF(reason, ...) \ - do { \ - igraph_fatalf(reason, IGRAPH_FILE_BASENAME, __LINE__, \ - __VA_ARGS__); \ - } while (0) - -/** - * \define IGRAPH_FATAL - * \brief Triggers a fatal error. - * - * This is the usual way of triggering a fatal error from an igraph - * function. It calls \ref igraph_fatal(). - * - * - * Use this macro only in situations where the error cannot be handled. - * The normal way to handle errors is \ref IGRAPH_ERROR(). - * - * \param reason The error message. - */ - -#define IGRAPH_FATAL(reason) \ - do { \ - igraph_fatal(reason, IGRAPH_FILE_BASENAME, __LINE__); \ - } while (0) - -/** - * \define IGRAPH_ASSERT - * \brief igraph-specific replacement for assert(). - * - * This macro is like the standard assert(), but instead of - * calling abort(), it calls \ref igraph_fatal(). This allows for returning - * the control to the calling program, e.g. returning to the top level in a high-level - * \a igraph interface. - * - * - * Unlike assert(), IGRAPH_ASSERT() is not disabled - * when the \c NDEBUG macro is defined. - * - * - * This macro is meant for internal use by \a igraph. - * - * - * Since a typial fatal error handler does a longjmp(), avoid using this - * macro in C++ code. With most compilers, destructor will not be called when - * longjmp() leaves the current scope. - * - * \param condition The condition to be checked. - */ - -#define IGRAPH_ASSERT(condition) \ - do { \ - if (!(condition)) { \ - igraph_fatal("Assertion failed: " #condition, IGRAPH_FILE_BASENAME, __LINE__); \ - } \ - } while (0) - -__END_DECLS - -#endif diff --git a/src/include/igraph_eulerian.h b/src/include/igraph_eulerian.h deleted file mode 100644 index 79f669fd81..0000000000 --- a/src/include/igraph_eulerian.h +++ /dev/null @@ -1,38 +0,0 @@ -/* -*- mode: C -*- */ -/* - IGraph library. - Copyright (C) 2009-2012 Gabor Csardi - 334 Harvard street, Cambridge, MA 02139 USA - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA - -*/ - -#ifndef IGRAPH_EULERIAN_H -#define IGRAPH_EULERIAN_H - -#include "igraph_decls.h" -#include "igraph_datatype.h" - -__BEGIN_DECLS - -IGRAPH_EXPORT int igraph_is_eulerian(const igraph_t *graph, igraph_bool_t *has_path, igraph_bool_t *has_cycle); -IGRAPH_EXPORT int igraph_eulerian_path(const igraph_t *graph, igraph_vector_t *edge_res, igraph_vector_t *vertex_res); -IGRAPH_EXPORT int igraph_eulerian_cycle(const igraph_t *graph, igraph_vector_t *edge_res, igraph_vector_t *vertex_res); - -__END_DECLS - -#endif diff --git a/src/include/igraph_export.h b/src/include/igraph_export.h deleted file mode 100644 index 508cb6eeed..0000000000 --- a/src/include/igraph_export.h +++ /dev/null @@ -1,11 +0,0 @@ - -#ifndef IGRAPH_EXPORT_H -#define IGRAPH_EXPORT_H - -#define IGRAPH_EXPORT -#define IGRAPH_NO_EXPORT -#define IGRAPH_DEPRECATED __attribute__ ((__deprecated__)) -#define IGRAPH_DEPRECATED_EXPORT IGRAPH_EXPORT IGRAPH_DEPRECATED -#define IGRAPH_DEPRECATED_NO_EXPORT IGRAPH_NO_EXPORT IGRAPH_DEPRECATED - -#endif /* IGRAPH_EXPORT_H */ diff --git a/src/include/igraph_flow.h b/src/include/igraph_flow.h deleted file mode 100644 index 37ee4179b6..0000000000 --- a/src/include/igraph_flow.h +++ /dev/null @@ -1,158 +0,0 @@ -/* -*- mode: C -*- */ -/* - IGraph library. - Copyright (C) 2003-2012 Gabor Csardi - 334 Harvard street, Cambridge, MA 02139 USA - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA - -*/ - -#ifndef IGRAPH_FLOW_H -#define IGRAPH_FLOW_H - -#include "igraph_decls.h" -#include "igraph_constants.h" -#include "igraph_types.h" -#include "igraph_datatype.h" -#include "igraph_vector_ptr.h" - -__BEGIN_DECLS - -/* -------------------------------------------------- */ -/* Maximum flows, minimum cuts & such */ -/* -------------------------------------------------- */ - -/** - * \typedef igraph_maxflow_stats_t - * A simple data type to return some statistics from the - * push-relabel maximum flow solver. - * - * \param nopush The number of push operations performed. - * \param norelabel The number of relabel operarions performed. - * \param nogap The number of times the gap heuristics was used. - * \param nogapnodes The total number of vertices that were - * omitted form further calculations because of the gap - * heuristics. - * \param nobfs The number of times the reverse BFS was run to - * assign good values to the height function. This includes - * an initial run before the whole algorithm, so it is always - * at least one. - */ - -typedef struct { - int nopush, norelabel, nogap, nogapnodes, nobfs; -} igraph_maxflow_stats_t; - -IGRAPH_EXPORT int igraph_maxflow(const igraph_t *graph, igraph_real_t *value, - igraph_vector_t *flow, igraph_vector_t *cut, - igraph_vector_t *partition, igraph_vector_t *partition2, - igraph_integer_t source, igraph_integer_t target, - const igraph_vector_t *capacity, - igraph_maxflow_stats_t *stats); -IGRAPH_EXPORT int igraph_maxflow_value(const igraph_t *graph, igraph_real_t *value, - igraph_integer_t source, igraph_integer_t target, - const igraph_vector_t *capacity, - igraph_maxflow_stats_t *stats); - -IGRAPH_EXPORT int igraph_st_mincut(const igraph_t *graph, igraph_real_t *value, - igraph_vector_t *cut, igraph_vector_t *partition, - igraph_vector_t *partition2, - igraph_integer_t source, igraph_integer_t target, - const igraph_vector_t *capacity); -IGRAPH_EXPORT int igraph_st_mincut_value(const igraph_t *graph, igraph_real_t *res, - igraph_integer_t source, igraph_integer_t target, - const igraph_vector_t *capacity); - -IGRAPH_EXPORT int igraph_mincut_value(const igraph_t *graph, igraph_real_t *res, - const igraph_vector_t *capacity); -IGRAPH_EXPORT int igraph_mincut(const igraph_t *graph, - igraph_real_t *value, - igraph_vector_t *partition, - igraph_vector_t *partition2, - igraph_vector_t *cut, - const igraph_vector_t *capacity); - -IGRAPH_EXPORT int igraph_st_vertex_connectivity(const igraph_t *graph, - igraph_integer_t *res, - igraph_integer_t source, - igraph_integer_t target, - igraph_vconn_nei_t neighbors); -IGRAPH_EXPORT int igraph_vertex_connectivity(const igraph_t *graph, igraph_integer_t *res, - igraph_bool_t checks); - -IGRAPH_EXPORT int igraph_st_edge_connectivity(const igraph_t *graph, igraph_integer_t *res, - igraph_integer_t source, - igraph_integer_t target); -IGRAPH_EXPORT int igraph_edge_connectivity(const igraph_t *graph, igraph_integer_t *res, - igraph_bool_t checks); - -IGRAPH_EXPORT int igraph_edge_disjoint_paths(const igraph_t *graph, igraph_integer_t *res, - igraph_integer_t source, - igraph_integer_t target); -IGRAPH_EXPORT int igraph_vertex_disjoint_paths(const igraph_t *graph, igraph_integer_t *res, - igraph_integer_t source, - igraph_integer_t target); - -IGRAPH_EXPORT int igraph_adhesion(const igraph_t *graph, igraph_integer_t *res, - igraph_bool_t checks); -IGRAPH_EXPORT int igraph_cohesion(const igraph_t *graph, igraph_integer_t *res, - igraph_bool_t checks); - -/* s-t cut listing related stuff */ - -IGRAPH_EXPORT int igraph_even_tarjan_reduction(const igraph_t *graph, igraph_t *graphbar, - igraph_vector_t *capacity); - -IGRAPH_EXPORT int igraph_residual_graph(const igraph_t *graph, - const igraph_vector_t *capacity, - igraph_t *residual, - igraph_vector_t *residual_capacity, - const igraph_vector_t *flow); - -IGRAPH_EXPORT int igraph_reverse_residual_graph(const igraph_t *graph, - const igraph_vector_t *capacity, - igraph_t *residual, - const igraph_vector_t *flow); - -IGRAPH_EXPORT int igraph_dominator_tree(const igraph_t *graph, - igraph_integer_t root, - igraph_vector_t *dom, - igraph_t *domtree, - igraph_vector_t *leftout, - igraph_neimode_t mode); - -IGRAPH_EXPORT int igraph_all_st_cuts(const igraph_t *graph, - igraph_vector_ptr_t *cuts, - igraph_vector_ptr_t *partition1s, - igraph_integer_t source, - igraph_integer_t target); - -IGRAPH_EXPORT int igraph_all_st_mincuts(const igraph_t *graph, igraph_real_t *value, - igraph_vector_ptr_t *cuts, - igraph_vector_ptr_t *partition1s, - igraph_integer_t source, - igraph_integer_t target, - const igraph_vector_t *capacity); - -IGRAPH_EXPORT int igraph_gomory_hu_tree(const igraph_t *graph, - igraph_t *tree, - igraph_vector_t *flows, - const igraph_vector_t *capacity); - -__END_DECLS - -#endif diff --git a/src/include/igraph_foreign.h b/src/include/igraph_foreign.h deleted file mode 100644 index e4a9442227..0000000000 --- a/src/include/igraph_foreign.h +++ /dev/null @@ -1,85 +0,0 @@ -/* -*- mode: C -*- */ -/* - IGraph library. - Copyright (C) 2009-2012 Gabor Csardi - 334 Harvard street, Cambridge, MA 02139 USA - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA - -*/ - -#ifndef IGRAPH_FOREIGN_H -#define IGRAPH_FOREIGN_H - -#include "igraph_decls.h" -#include "igraph_constants.h" -#include "igraph_datatype.h" -#include "igraph_types.h" -#include "igraph_strvector.h" - -#include - -__BEGIN_DECLS - -/* -------------------------------------------------- */ -/* Read and write foreign formats */ -/* -------------------------------------------------- */ - -IGRAPH_EXPORT int igraph_read_graph_edgelist(igraph_t *graph, FILE *instream, - igraph_integer_t n, igraph_bool_t directed); -IGRAPH_EXPORT int igraph_read_graph_ncol(igraph_t *graph, FILE *instream, - const igraph_strvector_t *predefnames, igraph_bool_t names, - igraph_add_weights_t weights, igraph_bool_t directed); -IGRAPH_EXPORT int igraph_read_graph_lgl(igraph_t *graph, FILE *instream, - igraph_bool_t names, igraph_add_weights_t weights, - igraph_bool_t directed); -IGRAPH_EXPORT int igraph_read_graph_pajek(igraph_t *graph, FILE *instream); -IGRAPH_EXPORT int igraph_read_graph_graphml(igraph_t *graph, FILE *instream, - int index); -IGRAPH_EXPORT int igraph_read_graph_dimacs(igraph_t *graph, FILE *instream, - igraph_strvector_t *problem, - igraph_vector_t *label, - igraph_integer_t *source, - igraph_integer_t *target, - igraph_vector_t *capacity, - igraph_bool_t directed); -IGRAPH_EXPORT int igraph_read_graph_graphdb(igraph_t *graph, FILE *instream, - igraph_bool_t directed); -IGRAPH_EXPORT int igraph_read_graph_gml(igraph_t *graph, FILE *instream); -IGRAPH_EXPORT int igraph_read_graph_dl(igraph_t *graph, FILE *instream, - igraph_bool_t directed); - -IGRAPH_EXPORT int igraph_write_graph_edgelist(const igraph_t *graph, FILE *outstream); -IGRAPH_EXPORT int igraph_write_graph_ncol(const igraph_t *graph, FILE *outstream, - const char *names, const char *weights); -IGRAPH_EXPORT int igraph_write_graph_lgl(const igraph_t *graph, FILE *outstream, - const char *names, const char *weights, - igraph_bool_t isolates); -IGRAPH_EXPORT int igraph_write_graph_graphml(const igraph_t *graph, FILE *outstream, - igraph_bool_t prefixattr); -IGRAPH_EXPORT int igraph_write_graph_pajek(const igraph_t *graph, FILE *outstream); -IGRAPH_EXPORT int igraph_write_graph_dimacs(const igraph_t *graph, FILE *outstream, - long int source, long int target, - const igraph_vector_t *capacity); -IGRAPH_EXPORT int igraph_write_graph_gml(const igraph_t *graph, FILE *outstream, - const igraph_vector_t *id, const char *creator); -IGRAPH_EXPORT int igraph_write_graph_dot(const igraph_t *graph, FILE *outstream); -IGRAPH_EXPORT int igraph_write_graph_leda(const igraph_t *graph, FILE *outstream, - const char* vertex_attr_name, const char* edge_attr_name); - -__END_DECLS - -#endif diff --git a/src/include/igraph_games.h b/src/include/igraph_games.h deleted file mode 100644 index df5f6a91ed..0000000000 --- a/src/include/igraph_games.h +++ /dev/null @@ -1,223 +0,0 @@ -/* -*- mode: C -*- */ -/* - IGraph library. - Copyright (C) 2009-2012 Gabor Csardi - 334 Harvard street, Cambridge, MA 02139 USA - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA - -*/ - -#ifndef IGRAPH_GAMES_H -#define IGRAPH_GAMES_H - -#include "igraph_decls.h" -#include "igraph_constants.h" -#include "igraph_types.h" -#include "igraph_matrix.h" -#include "igraph_vector.h" -#include "igraph_datatype.h" -#include "igraph_vector_ptr.h" - -__BEGIN_DECLS - -/* -------------------------------------------------- */ -/* Constructors, games (=stochastic) */ -/* -------------------------------------------------- */ - -IGRAPH_EXPORT int igraph_barabasi_game(igraph_t *graph, igraph_integer_t n, - igraph_real_t power, - igraph_integer_t m, - const igraph_vector_t *outseq, - igraph_bool_t outpref, - igraph_real_t A, - igraph_bool_t directed, - igraph_barabasi_algorithm_t algo, - const igraph_t *start_from); -IGRAPH_EXPORT int igraph_erdos_renyi_game(igraph_t *graph, igraph_erdos_renyi_t type, - igraph_integer_t n, igraph_real_t p_or_m, - igraph_bool_t directed, igraph_bool_t loops); -IGRAPH_EXPORT int igraph_erdos_renyi_game_gnp(igraph_t *graph, igraph_integer_t n, igraph_real_t p, - igraph_bool_t directed, igraph_bool_t loops); -IGRAPH_EXPORT int igraph_erdos_renyi_game_gnm(igraph_t *graph, igraph_integer_t n, igraph_real_t m, - igraph_bool_t directed, igraph_bool_t loops); -IGRAPH_EXPORT int igraph_degree_sequence_game(igraph_t *graph, const igraph_vector_t *out_deg, - const igraph_vector_t *in_deg, - igraph_degseq_t method); -IGRAPH_EXPORT int igraph_growing_random_game(igraph_t *graph, igraph_integer_t n, - igraph_integer_t m, igraph_bool_t directed, igraph_bool_t citation); -IGRAPH_EXPORT int igraph_barabasi_aging_game(igraph_t *graph, - igraph_integer_t nodes, - igraph_integer_t m, - const igraph_vector_t *outseq, - igraph_bool_t outpref, - igraph_real_t pa_exp, - igraph_real_t aging_exp, - igraph_integer_t aging_bin, - igraph_real_t zero_deg_appeal, - igraph_real_t zero_age_appeal, - igraph_real_t deg_coef, - igraph_real_t age_coef, - igraph_bool_t directed); -IGRAPH_EXPORT int igraph_recent_degree_game(igraph_t *graph, igraph_integer_t n, - igraph_real_t power, - igraph_integer_t window, - igraph_integer_t m, - const igraph_vector_t *outseq, - igraph_bool_t outpref, - igraph_real_t zero_appeal, - igraph_bool_t directed); -IGRAPH_EXPORT int igraph_recent_degree_aging_game(igraph_t *graph, - igraph_integer_t nodes, - igraph_integer_t m, - const igraph_vector_t *outseq, - igraph_bool_t outpref, - igraph_real_t pa_exp, - igraph_real_t aging_exp, - igraph_integer_t aging_bin, - igraph_integer_t window, - igraph_real_t zero_appeal, - igraph_bool_t directed); -IGRAPH_EXPORT int igraph_callaway_traits_game(igraph_t *graph, igraph_integer_t nodes, - igraph_integer_t types, igraph_integer_t edges_per_step, - const igraph_vector_t *type_dist, - const igraph_matrix_t *pref_matrix, - igraph_bool_t directed, - igraph_vector_t *node_type_vec); -IGRAPH_EXPORT int igraph_establishment_game(igraph_t *graph, igraph_integer_t nodes, - igraph_integer_t types, igraph_integer_t k, - const igraph_vector_t *type_dist, - const igraph_matrix_t *pref_matrix, - igraph_bool_t directed, - igraph_vector_t *node_type_vec); -IGRAPH_EXPORT int igraph_grg_game(igraph_t *graph, igraph_integer_t nodes, - igraph_real_t radius, igraph_bool_t torus, - igraph_vector_t *x, igraph_vector_t *y); -IGRAPH_EXPORT int igraph_preference_game(igraph_t *graph, igraph_integer_t nodes, - igraph_integer_t types, - const igraph_vector_t *type_dist, - igraph_bool_t fixed_sizes, - const igraph_matrix_t *pref_matrix, - igraph_vector_t *node_type_vec, - igraph_bool_t directed, igraph_bool_t loops); -IGRAPH_EXPORT int igraph_asymmetric_preference_game(igraph_t *graph, igraph_integer_t nodes, - igraph_integer_t out_types, - igraph_integer_t in_types, - const igraph_matrix_t *type_dist_matrix, - const igraph_matrix_t *pref_matrix, - igraph_vector_t *node_type_out_vec, - igraph_vector_t *node_type_in_vec, - igraph_bool_t loops); - -IGRAPH_EXPORT int igraph_rewire_edges(igraph_t *graph, igraph_real_t prob, - igraph_bool_t loops, igraph_bool_t multiple); -IGRAPH_EXPORT int igraph_rewire_directed_edges(igraph_t *graph, igraph_real_t prob, - igraph_bool_t loops, igraph_neimode_t mode); - -IGRAPH_EXPORT int igraph_watts_strogatz_game(igraph_t *graph, igraph_integer_t dim, - igraph_integer_t size, igraph_integer_t nei, - igraph_real_t p, igraph_bool_t loops, - igraph_bool_t multiple); - -IGRAPH_EXPORT int igraph_lastcit_game(igraph_t *graph, - igraph_integer_t nodes, igraph_integer_t edges_per_node, - igraph_integer_t agebins, - const igraph_vector_t *preference, igraph_bool_t directed); - -IGRAPH_EXPORT int igraph_cited_type_game(igraph_t *graph, igraph_integer_t nodes, - const igraph_vector_t *types, - const igraph_vector_t *pref, - igraph_integer_t edges_per_step, - igraph_bool_t directed); - -IGRAPH_EXPORT int igraph_citing_cited_type_game(igraph_t *graph, igraph_integer_t nodes, - const igraph_vector_t *types, - const igraph_matrix_t *pref, - igraph_integer_t edges_per_step, - igraph_bool_t directed); - -IGRAPH_EXPORT int igraph_forest_fire_game(igraph_t *graph, igraph_integer_t nodes, - igraph_real_t fw_prob, igraph_real_t bw_factor, - igraph_integer_t ambs, igraph_bool_t directed); - - -IGRAPH_EXPORT int igraph_simple_interconnected_islands_game( - igraph_t *graph, - igraph_integer_t islands_n, - igraph_integer_t islands_size, - igraph_real_t islands_pin, - igraph_integer_t n_inter); - -IGRAPH_EXPORT int igraph_static_fitness_game(igraph_t *graph, igraph_integer_t no_of_edges, - const igraph_vector_t *fitness_out, const igraph_vector_t *fitness_in, - igraph_bool_t loops, igraph_bool_t multiple); - -IGRAPH_EXPORT int igraph_static_power_law_game(igraph_t *graph, - igraph_integer_t no_of_nodes, igraph_integer_t no_of_edges, - igraph_real_t exponent_out, igraph_real_t exponent_in, - igraph_bool_t loops, igraph_bool_t multiple, - igraph_bool_t finite_size_correction); - -IGRAPH_EXPORT int igraph_k_regular_game(igraph_t *graph, - igraph_integer_t no_of_nodes, igraph_integer_t k, - igraph_bool_t directed, igraph_bool_t multiple); - -IGRAPH_EXPORT int igraph_sbm_game(igraph_t *graph, igraph_integer_t n, - const igraph_matrix_t *pref_matrix, - const igraph_vector_int_t *block_sizes, - igraph_bool_t directed, igraph_bool_t loops); - -IGRAPH_EXPORT int igraph_hsbm_game(igraph_t *graph, igraph_integer_t n, - igraph_integer_t m, const igraph_vector_t *rho, - const igraph_matrix_t *C, igraph_real_t p); - -IGRAPH_EXPORT int igraph_hsbm_list_game(igraph_t *graph, igraph_integer_t n, - const igraph_vector_int_t *mlist, - const igraph_vector_ptr_t *rholist, - const igraph_vector_ptr_t *Clist, - igraph_real_t p); - -IGRAPH_EXPORT int igraph_correlated_game(const igraph_t *old_graph, igraph_t *new_graph, - igraph_real_t corr, igraph_real_t p, - const igraph_vector_t *permutation); - -IGRAPH_EXPORT int igraph_correlated_pair_game(igraph_t *graph1, igraph_t *graph2, - igraph_integer_t n, igraph_real_t corr, igraph_real_t p, - igraph_bool_t directed, - const igraph_vector_t *permutation); - -IGRAPH_EXPORT int igraph_tree_game(igraph_t *graph, igraph_integer_t n, igraph_bool_t directed, - igraph_random_tree_t method); - -IGRAPH_EXPORT int igraph_dot_product_game(igraph_t *graph, const igraph_matrix_t *vecs, - igraph_bool_t directed); - -IGRAPH_EXPORT int igraph_sample_sphere_surface(igraph_integer_t dim, igraph_integer_t n, - igraph_real_t radius, - igraph_bool_t positive, - igraph_matrix_t *res); - -IGRAPH_EXPORT int igraph_sample_sphere_volume(igraph_integer_t dim, igraph_integer_t n, - igraph_real_t radius, - igraph_bool_t positive, - igraph_matrix_t *res); - -IGRAPH_EXPORT int igraph_sample_dirichlet(igraph_integer_t n, const igraph_vector_t *alpha, - igraph_matrix_t *res); - -__END_DECLS - -#endif diff --git a/src/include/igraph_graphicality.h b/src/include/igraph_graphicality.h deleted file mode 100644 index 02feabfbea..0000000000 --- a/src/include/igraph_graphicality.h +++ /dev/null @@ -1,65 +0,0 @@ -/* -*- mode: C -*- */ -/* vim:set ts=4 sw=4 sts=4 et: */ -/* - IGraph library. - Copyright (C) 2009-2020 Gabor Csardi - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -#ifndef IGRAPH_GRAPHICALITY_H -#define IGRAPH_GRAPHICALITY_H - -#include "igraph_decls.h" -#include "igraph_datatype.h" - -__BEGIN_DECLS - -typedef unsigned char igraph_edge_type_sw_t; - -/* - * bit 0: self-loops alowed? - * bit 1: more than one edge allowed between distinct vertices? - * bit 2: more than one self-loop allowed (assuming bit 0 is set)? - */ -enum { - IGRAPH_SIMPLE_SW = 0x00, /* 000 */ - IGRAPH_LOOPS_SW = 0x01, /* 001 */ - IGRAPH_MULTI_SW = 0x06 /* 110 */ -}; - -IGRAPH_EXPORT int igraph_is_graphical(const igraph_vector_t *out_degrees, - const igraph_vector_t *in_degrees, - const igraph_edge_type_sw_t allowed_edge_types, - igraph_bool_t *res); - -IGRAPH_EXPORT int igraph_is_bigraphical(const igraph_vector_t *degrees1, - const igraph_vector_t *degrees2, - const igraph_edge_type_sw_t allowed_edge_types, - igraph_bool_t *res); - - -/* Legacy functions (deprecated): */ - -IGRAPH_EXPORT IGRAPH_DEPRECATED int igraph_is_degree_sequence(const igraph_vector_t *out_degrees, - const igraph_vector_t *in_degrees, - igraph_bool_t *res); - -IGRAPH_EXPORT IGRAPH_DEPRECATED int igraph_is_graphical_degree_sequence(const igraph_vector_t *out_degrees, - const igraph_vector_t *in_degrees, - igraph_bool_t *res); - -__END_DECLS - -#endif // IGRAPH_GRAPHICALITY_H diff --git a/src/include/igraph_graphlets.h b/src/include/igraph_graphlets.h deleted file mode 100644 index 6b5285362c..0000000000 --- a/src/include/igraph_graphlets.h +++ /dev/null @@ -1,52 +0,0 @@ -/* -*- mode: C -*- */ -/* - IGraph library. - Copyright (C) 2013 Gabor Csardi - 334 Harvard street, Cambridge, MA 02139 USA - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA - -*/ - -#ifndef IGRAPH_GRAPHLETS_H -#define IGRAPH_GRAPHLETS_H - -#include "igraph_decls.h" -#include "igraph_datatype.h" -#include "igraph_vector_ptr.h" -#include "igraph_interface.h" - -__BEGIN_DECLS - -IGRAPH_EXPORT int igraph_graphlets_candidate_basis(const igraph_t *graph, - const igraph_vector_t *weights, - igraph_vector_ptr_t *cliques, - igraph_vector_t *thresholds); - -IGRAPH_EXPORT int igraph_graphlets_project(const igraph_t *graph, - const igraph_vector_t *weights, - const igraph_vector_ptr_t *cliques, - igraph_vector_t *Mu, igraph_bool_t startMu, - int niter); - -IGRAPH_EXPORT int igraph_graphlets(const igraph_t *graph, - const igraph_vector_t *weights, - igraph_vector_ptr_t *cliques, - igraph_vector_t *Mu, int niter); - -__END_DECLS - -#endif diff --git a/src/include/igraph_heap.h b/src/include/igraph_heap.h deleted file mode 100644 index 37292260a3..0000000000 --- a/src/include/igraph_heap.h +++ /dev/null @@ -1,83 +0,0 @@ -/* -*- mode: C -*- */ -/* - IGraph library. - Copyright (C) 2009-2012 Gabor Csardi - 334 Harvard street, Cambridge, MA 02139 USA - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA - -*/ - -#ifndef IGRAPH_HEAP_H -#define IGRAPH_HEAP_H - -#include "igraph_decls.h" - -__BEGIN_DECLS - -/* -------------------------------------------------- */ -/* Heap */ -/* -------------------------------------------------- */ - -/** - * Heap data type. - * \ingroup internal - */ - -#define BASE_IGRAPH_REAL -#define HEAP_TYPE_MAX -#include "igraph_pmt.h" -#include "igraph_heap_pmt.h" -#include "igraph_pmt_off.h" -#undef HEAP_TYPE_MAX -#define HEAP_TYPE_MIN -#include "igraph_pmt.h" -#include "igraph_heap_pmt.h" -#include "igraph_pmt_off.h" -#undef HEAP_TYPE_MIN -#undef BASE_IGRAPH_REAL - -#define BASE_LONG -#define HEAP_TYPE_MAX -#include "igraph_pmt.h" -#include "igraph_heap_pmt.h" -#include "igraph_pmt_off.h" -#undef HEAP_TYPE_MAX -#define HEAP_TYPE_MIN -#include "igraph_pmt.h" -#include "igraph_heap_pmt.h" -#include "igraph_pmt_off.h" -#undef HEAP_TYPE_MIN -#undef BASE_LONG - -#define BASE_CHAR -#define HEAP_TYPE_MAX -#include "igraph_pmt.h" -#include "igraph_heap_pmt.h" -#include "igraph_pmt_off.h" -#undef HEAP_TYPE_MAX -#define HEAP_TYPE_MIN -#include "igraph_pmt.h" -#include "igraph_heap_pmt.h" -#include "igraph_pmt_off.h" -#undef HEAP_TYPE_MIN -#undef BASE_CHAR - -#define IGRAPH_HEAP_NULL { 0,0,0 } - -__END_DECLS - -#endif diff --git a/src/include/igraph_heap_pmt.h b/src/include/igraph_heap_pmt.h deleted file mode 100644 index 437a199652..0000000000 --- a/src/include/igraph_heap_pmt.h +++ /dev/null @@ -1,39 +0,0 @@ -/* -*- mode: C -*- */ -/* - IGraph library. - Copyright (C) 2007-2012 Gabor Csardi - 334 Harvard street, Cambridge, MA 02139 USA - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA - -*/ - -typedef struct TYPE(igraph_heap) { - BASE* stor_begin; - BASE* stor_end; - BASE* end; - int destroy; -} TYPE(igraph_heap); - -IGRAPH_EXPORT int FUNCTION(igraph_heap, init)(TYPE(igraph_heap)* h, long int size); -IGRAPH_EXPORT int FUNCTION(igraph_heap, init_array)(TYPE(igraph_heap) *t, BASE* data, long int len); -IGRAPH_EXPORT void FUNCTION(igraph_heap, destroy)(TYPE(igraph_heap)* h); -IGRAPH_EXPORT igraph_bool_t FUNCTION(igraph_heap, empty)(TYPE(igraph_heap)* h); -IGRAPH_EXPORT int FUNCTION(igraph_heap, push)(TYPE(igraph_heap)* h, BASE elem); -IGRAPH_EXPORT BASE FUNCTION(igraph_heap, top)(TYPE(igraph_heap)* h); -IGRAPH_EXPORT BASE FUNCTION(igraph_heap, delete_top)(TYPE(igraph_heap)* h); -IGRAPH_EXPORT long int FUNCTION(igraph_heap, size)(TYPE(igraph_heap)* h); -IGRAPH_EXPORT int FUNCTION(igraph_heap, reserve)(TYPE(igraph_heap)* h, long int size); diff --git a/src/include/igraph_hrg.h b/src/include/igraph_hrg.h deleted file mode 100644 index e81efb2469..0000000000 --- a/src/include/igraph_hrg.h +++ /dev/null @@ -1,115 +0,0 @@ -/* -*- mode: C -*- */ -/* - IGraph library. - Copyright (C) 2009-2012 Gabor Csardi - 334 Harvard street, Cambridge, MA 02139 USA - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA - -*/ - -#ifndef IGRAPH_HRG_H -#define IGRAPH_HRG_H - -#include "igraph_decls.h" -#include "igraph_vector.h" -#include "igraph_vector_ptr.h" -#include "igraph_datatype.h" - -__BEGIN_DECLS - -/** - * \struct igraph_hrg_t - * Data structure to store a hierarchical random graph - * - * A hierarchical random graph (HRG) can be given as a binary tree, - * where the internal vertices are labeled with real numbers. - * - * Note that you don't necessarily have to know this - * internal representation for using the HRG functions, just pass the - * HRG objects created by one igraph function, to another igraph - * function. - * - * - * It has the following members: - * \member left Vector that contains the left children of the internal - * tree vertices. The first vertex is always the root vertex, so - * the first element of the vector is the left child of the root - * vertex. Internal vertices are denoted with negative numbers, - * starting from -1 and going down, i.e. the root vertex is - * -1. Leaf vertices are denoted by non-negative number, starting - * from zero and up. - * \member right Vector that contains the right children of the - * vertices, with the same encoding as the \c left vector. - * \member prob The connection probabilities attached to the internal - * vertices, the first number belongs to the root vertex - * (i.e. internal vertex -1), the second to internal vertex -2, - * etc. - * \member edges The number of edges in the subtree below the given - * internal vertex. - * \member vertices The number of vertices in the subtree below the - * given internal vertex, including itself. - */ - -typedef struct igraph_hrg_t { - igraph_vector_t left, right, prob, edges, vertices; -} igraph_hrg_t; - -IGRAPH_EXPORT int igraph_hrg_init(igraph_hrg_t *hrg, int n); -IGRAPH_EXPORT void igraph_hrg_destroy(igraph_hrg_t *hrg); -IGRAPH_EXPORT int igraph_hrg_size(const igraph_hrg_t *hrg); -IGRAPH_EXPORT int igraph_hrg_resize(igraph_hrg_t *hrg, int newsize); - -IGRAPH_EXPORT int igraph_hrg_fit(const igraph_t *graph, - igraph_hrg_t *hrg, - igraph_bool_t start, - int steps); - -IGRAPH_EXPORT int igraph_hrg_sample(const igraph_t *graph, - igraph_t *sample, - igraph_vector_ptr_t *samples, - igraph_integer_t no_samples, - igraph_hrg_t *hrg, - igraph_bool_t start); - -IGRAPH_EXPORT int igraph_hrg_game(igraph_t *graph, - const igraph_hrg_t *hrg); - -IGRAPH_EXPORT int igraph_hrg_dendrogram(igraph_t *graph, - const igraph_hrg_t *hrg); - -IGRAPH_EXPORT int igraph_hrg_consensus(const igraph_t *graph, - igraph_vector_t *parents, - igraph_vector_t *weights, - igraph_hrg_t *hrg, - igraph_bool_t start, - int num_samples); - -IGRAPH_EXPORT int igraph_hrg_predict(const igraph_t *graph, - igraph_vector_t *edges, - igraph_vector_t *prob, - igraph_hrg_t *hrg, - igraph_bool_t start, - int num_samples, - int num_bins); - -IGRAPH_EXPORT int igraph_hrg_create(igraph_hrg_t *hrg, - const igraph_t *graph, - const igraph_vector_t *prob); - -__END_DECLS - -#endif /* IGRAPH_HRG_H */ diff --git a/src/include/igraph_interface.h b/src/include/igraph_interface.h deleted file mode 100644 index d8ec568902..0000000000 --- a/src/include/igraph_interface.h +++ /dev/null @@ -1,124 +0,0 @@ -/* -*- mode: C -*- */ -/* - IGraph library. - Copyright (C) 2009-2012 Gabor Csardi - 334 Harvard street, Cambridge, MA 02139 USA - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA - -*/ - -#ifndef IGRAPH_INTERFACE_H -#define IGRAPH_INTERFACE_H - -#include "igraph_decls.h" -#include "igraph_types.h" -#include "igraph_datatype.h" -#include "igraph_iterators.h" - -__BEGIN_DECLS - -/* -------------------------------------------------- */ -/* Interface */ -/* -------------------------------------------------- */ - -IGRAPH_EXPORT int igraph_empty(igraph_t *graph, igraph_integer_t n, igraph_bool_t directed); -IGRAPH_EXPORT int igraph_empty_attrs(igraph_t *graph, igraph_integer_t n, igraph_bool_t directed, void *attr); -IGRAPH_EXPORT void igraph_destroy(igraph_t *graph); -IGRAPH_EXPORT int igraph_copy(igraph_t *to, const igraph_t *from); -IGRAPH_EXPORT int igraph_add_edges(igraph_t *graph, const igraph_vector_t *edges, - void *attr); -IGRAPH_EXPORT int igraph_add_vertices(igraph_t *graph, igraph_integer_t nv, - void *attr); -IGRAPH_EXPORT int igraph_delete_edges(igraph_t *graph, igraph_es_t edges); -IGRAPH_EXPORT int igraph_delete_vertices(igraph_t *graph, const igraph_vs_t vertices); -IGRAPH_EXPORT int igraph_delete_vertices_idx(igraph_t *graph, const igraph_vs_t vertices, - igraph_vector_t *idx, - igraph_vector_t *invidx); -IGRAPH_EXPORT igraph_integer_t igraph_vcount(const igraph_t *graph); -IGRAPH_EXPORT igraph_integer_t igraph_ecount(const igraph_t *graph); -IGRAPH_EXPORT int igraph_neighbors(const igraph_t *graph, igraph_vector_t *neis, igraph_integer_t vid, - igraph_neimode_t mode); -IGRAPH_EXPORT igraph_bool_t igraph_is_directed(const igraph_t *graph); -IGRAPH_EXPORT int igraph_degree(const igraph_t *graph, igraph_vector_t *res, - const igraph_vs_t vids, igraph_neimode_t mode, - igraph_bool_t loops); -IGRAPH_EXPORT int igraph_edge(const igraph_t *graph, igraph_integer_t eid, - igraph_integer_t *from, igraph_integer_t *to); -IGRAPH_EXPORT int igraph_edges(const igraph_t *graph, igraph_es_t eids, - igraph_vector_t *edges); -IGRAPH_EXPORT int igraph_get_eid(const igraph_t *graph, igraph_integer_t *eid, - igraph_integer_t from, igraph_integer_t to, - igraph_bool_t directed, igraph_bool_t error); -IGRAPH_EXPORT int igraph_get_eids(const igraph_t *graph, igraph_vector_t *eids, - const igraph_vector_t *pairs, - const igraph_vector_t *path, - igraph_bool_t directed, igraph_bool_t error); -IGRAPH_EXPORT int igraph_get_eids_multi(const igraph_t *graph, igraph_vector_t *eids, - const igraph_vector_t *pairs, - const igraph_vector_t *path, - igraph_bool_t directed, igraph_bool_t error); -IGRAPH_EXPORT int igraph_incident(const igraph_t *graph, igraph_vector_t *eids, igraph_integer_t vid, - igraph_neimode_t mode); -IGRAPH_EXPORT int igraph_is_same_graph(const igraph_t *graph1, const igraph_t *igraph2, igraph_bool_t *res); - -/** - * \define IGRAPH_FROM - * \brief The source vertex of an edge. - * - * Faster than \ref igraph_edge(), but no error checking is done: \p eid is assumed to be valid. - * - * \param graph The graph. - * \param eid The edge ID. - * \return The source vertex of the edge. - * \sa \ref igraph_edge() if error checking is desired. - */ -#define IGRAPH_FROM(graph,eid) ((igraph_integer_t)(VECTOR((graph)->from)[(long int)(eid)])) - -/** - * \define IGRAPH_TO - * \brief The target vertex of an edge. - * - * Faster than \ref igraph_edge(), but no error checking is done: \p eid is assumed to be valid. - * - * \param graph The graph object. - * \param eid The edge ID. - * \return The target vertex of the edge. - * \sa \ref igraph_edge() if error checking is desired. - */ -#define IGRAPH_TO(graph,eid) ((igraph_integer_t)(VECTOR((graph)->to) [(long int)(eid)])) - -/** - * \define IGRAPH_OTHER - * \brief The other endpoint of an edge. - * - * Typically used with undirected edges when one endpoint of the edge is known, - * and the other endpoint is needed. No error checking is done: - * \p eid and \p vid are assumed to be valid. - * - * \param graph The graph object. - * \param eid The edge ID. - * \param vid The vertex ID of one endpoint of an edge. - * \return The other endpoint of the edge. - * \sa \ref IGRAPH_TO() and \ref IGRAPH_FROM() to get the source and target - * of directed edges. - */ -#define IGRAPH_OTHER(graph,eid,vid) \ - ((igraph_integer_t)(IGRAPH_TO(graph,(eid))==(vid) ? IGRAPH_FROM((graph),(eid)) : IGRAPH_TO((graph),(eid)))) - -__END_DECLS - -#endif diff --git a/src/include/igraph_interrupt.h b/src/include/igraph_interrupt.h deleted file mode 100644 index 1c32b69ba5..0000000000 --- a/src/include/igraph_interrupt.h +++ /dev/null @@ -1,128 +0,0 @@ -/* -*- mode: C -*- */ -/* - IGraph library. - Copyright (C) 2003-2012 Gabor Csardi - 334 Harvard street, Cambridge, MA 02139 USA - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA - -*/ - -#ifndef IGRAPH_INTERRUPT_H -#define IGRAPH_INTERRUPT_H - -#include "igraph_decls.h" -#include "igraph_error.h" - -__BEGIN_DECLS - -/* This file contains the igraph interruption handling. */ - -/** - * \section interrupthandlers Interruption handlers - * - * - * \a igraph is designed to be embeddable into several higher level - * languages (R and Python interfaces are included in the original - * package). Since most higher level languages consider internal \a igraph - * calls as atomic, interruption requests (like Ctrl-C in Python) must - * be handled differently depending on the environment \a igraph embeds - * into. - * - * An \emb interruption handler \eme is a function which is called regularly - * by \a igraph during long calculations. A typical usage of the interruption - * handler is to check whether the user tried to interrupt the calculation - * and return an appropriate value to signal this condition. For example, - * in R, one must call an internal R function regularly to check for - * interruption requests, and the \a igraph interruption handler is the - * perfect place to do that. - * - * If you are using the plain C interface of \a igraph or if you are - * allowed to replace the operating system's interruption handler (like - * SIGINT in Un*x systems), these calls are not of much use to you. - * - * The default interruption handler is empty. - * The \ref igraph_set_interruption_handler() function can be used to set a - * new interruption handler function of type - * \ref igraph_interruption_handler_t, see the - * documentation of this type for details. - * - */ - -/** - * \section writing_interruption_handlers Writing interruption handlers - * - * - * You can write and install interruption handlers simply by defining a - * function of type \ref igraph_interruption_handler_t and calling - * \ref igraph_set_interruption_handler(). This feature is useful for - * interface writers, because usually this is the only way to allow handling - * of Ctrl-C and similar keypresses properly. - * - * - * Your interruption handler will be called regularly during long operations - * (so it is not guaranteed to be called during operations which tend to be - * short, like adding single edges). An interruption handler accepts no - * parameters and must return \c IGRAPH_SUCCESS if the calculation should go on. All - * other return values are considered to be a request for interruption, - * and the caller function would return a special error code, \c IGRAPH_INTERRUPTED. - * It is up to your error handler function to handle this error properly. - * - */ - -/** - * \section writing_functions_interruption_handling Writing \a igraph functions with - * proper interruption handling - * - * - * There is practically a simple rule that should be obeyed when writing - * \a igraph functions. If the calculation is expected to take a long time - * in large graphs (a simple rule of thumb is to assume this for every - * function with a time complexity of at least O(n^2)), call - * \ref IGRAPH_ALLOW_INTERRUPTION in regular intervals like every 10th - * iteration or so. - * - */ - -/** - * \typedef igraph_interruption_handler_t - * - * This is the type of the interruption handler functions. - * - * \param data reserved for possible future use - * \return \c IGRAPH_SUCCESS if the calculation should go on, anything else otherwise. - */ - -typedef int igraph_interruption_handler_t (void* data); - -/** - * \function igraph_allow_interruption - * - * This is the function which is called (usually via the - * \ref IGRAPH_ALLOW_INTERRUPTION macro) if \a igraph is checking for interruption - * requests. - * - * \param data reserved for possible future use, now it is always \c NULL - * \return \c IGRAPH_SUCCESS if the calculation should go on, anything else otherwise. - */ - -IGRAPH_EXPORT int igraph_allow_interruption(void* data); - -IGRAPH_EXPORT igraph_interruption_handler_t * igraph_set_interruption_handler (igraph_interruption_handler_t * new_handler); - -__END_DECLS - -#endif diff --git a/src/include/igraph_iterators.h b/src/include/igraph_iterators.h deleted file mode 100644 index 86d604f7b8..0000000000 --- a/src/include/igraph_iterators.h +++ /dev/null @@ -1,398 +0,0 @@ -/* -*- mode: C -*- */ -/* - IGraph library. - Copyright (C) 2009-2012 Gabor Csardi - 334 Harvard street, Cambridge, MA 02139 USA - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA - -*/ - -#ifndef IGRAPH_ITERATORS_H -#define IGRAPH_ITERATORS_H - -#include "igraph_decls.h" -#include "igraph_constants.h" - -__BEGIN_DECLS - -/* -------------------------------------------------- */ -/* Vertex selectors */ -/* -------------------------------------------------- */ - -#define IGRAPH_VS_ALL 0 -#define IGRAPH_VS_ADJ 1 -#define IGRAPH_VS_NONE 2 -#define IGRAPH_VS_1 3 -#define IGRAPH_VS_VECTORPTR 4 -#define IGRAPH_VS_VECTOR 5 -#define IGRAPH_VS_SEQ 6 -#define IGRAPH_VS_NONADJ 7 - -typedef struct igraph_vs_t { - int type; - union { - igraph_integer_t vid; /* single vertex */ - const igraph_vector_t *vecptr; /* vector of vertices */ - struct { - igraph_integer_t vid; - igraph_neimode_t mode; - } adj; /* adjacent vertices */ - struct { - igraph_integer_t from; /* first index */ - igraph_integer_t to; /* last index */ - } seq; /* sequence of vertices from:to */ - } data; -} igraph_vs_t; - -IGRAPH_EXPORT int igraph_vs_all(igraph_vs_t *vs); -IGRAPH_EXPORT igraph_vs_t igraph_vss_all(void); - -IGRAPH_EXPORT int igraph_vs_adj(igraph_vs_t *vs, - igraph_integer_t vid, igraph_neimode_t mode); - -IGRAPH_EXPORT int igraph_vs_nonadj(igraph_vs_t *vs, igraph_integer_t vid, - igraph_neimode_t mode); - -IGRAPH_EXPORT int igraph_vs_none(igraph_vs_t *vs); -IGRAPH_EXPORT igraph_vs_t igraph_vss_none(void); - -IGRAPH_EXPORT int igraph_vs_1(igraph_vs_t *vs, igraph_integer_t vid); -IGRAPH_EXPORT igraph_vs_t igraph_vss_1(igraph_integer_t vid); - -IGRAPH_EXPORT int igraph_vs_vector(igraph_vs_t *vs, - const igraph_vector_t *v); -IGRAPH_EXPORT igraph_vs_t igraph_vss_vector(const igraph_vector_t *v); - -IGRAPH_EXPORT int igraph_vs_vector_small(igraph_vs_t *vs, ...); - -IGRAPH_EXPORT int igraph_vs_vector_copy(igraph_vs_t *vs, - const igraph_vector_t *v); - -IGRAPH_EXPORT int igraph_vs_seq(igraph_vs_t *vs, igraph_integer_t from, igraph_integer_t to); -IGRAPH_EXPORT igraph_vs_t igraph_vss_seq(igraph_integer_t from, igraph_integer_t to); - -IGRAPH_EXPORT void igraph_vs_destroy(igraph_vs_t *vs); - -IGRAPH_EXPORT igraph_bool_t igraph_vs_is_all(const igraph_vs_t *vs); - -IGRAPH_EXPORT int igraph_vs_copy(igraph_vs_t* dest, const igraph_vs_t* src); - -IGRAPH_EXPORT int igraph_vs_as_vector(const igraph_t *graph, igraph_vs_t vs, - igraph_vector_t *v); -IGRAPH_EXPORT int igraph_vs_size(const igraph_t *graph, const igraph_vs_t *vs, - igraph_integer_t *result); -IGRAPH_EXPORT int igraph_vs_type(const igraph_vs_t *vs); - -/* -------------------------------------------------- */ -/* Vertex iterators */ -/* -------------------------------------------------- */ - -#define IGRAPH_VIT_SEQ 0 -#define IGRAPH_VIT_VECTOR 1 -#define IGRAPH_VIT_VECTORPTR 2 - -typedef struct igraph_vit_t { - int type; - long int pos; - long int start; /* first index */ - long int end; /* one past last index */ - const igraph_vector_t *vec; -} igraph_vit_t; - -/** - * \section IGRAPH_VIT Stepping over the vertices - * - * After creating an iterator with \ref igraph_vit_create(), it - * points to the first vertex in the vertex determined by the vertex - * selector (if there is any). The \ref IGRAPH_VIT_NEXT() macro steps - * to the next vertex, \ref IGRAPH_VIT_END() checks whether there are - * more vertices to visit, \ref IGRAPH_VIT_SIZE() gives the total size - * of the vertices visited so far and to be visited. \ref - * IGRAPH_VIT_RESET() resets the iterator, it will point to the first - * vertex again. Finally \ref IGRAPH_VIT_GET() gives the current vertex - * pointed to by the iterator (call this only if \ref IGRAPH_VIT_END() - * is false). - * - * - * Here is an example on how to step over the neighbors of vertex 0: - * - * igraph_vs_t vs; - * igraph_vit_t vit; - * ... - * igraph_vs_adj(&vs, 0, IGRAPH_ALL); - * igraph_vit_create(&graph, vs, &vit); - * while (!IGRAPH_VIT_END(vit)) { - * printf(" %li", (long int) IGRAPH_VIT_GET(vit)); - * IGRAPH_VIT_NEXT(vit); - * } - * printf("\n"); - * ... - * igraph_vit_destroy(&vit); - * igraph_vs_destroy(&vs); - * - * - */ - -/** - * \define IGRAPH_VIT_NEXT - * \brief Next vertex. - * - * Steps the iterator to the next vertex. Only call this function if - * \ref IGRAPH_VIT_END() returns false. - * \param vit The vertex iterator to step. - * - * Time complexity: O(1). - */ -#define IGRAPH_VIT_NEXT(vit) (++((vit).pos)) -/** - * \define IGRAPH_VIT_END - * \brief Are we at the end? - * - * Checks whether there are more vertices to step to. - * \param vit The vertex iterator to check. - * \return Logical value, if true there are no more vertices to step - * to. - * - * Time complexity: O(1). - */ -#define IGRAPH_VIT_END(vit) ((vit).pos >= (vit).end) -/** - * \define IGRAPH_VIT_SIZE - * \brief Size of a vertex iterator. - * - * Gives the number of vertices in a vertex iterator. - * \param vit The vertex iterator. - * \return The number of vertices. - * - * Time complexity: O(1). - */ -#define IGRAPH_VIT_SIZE(vit) ((vit).end - (vit).start) -/** - * \define IGRAPH_VIT_RESET - * \brief Reset a vertex iterator. - * - * Resets a vertex iterator. After calling this macro the iterator - * will point to the first vertex. - * \param vit The vertex iterator. - * - * Time complexity: O(1). - */ -#define IGRAPH_VIT_RESET(vit) ((vit).pos = (vit).start) -/** - * \define IGRAPH_VIT_GET - * \brief Query the current position. - * - * Gives the vertex id of the current vertex pointed to by the - * iterator. - * \param vit The vertex iterator. - * \return The vertex id of the current vertex. - * - * Time complexity: O(1). - */ -#define IGRAPH_VIT_GET(vit) \ - ((igraph_integer_t)(((vit).type == IGRAPH_VIT_SEQ) ? (vit).pos : \ - VECTOR(*(vit).vec)[(vit).pos])) - -IGRAPH_EXPORT int igraph_vit_create(const igraph_t *graph, - igraph_vs_t vs, igraph_vit_t *vit); -IGRAPH_EXPORT void igraph_vit_destroy(const igraph_vit_t *vit); - -IGRAPH_EXPORT int igraph_vit_as_vector(const igraph_vit_t *vit, igraph_vector_t *v); - -/* -------------------------------------------------- */ -/* Edge Selectors */ -/* -------------------------------------------------- */ - -#define IGRAPH_ES_ALL 0 -#define IGRAPH_ES_ALLFROM 1 -#define IGRAPH_ES_ALLTO 2 -#define IGRAPH_ES_INCIDENT 3 -#define IGRAPH_ES_NONE 4 -#define IGRAPH_ES_1 5 -#define IGRAPH_ES_VECTORPTR 6 -#define IGRAPH_ES_VECTOR 7 -#define IGRAPH_ES_SEQ 8 -#define IGRAPH_ES_PAIRS 9 -#define IGRAPH_ES_PATH 10 -#define IGRAPH_ES_MULTIPAIRS 11 - -typedef struct igraph_es_t { - int type; - union { - igraph_integer_t vid; - igraph_integer_t eid; - const igraph_vector_t *vecptr; - struct { - igraph_integer_t vid; - igraph_neimode_t mode; - } incident; - struct { - igraph_integer_t from; /* first index */ - igraph_integer_t to; /* last index */ - } seq; - struct { - const igraph_vector_t *ptr; - igraph_bool_t mode; - } path; - } data; -} igraph_es_t; - -IGRAPH_EXPORT int igraph_es_all(igraph_es_t *es, - igraph_edgeorder_type_t order); -IGRAPH_EXPORT igraph_es_t igraph_ess_all(igraph_edgeorder_type_t order); - -IGRAPH_EXPORT int igraph_es_incident(igraph_es_t *es, - igraph_integer_t vid, igraph_neimode_t mode); - -IGRAPH_EXPORT int igraph_es_none(igraph_es_t *es); -IGRAPH_EXPORT igraph_es_t igraph_ess_none(void); - -IGRAPH_EXPORT int igraph_es_1(igraph_es_t *es, igraph_integer_t eid); -IGRAPH_EXPORT igraph_es_t igraph_ess_1(igraph_integer_t eid); - -IGRAPH_EXPORT int igraph_es_vector(igraph_es_t *es, - const igraph_vector_t *v); -IGRAPH_EXPORT igraph_es_t igraph_ess_vector(const igraph_vector_t *v); - -IGRAPH_EXPORT int igraph_es_fromto(igraph_es_t *es, - igraph_vs_t from, igraph_vs_t to); - -IGRAPH_EXPORT int igraph_es_seq(igraph_es_t *es, igraph_integer_t from, igraph_integer_t to); -IGRAPH_EXPORT igraph_es_t igraph_ess_seq(igraph_integer_t from, igraph_integer_t to); - -IGRAPH_EXPORT int igraph_es_vector_copy(igraph_es_t *es, const igraph_vector_t *v); - -IGRAPH_EXPORT int igraph_es_pairs(igraph_es_t *es, const igraph_vector_t *v, - igraph_bool_t directed); -IGRAPH_EXPORT int igraph_es_pairs_small(igraph_es_t *es, igraph_bool_t directed, ...); - -IGRAPH_EXPORT int igraph_es_multipairs(igraph_es_t *es, const igraph_vector_t *v, - igraph_bool_t directed); - -IGRAPH_EXPORT int igraph_es_path(igraph_es_t *es, const igraph_vector_t *v, - igraph_bool_t directed); -IGRAPH_EXPORT int igraph_es_path_small(igraph_es_t *es, igraph_bool_t directed, ...); - -IGRAPH_EXPORT void igraph_es_destroy(igraph_es_t *es); - -IGRAPH_EXPORT igraph_bool_t igraph_es_is_all(const igraph_es_t *es); - -IGRAPH_EXPORT int igraph_es_copy(igraph_es_t* dest, const igraph_es_t* src); - -IGRAPH_EXPORT int igraph_es_as_vector(const igraph_t *graph, igraph_es_t es, - igraph_vector_t *v); -IGRAPH_EXPORT int igraph_es_size(const igraph_t *graph, const igraph_es_t *es, - igraph_integer_t *result); -IGRAPH_EXPORT int igraph_es_type(const igraph_es_t *es); - - -/* -------------------------------------------------- */ -/* Edge Iterators */ -/* -------------------------------------------------- */ - -#define IGRAPH_EIT_SEQ 0 -#define IGRAPH_EIT_VECTOR 1 -#define IGRAPH_EIT_VECTORPTR 2 - -typedef struct igraph_eit_t { - int type; - long int pos; - long int start; /* first index */ - long int end; /* one past last index */ - const igraph_vector_t *vec; -} igraph_eit_t; - -/** - * \section IGRAPH_EIT Stepping over the edges - * - * Just like for vertex iterators, macros are provided for - * stepping over a sequence of edges: \ref IGRAPH_EIT_NEXT() goes to - * the next edge, \ref IGRAPH_EIT_END() checks whether there are more - * edges to visit, \ref IGRAPH_EIT_SIZE() gives the number of edges in - * the edge sequence, \ref IGRAPH_EIT_RESET() resets the iterator to - * the first edge and \ref IGRAPH_EIT_GET() returns the id of the - * current edge. - */ - -/** - * \define IGRAPH_EIT_NEXT - * \brief Next edge. - * - * Steps the iterator to the next edge. Call this function only if - * \ref IGRAPH_EIT_END() returns false. - * \param eit The edge iterator to step. - * - * Time complexity: O(1). - */ -#define IGRAPH_EIT_NEXT(eit) (++((eit).pos)) -/** - * \define IGRAPH_EIT_END - * \brief Are we at the end? - * - * Checks whether there are more edges to step to. - * \param wit The edge iterator to check. - * \return Logical value, if true there are no more edges - * to step to. - * - * Time complexity: O(1). - */ -#define IGRAPH_EIT_END(eit) ((eit).pos >= (eit).end) -/** - * \define IGRAPH_EIT_SIZE - * \brief Number of edges in the iterator. - * - * Gives the number of edges in an edge iterator. - * \param eit The edge iterator. - * \return The number of edges. - * - * Time complexity: O(1). - */ -#define IGRAPH_EIT_SIZE(eit) ((eit).end - (eit).start) -/** - * \define IGRAPH_EIT_RESET - * \brief Reset an edge iterator. - * - * Resets an edge iterator. After calling this macro the iterator will - * point to the first edge. - * \param eit The edge iterator. - * - * Time complexity: O(1). - */ -#define IGRAPH_EIT_RESET(eit) ((eit).pos = (eit).start) -/** - * \define IGRAPH_EIT_GET - * \brief Query an edge iterator. - * - * Gives the edge id of the current edge pointed to by an iterator. - * \param eit The edge iterator. - * \return The id of the current edge. - * - * Time complexity: O(1). - */ -#define IGRAPH_EIT_GET(eit) \ - (igraph_integer_t)((((eit).type == IGRAPH_EIT_SEQ) ? (eit).pos : \ - VECTOR(*(eit).vec)[(eit).pos])) - -IGRAPH_EXPORT int igraph_eit_create(const igraph_t *graph, - igraph_es_t es, igraph_eit_t *eit); -IGRAPH_EXPORT void igraph_eit_destroy(const igraph_eit_t *eit); - -IGRAPH_EXPORT int igraph_eit_as_vector(const igraph_eit_t *eit, igraph_vector_t *v); - -__END_DECLS - -#endif diff --git a/src/include/igraph_lapack.h b/src/include/igraph_lapack.h deleted file mode 100644 index 79b3c026d5..0000000000 --- a/src/include/igraph_lapack.h +++ /dev/null @@ -1,111 +0,0 @@ -/* -*- mode: C -*- */ -/* - IGraph library. - Copyright (C) 2010-2012 Gabor Csardi - 334 Harvard street, Cambridge, MA 02139 USA - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA - -*/ - -#ifndef IGRAPH_LAPACK_H -#define IGRAPH_LAPACK_H - -#include "igraph_decls.h" -#include "igraph_vector.h" -#include "igraph_matrix.h" - -__BEGIN_DECLS - -/** - * \section about_lapack LAPACK interface in igraph - * - * - * LAPACK is written in Fortran90 and provides routines for solving - * systems of simultaneous linear equations, least-squares solutions - * of linear systems of equations, eigenvalue problems, and singular - * value problems. The associated matrix factorizations (LU, Cholesky, - * QR, SVD, Schur, generalized Schur) are also provided, as are - * related computations such as reordering of the Schur factorizations - * and estimating condition numbers. Dense and banded matrices are - * handled, but not general sparse matrices. In all areas, similar - * functionality is provided for real and complex matrices, in both - * single and double precision. - * - * - * - * igraph provides an interface to a very limited set of LAPACK - * functions, using the regular igraph data structures. - * - * - * - * See more about LAPACK at http://www.netlib.org/lapack/ - * - */ - -IGRAPH_EXPORT int igraph_lapack_dgetrf(igraph_matrix_t *a, igraph_vector_int_t *ipiv, - int *info); -IGRAPH_EXPORT int igraph_lapack_dgetrs(igraph_bool_t transpose, const igraph_matrix_t *a, - const igraph_vector_int_t *ipiv, igraph_matrix_t *b); -IGRAPH_EXPORT int igraph_lapack_dgesv(igraph_matrix_t *a, igraph_vector_int_t *ipiv, - igraph_matrix_t *b, int *info); - -typedef enum { IGRAPH_LAPACK_DSYEV_ALL, - IGRAPH_LAPACK_DSYEV_INTERVAL, - IGRAPH_LAPACK_DSYEV_SELECT - } igraph_lapack_dsyev_which_t; - -IGRAPH_EXPORT int igraph_lapack_dsyevr(const igraph_matrix_t *A, - igraph_lapack_dsyev_which_t which, - igraph_real_t vl, igraph_real_t vu, int vestimate, - int il, int iu, igraph_real_t abstol, - igraph_vector_t *values, igraph_matrix_t *vectors, - igraph_vector_int_t *support); - -/* TODO: should we use complex vectors/matrices? */ - -IGRAPH_EXPORT int igraph_lapack_dgeev(const igraph_matrix_t *A, - igraph_vector_t *valuesreal, - igraph_vector_t *valuesimag, - igraph_matrix_t *vectorsleft, - igraph_matrix_t *vectorsright, int *info); - -typedef enum { IGRAPH_LAPACK_DGEEVX_BALANCE_NONE = 0, - IGRAPH_LAPACK_DGEEVX_BALANCE_PERM, - IGRAPH_LAPACK_DGEEVX_BALANCE_SCALE, - IGRAPH_LAPACK_DGEEVX_BALANCE_BOTH - } -igraph_lapack_dgeevx_balance_t; - -IGRAPH_EXPORT int igraph_lapack_dgeevx(igraph_lapack_dgeevx_balance_t balance, - const igraph_matrix_t *A, - igraph_vector_t *valuesreal, - igraph_vector_t *valuesimag, - igraph_matrix_t *vectorsleft, - igraph_matrix_t *vectorsright, - int *ilo, int *ihi, igraph_vector_t *scale, - igraph_real_t *abnrm, - igraph_vector_t *rconde, - igraph_vector_t *rcondv, - int *info); - -IGRAPH_EXPORT int igraph_lapack_dgehrd(const igraph_matrix_t *A, - int ilo, int ihi, - igraph_matrix_t *result); - -__END_DECLS - -#endif diff --git a/src/include/igraph_layout.h b/src/include/igraph_layout.h deleted file mode 100644 index 16c7b3c2bd..0000000000 --- a/src/include/igraph_layout.h +++ /dev/null @@ -1,258 +0,0 @@ -/* -*- mode: C -*- */ -/* - IGraph library. - Copyright (C) 2009-2012 Gabor Csardi - 334 Harvard street, Cambridge, MA 02139 USA - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA - -*/ - -#ifndef IGRAPH_LAYOUT_H -#define IGRAPH_LAYOUT_H - -#include "igraph_decls.h" -#include "igraph_constants.h" -#include "igraph_types.h" -#include "igraph_vector.h" -#include "igraph_vector_ptr.h" -#include "igraph_matrix.h" -#include "igraph_datatype.h" -#include "igraph_arpack.h" -#include "igraph_iterators.h" - -__BEGIN_DECLS - -/** - * \section about_layouts - * - * Layout generator functions (or at least most of them) try to place the - * vertices and edges of a graph on a 2D plane or in 3D space in a way - * which visually pleases the human eye. - * - * They take a graph object and a number of parameters as arguments - * and return an \type igraph_matrix_t, in which each row gives the - * coordinates of a vertex. - */ - -/* -------------------------------------------------- */ -/* Layouts */ -/* -------------------------------------------------- */ - -IGRAPH_EXPORT int igraph_layout_random(const igraph_t *graph, igraph_matrix_t *res); -IGRAPH_EXPORT int igraph_layout_circle(const igraph_t *graph, igraph_matrix_t *res, - igraph_vs_t order); -IGRAPH_EXPORT int igraph_layout_star(const igraph_t *graph, igraph_matrix_t *res, - igraph_integer_t center, const igraph_vector_t *order); -IGRAPH_EXPORT int igraph_layout_grid(const igraph_t *graph, igraph_matrix_t *res, long int width); -IGRAPH_EXPORT int igraph_layout_fruchterman_reingold(const igraph_t *graph, - igraph_matrix_t *res, - igraph_bool_t use_seed, - igraph_integer_t niter, - igraph_real_t start_temp, - igraph_layout_grid_t grid, - const igraph_vector_t *weight, - const igraph_vector_t *minx, - const igraph_vector_t *maxx, - const igraph_vector_t *miny, - const igraph_vector_t *maxy); - -IGRAPH_EXPORT int igraph_layout_kamada_kawai(const igraph_t *graph, igraph_matrix_t *res, - igraph_bool_t use_seed, igraph_integer_t maxiter, - igraph_real_t epsilon, igraph_real_t kkconst, - const igraph_vector_t *weights, - const igraph_vector_t *minx, const igraph_vector_t *maxx, - const igraph_vector_t *miny, const igraph_vector_t *maxy); - -IGRAPH_EXPORT int igraph_layout_lgl(const igraph_t *graph, igraph_matrix_t *res, - igraph_integer_t maxiter, igraph_real_t maxdelta, - igraph_real_t area, igraph_real_t coolexp, - igraph_real_t repulserad, igraph_real_t cellsize, igraph_integer_t root); -IGRAPH_EXPORT int igraph_layout_reingold_tilford(const igraph_t *graph, igraph_matrix_t *res, - igraph_neimode_t mode, - const igraph_vector_t *roots, - const igraph_vector_t *rootlevel); -IGRAPH_EXPORT int igraph_layout_reingold_tilford_circular(const igraph_t *graph, - igraph_matrix_t *res, - igraph_neimode_t mode, - const igraph_vector_t *roots, - const igraph_vector_t *rootlevel); -IGRAPH_EXPORT int igraph_layout_sugiyama(const igraph_t *graph, igraph_matrix_t *res, - igraph_t *extd_graph, igraph_vector_t *extd_to_orig_eids, - const igraph_vector_t* layers, igraph_real_t hgap, - igraph_real_t vgap, long int maxiter, const igraph_vector_t *weights); - -IGRAPH_EXPORT int igraph_layout_random_3d(const igraph_t *graph, igraph_matrix_t *res); -IGRAPH_EXPORT int igraph_layout_sphere(const igraph_t *graph, igraph_matrix_t *res); -IGRAPH_EXPORT int igraph_layout_grid_3d(const igraph_t *graph, igraph_matrix_t *res, - long int width, long int height); -IGRAPH_EXPORT int igraph_layout_fruchterman_reingold_3d(const igraph_t *graph, - igraph_matrix_t *res, - igraph_bool_t use_seed, - igraph_integer_t niter, - igraph_real_t start_temp, - const igraph_vector_t *weight, - const igraph_vector_t *minx, - const igraph_vector_t *maxx, - const igraph_vector_t *miny, - const igraph_vector_t *maxy, - const igraph_vector_t *minz, - const igraph_vector_t *maxz); - -IGRAPH_EXPORT int igraph_layout_kamada_kawai_3d(const igraph_t *graph, igraph_matrix_t *res, - igraph_bool_t use_seed, igraph_integer_t maxiter, - igraph_real_t epsilon, igraph_real_t kkconst, - const igraph_vector_t *weights, - const igraph_vector_t *minx, const igraph_vector_t *maxx, - const igraph_vector_t *miny, const igraph_vector_t *maxy, - const igraph_vector_t *minz, const igraph_vector_t *maxz); - -IGRAPH_EXPORT int igraph_layout_graphopt(const igraph_t *graph, - igraph_matrix_t *res, igraph_integer_t niter, - igraph_real_t node_charge, igraph_real_t node_mass, - igraph_real_t spring_length, - igraph_real_t spring_constant, - igraph_real_t max_sa_movement, - igraph_bool_t use_seed); - -IGRAPH_EXPORT int igraph_layout_mds(const igraph_t *graph, igraph_matrix_t *res, - const igraph_matrix_t *dist, long int dim); - -IGRAPH_EXPORT int igraph_layout_bipartite(const igraph_t *graph, - const igraph_vector_bool_t *types, - igraph_matrix_t *res, igraph_real_t hgap, - igraph_real_t vgap, long int maxiter); - -/** - * \struct igraph_layout_drl_options_t - * Parameters for the DrL layout generator - * - * \member edge_cut The edge cutting parameter. - * Edge cutting is done in the late stages of the - * algorithm in order to achieve less dense layouts. Edges are cut - * if there is a lot of stress on them (a large value in the - * objective function sum). The edge cutting parameter is a value - * between 0 and 1 with 0 representing no edge cutting and 1 - * representing maximal edge cutting. The default value is 32/40. - * \member init_iterations Number of iterations, initial phase. - * \member init_temperature Start temperature, initial phase. - * \member init_attraction Attraction, initial phase. - * \member init_damping_mult Damping factor, initial phase. - * \member liquid_iterations Number of iterations in the liquid phase. - * \member liquid_temperature Start temperature in the liquid phase. - * \member liquid_attraction Attraction in the liquid phase. - * \member liquid_damping_mult Multiplicatie damping factor, liquid phase. - * \member expansion_iterations Number of iterations in the expansion phase. - * \member expansion_temperature Start temperature in the expansion phase. - * \member expansion_attraction Attraction, expansion phase. - * \member expansion_damping_mult Damping factor, expansion phase. - * \member cooldown_iterations Number of iterations in the cooldown phase. - * \member cooldown_temperature Start temperature in the cooldown phase. - * \member cooldown_attraction Attraction in the cooldown phase. - * \member cooldown_damping_mult Damping fact int the cooldown phase. - * \member crunch_iterations Number of iterations in the crunch phase. - * \member crunch_temperature Start temperature in the crunch phase. - * \member crunch_attraction Attraction in the crunch phase. - * \member crunch_damping_mult Damping factor in the crunch phase. - * \member simmer_iterations Number of iterations in the simmer phase. - * \member simmer_temperature Start temperature in te simmer phase. - * \member simmer_attraction Attraction in the simmer phase. - * \member simmer_damping_mult Multiplicative damping factor in the simmer phase. - */ - -typedef struct igraph_layout_drl_options_t { - igraph_real_t edge_cut; - igraph_integer_t init_iterations; - igraph_real_t init_temperature; - igraph_real_t init_attraction; - igraph_real_t init_damping_mult; - igraph_integer_t liquid_iterations; - igraph_real_t liquid_temperature; - igraph_real_t liquid_attraction; - igraph_real_t liquid_damping_mult; - igraph_integer_t expansion_iterations; - igraph_real_t expansion_temperature; - igraph_real_t expansion_attraction; - igraph_real_t expansion_damping_mult; - igraph_integer_t cooldown_iterations; - igraph_real_t cooldown_temperature; - igraph_real_t cooldown_attraction; - igraph_real_t cooldown_damping_mult; - igraph_integer_t crunch_iterations; - igraph_real_t crunch_temperature; - igraph_real_t crunch_attraction; - igraph_real_t crunch_damping_mult; - igraph_integer_t simmer_iterations; - igraph_real_t simmer_temperature; - igraph_real_t simmer_attraction; - igraph_real_t simmer_damping_mult; -} igraph_layout_drl_options_t; - -/** - * \typedef igraph_layout_drl_default_t - * Predefined parameter templates for the DrL layout generator - * - * These constants can be used to initialize a set of DrL parameters. - * These can then be modified according to the user's needs. - * \enumval IGRAPH_LAYOUT_DRL_DEFAULT The deafult parameters. - * \enumval IGRAPH_LAYOUT_DRL_COARSEN Slightly modified parameters to - * get a coarser layout. - * \enumval IGRAPH_LAYOUT_DRL_COARSEST An even coarser layout. - * \enumval IGRAPH_LAYOUT_DRL_REFINE Refine an already calculated layout. - * \enumval IGRAPH_LAYOUT_DRL_FINAL Finalize an already refined layout. - */ - -typedef enum { IGRAPH_LAYOUT_DRL_DEFAULT = 0, - IGRAPH_LAYOUT_DRL_COARSEN, - IGRAPH_LAYOUT_DRL_COARSEST, - IGRAPH_LAYOUT_DRL_REFINE, - IGRAPH_LAYOUT_DRL_FINAL - } igraph_layout_drl_default_t; - -IGRAPH_EXPORT int igraph_layout_drl_options_init(igraph_layout_drl_options_t *options, - igraph_layout_drl_default_t templ); -IGRAPH_EXPORT int igraph_layout_drl(const igraph_t *graph, igraph_matrix_t *res, - igraph_bool_t use_seed, - const igraph_layout_drl_options_t *options, - const igraph_vector_t *weights, - const igraph_vector_bool_t *fixed); - -IGRAPH_EXPORT int igraph_layout_drl_3d(const igraph_t *graph, igraph_matrix_t *res, - igraph_bool_t use_seed, - const igraph_layout_drl_options_t *options, - const igraph_vector_t *weights, - const igraph_vector_bool_t *fixed); - -IGRAPH_EXPORT int igraph_layout_merge_dla(const igraph_vector_ptr_t *graphs, - const igraph_vector_ptr_t *coords, - igraph_matrix_t *res); - -IGRAPH_EXPORT int igraph_layout_gem(const igraph_t *graph, igraph_matrix_t *res, - igraph_bool_t use_seed, igraph_integer_t maxiter, - igraph_real_t temp_max, igraph_real_t temp_min, - igraph_real_t temp_init); - -IGRAPH_EXPORT int igraph_layout_davidson_harel(const igraph_t *graph, igraph_matrix_t *res, - igraph_bool_t use_seed, igraph_integer_t maxiter, - igraph_integer_t fineiter, igraph_real_t cool_fact, - igraph_real_t weight_node_dist, igraph_real_t weight_border, - igraph_real_t weight_edge_lengths, - igraph_real_t weight_edge_crossings, - igraph_real_t weight_node_edge_dist); - -__END_DECLS - -#endif diff --git a/src/include/igraph_lsap.h b/src/include/igraph_lsap.h deleted file mode 100644 index eeffedec00..0000000000 --- a/src/include/igraph_lsap.h +++ /dev/null @@ -1,17 +0,0 @@ - -#ifndef IGRAPH_LSAP_H -#define IGRAPH_LSAP_H - -#include "igraph_decls.h" -#include "igraph_matrix.h" -#include "igraph_vector.h" -#include "igraph_types.h" - -__BEGIN_DECLS - -IGRAPH_EXPORT int igraph_solve_lsap(igraph_matrix_t *c, igraph_integer_t n, - igraph_vector_int_t *p); - -__END_DECLS - -#endif diff --git a/src/include/igraph_matching.h b/src/include/igraph_matching.h deleted file mode 100644 index c9a154058a..0000000000 --- a/src/include/igraph_matching.h +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- mode: C -*- */ -/* - IGraph library. - Copyright (C) 2012 Tamas Nepusz - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA - -*/ - -#ifndef IGRAPH_MATCHING_H -#define IGRAPH_MATCHING_H - -#include "igraph_decls.h" -#include "igraph_constants.h" -#include "igraph_datatype.h" -#include "igraph_types.h" -#include "igraph_vector.h" - -__BEGIN_DECLS - -/* -------------------------------------------------- */ -/* Matchings in graphs */ -/* -------------------------------------------------- */ - -IGRAPH_EXPORT int igraph_is_matching(const igraph_t* graph, - const igraph_vector_bool_t* types, const igraph_vector_long_t* matching, - igraph_bool_t* result); -IGRAPH_EXPORT int igraph_is_maximal_matching(const igraph_t* graph, - const igraph_vector_bool_t* types, const igraph_vector_long_t* matching, - igraph_bool_t* result); - -IGRAPH_EXPORT int igraph_maximum_bipartite_matching(const igraph_t* graph, - const igraph_vector_bool_t* types, igraph_integer_t* matching_size, - igraph_real_t* matching_weight, igraph_vector_long_t* matching, - const igraph_vector_t* weights, igraph_real_t eps); - -IGRAPH_EXPORT int igraph_maximum_matching(const igraph_t* graph, igraph_integer_t* matching_size, - igraph_real_t* matching_weight, igraph_vector_long_t* matching, - const igraph_vector_t* weights); - -__END_DECLS - -#endif diff --git a/src/include/igraph_matrix.h b/src/include/igraph_matrix.h deleted file mode 100644 index a8b8b5e024..0000000000 --- a/src/include/igraph_matrix.h +++ /dev/null @@ -1,100 +0,0 @@ -/* -*- mode: C -*- */ -/* - IGraph library. - Copyright (C) 2009-2012 Gabor Csardi - 334 Harvard street, Cambridge, MA 02139 USA - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA - -*/ - -#ifndef IGRAPH_MATRIX_H -#define IGRAPH_MATRIX_H - -#include "igraph_decls.h" -#include "igraph_vector.h" - -__BEGIN_DECLS - -/* -------------------------------------------------- */ -/* Matrix, very similar to vector */ -/* -------------------------------------------------- */ - -#define BASE_IGRAPH_REAL -#include "igraph_pmt.h" -#include "igraph_matrix_pmt.h" -#include "igraph_pmt_off.h" -#undef BASE_IGRAPH_REAL - -#define BASE_INT -#include "igraph_pmt.h" -#include "igraph_matrix_pmt.h" -#include "igraph_pmt_off.h" -#undef BASE_INT - -#define BASE_LONG -#include "igraph_pmt.h" -#include "igraph_matrix_pmt.h" -#include "igraph_pmt_off.h" -#undef BASE_LONG - -#define BASE_CHAR -#include "igraph_pmt.h" -#include "igraph_matrix_pmt.h" -#include "igraph_pmt_off.h" -#undef BASE_CHAR - -#define BASE_BOOL -#include "igraph_pmt.h" -#include "igraph_matrix_pmt.h" -#include "igraph_pmt_off.h" -#undef BASE_BOOL - -#define BASE_COMPLEX -#include "igraph_pmt.h" -#include "igraph_matrix_pmt.h" -#include "igraph_pmt_off.h" -#undef BASE_COMPLEX - -#define IGRAPH_MATRIX_NULL { IGRAPH_VECTOR_NULL, 0, 0 } -#define IGRAPH_MATRIX_INIT_FINALLY(m, nr, nc) \ - do { IGRAPH_CHECK(igraph_matrix_init(m, nr, nc)); \ - IGRAPH_FINALLY(igraph_matrix_destroy, m); } while (0) - -/** - * \ingroup matrix - * \define MATRIX - * \brief Accessing an element of a matrix. - * - * Note that there are no range checks right now. - * This functionality might be redefined as a proper function later. - * \param m The matrix object. - * \param i The index of the row, starting with zero. - * \param j The index of the column, starting with zero. - * - * Time complexity: O(1). - */ -#define MATRIX(m,i,j) ((m).data.stor_begin[(m).nrow*(j)+(i)]) - -IGRAPH_EXPORT igraph_bool_t igraph_matrix_all_e_tol(const igraph_matrix_t *lhs, - const igraph_matrix_t *rhs, - igraph_real_t tol); - -IGRAPH_EXPORT int igraph_matrix_zapsmall(igraph_matrix_t *m, igraph_real_t tol); - -__END_DECLS - -#endif diff --git a/src/include/igraph_matrix_pmt.h b/src/include/igraph_matrix_pmt.h deleted file mode 100644 index 81a735303e..0000000000 --- a/src/include/igraph_matrix_pmt.h +++ /dev/null @@ -1,244 +0,0 @@ -/* -*- mode: C -*- */ -/* - IGraph library. - Copyright (C) 2007-2012 Gabor Csardi - 334 Harvard street, Cambridge, MA 02139 USA - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA - -*/ - -typedef struct TYPE(igraph_matrix) { - TYPE(igraph_vector) data; - long int nrow, ncol; -} TYPE(igraph_matrix); - -/*---------------*/ -/* Allocation */ -/*---------------*/ - -IGRAPH_EXPORT int FUNCTION(igraph_matrix, init)(TYPE(igraph_matrix) *m, - long int nrow, long int ncol); -IGRAPH_EXPORT int FUNCTION(igraph_matrix, copy)(TYPE(igraph_matrix) *to, - const TYPE(igraph_matrix) *from); -IGRAPH_EXPORT void FUNCTION(igraph_matrix, destroy)(TYPE(igraph_matrix) *m); -IGRAPH_EXPORT long int FUNCTION(igraph_matrix, capacity)(const TYPE(igraph_matrix) *m); - -/*--------------------*/ -/* Accessing elements */ -/*--------------------*/ - -/* MATRIX */ -IGRAPH_EXPORT BASE FUNCTION(igraph_matrix, e)(const TYPE(igraph_matrix) *m, - long int row, long int col); -IGRAPH_EXPORT BASE* FUNCTION(igraph_matrix, e_ptr)(const TYPE(igraph_matrix) *m, - long int row, long int col); -IGRAPH_EXPORT void FUNCTION(igraph_matrix, set)(TYPE(igraph_matrix)* m, long int row, long int col, - BASE value); - -/*------------------------------*/ -/* Initializing matrix elements */ -/*------------------------------*/ - -IGRAPH_EXPORT void FUNCTION(igraph_matrix, null)(TYPE(igraph_matrix) *m); -IGRAPH_EXPORT void FUNCTION(igraph_matrix, fill)(TYPE(igraph_matrix) *m, BASE e); - -/*-----------------------*/ -/* Matrix views */ -/*-----------------------*/ - -IGRAPH_EXPORT const TYPE(igraph_matrix) *FUNCTION(igraph_matrix, view)(const TYPE(igraph_matrix) *m, - const BASE *data, - long int nrow, - long int ncol); - -/*------------------*/ -/* Copying matrices */ -/*------------------*/ - -IGRAPH_EXPORT void FUNCTION(igraph_matrix, copy_to)(const TYPE(igraph_matrix) *m, BASE *to); -IGRAPH_EXPORT int FUNCTION(igraph_matrix, update)(TYPE(igraph_matrix) *to, - const TYPE(igraph_matrix) *from); -IGRAPH_EXPORT int FUNCTION(igraph_matrix, rbind)(TYPE(igraph_matrix) *to, - const TYPE(igraph_matrix) *from); -IGRAPH_EXPORT int FUNCTION(igraph_matrix, cbind)(TYPE(igraph_matrix) *to, - const TYPE(igraph_matrix) *from); -IGRAPH_EXPORT int FUNCTION(igraph_matrix, swap)(TYPE(igraph_matrix) *m1, TYPE(igraph_matrix) *m2); - -/*--------------------------*/ -/* Copying rows and columns */ -/*--------------------------*/ - -IGRAPH_EXPORT int FUNCTION(igraph_matrix, get_row)(const TYPE(igraph_matrix) *m, - TYPE(igraph_vector) *res, long int index); -IGRAPH_EXPORT int FUNCTION(igraph_matrix, get_col)(const TYPE(igraph_matrix) *m, - TYPE(igraph_vector) *res, long int index); -IGRAPH_EXPORT int FUNCTION(igraph_matrix, set_row)(TYPE(igraph_matrix) *m, - const TYPE(igraph_vector) *v, long int index); -IGRAPH_EXPORT int FUNCTION(igraph_matrix, set_col)(TYPE(igraph_matrix) *m, - const TYPE(igraph_vector) *v, long int index); -IGRAPH_EXPORT int FUNCTION(igraph_matrix, select_rows)(const TYPE(igraph_matrix) *m, - TYPE(igraph_matrix) *res, - const igraph_vector_t *rows); -IGRAPH_EXPORT int FUNCTION(igraph_matrix, select_cols)(const TYPE(igraph_matrix) *m, - TYPE(igraph_matrix) *res, - const igraph_vector_t *cols); -IGRAPH_EXPORT int FUNCTION(igraph_matrix, select_rows_cols)(const TYPE(igraph_matrix) *m, - TYPE(igraph_matrix) *res, - const igraph_vector_t *rows, - const igraph_vector_t *cols); - -/*-----------------------------*/ -/* Exchanging rows and columns */ -/*-----------------------------*/ - -IGRAPH_EXPORT int FUNCTION(igraph_matrix, swap_rows)(TYPE(igraph_matrix) *m, - long int i, long int j); -IGRAPH_EXPORT int FUNCTION(igraph_matrix, swap_cols)(TYPE(igraph_matrix) *m, - long int i, long int j); -IGRAPH_EXPORT int FUNCTION(igraph_matrix, swap_rowcol)(TYPE(igraph_matrix) *m, - long int i, long int j); -IGRAPH_EXPORT int FUNCTION(igraph_matrix, transpose)(TYPE(igraph_matrix) *m); - -/*-----------------------------*/ -/* Matrix operations */ -/*-----------------------------*/ - -IGRAPH_EXPORT int FUNCTION(igraph_matrix, add)(TYPE(igraph_matrix) *m1, - const TYPE(igraph_matrix) *m2); -IGRAPH_EXPORT int FUNCTION(igraph_matrix, sub)(TYPE(igraph_matrix) *m1, - const TYPE(igraph_matrix) *m2); -IGRAPH_EXPORT int FUNCTION(igraph_matrix, mul_elements)(TYPE(igraph_matrix) *m1, - const TYPE(igraph_matrix) *m2); -IGRAPH_EXPORT int FUNCTION(igraph_matrix, div_elements)(TYPE(igraph_matrix) *m1, - const TYPE(igraph_matrix) *m2); -IGRAPH_EXPORT void FUNCTION(igraph_matrix, scale)(TYPE(igraph_matrix) *m, BASE by); -IGRAPH_EXPORT void FUNCTION(igraph_matrix, add_constant)(TYPE(igraph_matrix) *m, BASE plus); - -/*-----------------------------*/ -/* Finding minimum and maximum */ -/*-----------------------------*/ - -#ifndef NOTORDERED -IGRAPH_EXPORT igraph_real_t FUNCTION(igraph_matrix, min)(const TYPE(igraph_matrix) *m); -IGRAPH_EXPORT igraph_real_t FUNCTION(igraph_matrix, max)(const TYPE(igraph_matrix) *m); -IGRAPH_EXPORT int FUNCTION(igraph_matrix, which_min)(const TYPE(igraph_matrix) *m, - long int *i, long int *j); -IGRAPH_EXPORT int FUNCTION(igraph_matrix, which_max)(const TYPE(igraph_matrix) *m, - long int *i, long int *j); -IGRAPH_EXPORT int FUNCTION(igraph_matrix, minmax)(const TYPE(igraph_matrix) *m, - BASE *min, BASE *max); -IGRAPH_EXPORT int FUNCTION(igraph_matrix, which_minmax)(const TYPE(igraph_matrix) *m, - long int *imin, long int *jmin, - long int *imax, long int *jmax); -#endif - -/*------------------------------*/ -/* Comparison */ -/*------------------------------*/ - -IGRAPH_EXPORT igraph_bool_t FUNCTION(igraph_matrix, all_e)(const TYPE(igraph_matrix) *lhs, - const TYPE(igraph_matrix) *rhs); -#ifndef NOTORDERED -IGRAPH_EXPORT igraph_bool_t FUNCTION(igraph_matrix, all_l)(const TYPE(igraph_matrix) *lhs, - const TYPE(igraph_matrix) *rhs); -IGRAPH_EXPORT igraph_bool_t FUNCTION(igraph_matrix, all_g)(const TYPE(igraph_matrix) *lhs, - const TYPE(igraph_matrix) *rhs); -IGRAPH_EXPORT igraph_bool_t FUNCTION(igraph_matrix, all_le)(const TYPE(igraph_matrix) *lhs, - const TYPE(igraph_matrix) *rhs); -IGRAPH_EXPORT igraph_bool_t FUNCTION(igraph_matrix, all_ge)(const TYPE(igraph_matrix) *lhs, - const TYPE(igraph_matrix) *rhs); -#endif - -/*-------------------*/ -/* Matrix properties */ -/*-------------------*/ - -IGRAPH_EXPORT igraph_bool_t FUNCTION(igraph_matrix, isnull)(const TYPE(igraph_matrix) *m); -IGRAPH_EXPORT igraph_bool_t FUNCTION(igraph_matrix, empty)(const TYPE(igraph_matrix) *m); -IGRAPH_EXPORT long int FUNCTION(igraph_matrix, size)(const TYPE(igraph_matrix) *m); -IGRAPH_EXPORT long int FUNCTION(igraph_matrix, nrow)(const TYPE(igraph_matrix) *m); -IGRAPH_EXPORT long int FUNCTION(igraph_matrix, ncol)(const TYPE(igraph_matrix) *m); -IGRAPH_EXPORT igraph_bool_t FUNCTION(igraph_matrix, is_symmetric)(const TYPE(igraph_matrix) *m); -IGRAPH_EXPORT BASE FUNCTION(igraph_matrix, sum)(const TYPE(igraph_matrix) *m); -IGRAPH_EXPORT BASE FUNCTION(igraph_matrix, prod)(const TYPE(igraph_matrix) *m); -IGRAPH_EXPORT int FUNCTION(igraph_matrix, rowsum)(const TYPE(igraph_matrix) *m, - TYPE(igraph_vector) *res); -IGRAPH_EXPORT int FUNCTION(igraph_matrix, colsum)(const TYPE(igraph_matrix) *m, - TYPE(igraph_vector) *res); -IGRAPH_EXPORT igraph_bool_t FUNCTION(igraph_matrix, is_equal)(const TYPE(igraph_matrix) *m1, - const TYPE(igraph_matrix) *m2); -#ifndef NOTORDERED -IGRAPH_EXPORT igraph_real_t FUNCTION(igraph_matrix, maxdifference)(const TYPE(igraph_matrix) *m1, - const TYPE(igraph_matrix) *m2); -#endif - -/*------------------------*/ -/* Searching for elements */ -/*------------------------*/ - -IGRAPH_EXPORT igraph_bool_t FUNCTION(igraph_matrix, contains)(const TYPE(igraph_matrix) *m, - BASE e); -IGRAPH_EXPORT igraph_bool_t FUNCTION(igraph_matrix, search)(const TYPE(igraph_matrix) *m, - long int from, BASE what, - long int *pos, - long int *row, long int *col); - -/*------------------------*/ -/* Resizing operations */ -/*------------------------*/ - -IGRAPH_EXPORT int FUNCTION(igraph_matrix, resize)(TYPE(igraph_matrix) *m, - long int nrow, long int ncol); -IGRAPH_EXPORT int FUNCTION(igraph_matrix, resize_min)(TYPE(igraph_matrix) *m); -IGRAPH_EXPORT int FUNCTION(igraph_matrix, add_cols)(TYPE(igraph_matrix) *m, long int n); -IGRAPH_EXPORT int FUNCTION(igraph_matrix, add_rows)(TYPE(igraph_matrix) *m, long int n); -IGRAPH_EXPORT int FUNCTION(igraph_matrix, remove_col)(TYPE(igraph_matrix) *m, long int col); -IGRAPH_EXPORT int FUNCTION(igraph_matrix, remove_row)(TYPE(igraph_matrix) *m, long int row); - -/*------------------------*/ -/* Print as text */ -/*------------------------*/ - -IGRAPH_EXPORT int FUNCTION(igraph_matrix, print)(const TYPE(igraph_matrix) *m); -IGRAPH_EXPORT int FUNCTION(igraph_matrix, printf)(const TYPE(igraph_matrix) *m, - const char *format); -IGRAPH_EXPORT int FUNCTION(igraph_matrix, fprint)(const TYPE(igraph_matrix) *m, - FILE *file); - -#ifdef BASE_COMPLEX - -IGRAPH_EXPORT int igraph_matrix_complex_real(const igraph_matrix_complex_t *v, - igraph_matrix_t *real); -IGRAPH_EXPORT int igraph_matrix_complex_imag(const igraph_matrix_complex_t *v, - igraph_matrix_t *imag); -IGRAPH_EXPORT int igraph_matrix_complex_realimag(const igraph_matrix_complex_t *v, - igraph_matrix_t *real, - igraph_matrix_t *imag); -IGRAPH_EXPORT int igraph_matrix_complex_create(igraph_matrix_complex_t *v, - const igraph_matrix_t *real, - const igraph_matrix_t *imag); -IGRAPH_EXPORT int igraph_matrix_complex_create_polar(igraph_matrix_complex_t *v, - const igraph_matrix_t *r, - const igraph_matrix_t *theta); - -#endif - -IGRAPH_EXPORT int FUNCTION(igraph_matrix, permdelete_rows)(TYPE(igraph_matrix) *m, - long int *index, long int nremove); -IGRAPH_EXPORT int FUNCTION(igraph_matrix, delete_rows_neg)(TYPE(igraph_matrix) *m, - const igraph_vector_t *neg, - long int nremove); diff --git a/src/include/igraph_memory.h b/src/include/igraph_memory.h deleted file mode 100644 index 98305722d0..0000000000 --- a/src/include/igraph_memory.h +++ /dev/null @@ -1,45 +0,0 @@ -/* -*- mode: C -*- */ -/* - IGraph library. - Copyright (C) 2003-2012 Gabor Csardi - 334 Harvard street, Cambridge, MA 02139 USA - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA - -*/ - -#ifndef IGRAPH_MEMORY_H -#define IGRAPH_MEMORY_H - -#include -#include "igraph_decls.h" - -__BEGIN_DECLS - -#define IGRAPH_CALLOC(n,t) (t*) calloc( (n) > 0 ? (size_t)(n) : (size_t)1, sizeof(t) ) -#define IGRAPH_REALLOC(p,n,t) (t*) realloc((void*)(p), (n) > 0 ? (size_t)((n)*sizeof(t)) : (size_t)1) -#define IGRAPH_FREE(p) (free( (void *)(p) ), (p) = NULL) - -#define igraph_Calloc IGRAPH_CALLOC -#define igraph_Realloc IGRAPH_REALLOC -#define igraph_Free IGRAPH_FREE - -IGRAPH_EXPORT void igraph_free(void *p); -IGRAPH_EXPORT void *igraph_malloc(size_t n); - -__END_DECLS - -#endif diff --git a/src/include/igraph_microscopic_update.h b/src/include/igraph_microscopic_update.h deleted file mode 100644 index 7432b71810..0000000000 --- a/src/include/igraph_microscopic_update.h +++ /dev/null @@ -1,60 +0,0 @@ -/* -*- mode: C -*- */ -/* - Microscopic update rules for dealing with agent-level strategy revision. - Copyright (C) 2011 Minh Van Nguyen - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA -*/ - -#ifndef IGRAPH_MICROSCOPIC_UPDATE_H -#define IGRAPH_MICROSCOPIC_UPDATE_H - -#include "igraph_decls.h" -#include "igraph_constants.h" -#include "igraph_datatype.h" -#include "igraph_iterators.h" -#include "igraph_types.h" -#include "igraph_vector.h" - -__BEGIN_DECLS - -IGRAPH_EXPORT int igraph_deterministic_optimal_imitation(const igraph_t *graph, - igraph_integer_t vid, - igraph_optimal_t optimality, - const igraph_vector_t *quantities, - igraph_vector_t *strategies, - igraph_neimode_t mode); -IGRAPH_EXPORT int igraph_moran_process(const igraph_t *graph, - const igraph_vector_t *weights, - igraph_vector_t *quantities, - igraph_vector_t *strategies, - igraph_neimode_t mode); -IGRAPH_EXPORT int igraph_roulette_wheel_imitation(const igraph_t *graph, - igraph_integer_t vid, - igraph_bool_t islocal, - const igraph_vector_t *quantities, - igraph_vector_t *strategies, - igraph_neimode_t mode); -IGRAPH_EXPORT int igraph_stochastic_imitation(const igraph_t *graph, - igraph_integer_t vid, - igraph_imitate_algorithm_t algo, - const igraph_vector_t *quantities, - igraph_vector_t *strategies, - igraph_neimode_t mode); - -__END_DECLS - -#endif diff --git a/src/include/igraph_mixing.h b/src/include/igraph_mixing.h deleted file mode 100644 index 5bc62eccd4..0000000000 --- a/src/include/igraph_mixing.h +++ /dev/null @@ -1,51 +0,0 @@ -/* -*- mode: C -*- */ -/* - IGraph library. - Copyright (C) 2009-2012 Gabor Csardi - 334 Harvard street, Cambridge, MA 02139 USA - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA - -*/ - -#ifndef IGRAPH_MIXING_H -#define IGRAPH_MIXING_H - -#include "igraph_decls.h" -#include "igraph_types.h" -#include "igraph_datatype.h" -#include "igraph_vector.h" - -__BEGIN_DECLS - -IGRAPH_EXPORT int igraph_assortativity_nominal(const igraph_t *graph, - const igraph_vector_t *types, - igraph_real_t *res, - igraph_bool_t directed); - -IGRAPH_EXPORT int igraph_assortativity(const igraph_t *graph, - const igraph_vector_t *types1, - const igraph_vector_t *types2, - igraph_real_t *res, - igraph_bool_t directed); - -IGRAPH_EXPORT int igraph_assortativity_degree(const igraph_t *graph, - igraph_real_t *res, - igraph_bool_t directed); - -__END_DECLS - -#endif diff --git a/src/include/igraph_motifs.h b/src/include/igraph_motifs.h deleted file mode 100644 index 7768ee17d8..0000000000 --- a/src/include/igraph_motifs.h +++ /dev/null @@ -1,97 +0,0 @@ -/* -*- mode: C -*- */ -/* - IGraph library. - Copyright (C) 2009-2012 Gabor Csardi - 334 Harvard street, Cambridge, MA 02139 USA - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA - -*/ - -#ifndef IGRAPH_MOTIFS_H -#define IGRAPH_MOTIFS_H - -#include "igraph_decls.h" -#include "igraph_types.h" -#include "igraph_datatype.h" -#include "igraph_iterators.h" - -__BEGIN_DECLS - -/* -------------------------------------------------- */ -/* Graph motifs */ -/* -------------------------------------------------- */ - -/** - * \typedef igraph_motifs_handler_t - * Callback type for \c igraph_motifs_randesu_callback - * - * \ref igraph_motifs_randesu_callback() calls a specified callback - * function whenever a new motif is found during a motif search. This - * callback function must be of type \c igraph_motifs_handler_t. It has - * the following arguments: - * \param graph The graph that that algorithm is working on. Of course - * this must not be modified. - * \param vids The IDs of the vertices in the motif that has just been - * found. This vector is owned by the motif search algorithm, so do not - * modify or destroy it; make a copy of it if you need it later. - * \param isoclass The isomorphism class of the motif that has just been - * found. Use \ref igraph_isoclass or \ref igraph_isoclass_subgraph to find - * out which isomorphism class belongs to a given motif. - * \param extra The extra argument that was passed to \ref - * igraph_motifs_randesu_callback(). - * \return A logical value, if TRUE (=non-zero), that is interpreted - * as a request to stop the motif search and return to the caller. - * - * \sa \ref igraph_motifs_randesu_callback() - */ - -typedef igraph_bool_t igraph_motifs_handler_t(const igraph_t *graph, - igraph_vector_t *vids, - int isoclass, - void* extra); - -IGRAPH_EXPORT int igraph_motifs_randesu(const igraph_t *graph, igraph_vector_t *hist, - int size, const igraph_vector_t *cut_prob); - -IGRAPH_EXPORT int igraph_motifs_randesu_callback(const igraph_t *graph, int size, - const igraph_vector_t *cut_prob, - igraph_motifs_handler_t *callback, - void* extra); - -IGRAPH_EXPORT int igraph_motifs_randesu_estimate(const igraph_t *graph, igraph_integer_t *est, - int size, const igraph_vector_t *cut_prob, - igraph_integer_t sample_size, - const igraph_vector_t *sample); -IGRAPH_EXPORT int igraph_motifs_randesu_no(const igraph_t *graph, igraph_integer_t *no, - int size, const igraph_vector_t *cut_prob); - -IGRAPH_EXPORT int igraph_dyad_census(const igraph_t *graph, igraph_integer_t *mut, - igraph_integer_t *asym, igraph_integer_t *null); -IGRAPH_EXPORT int igraph_triad_census(const igraph_t *igraph, igraph_vector_t *res); -IGRAPH_EXPORT int igraph_triad_census_24(const igraph_t *graph, igraph_real_t *res2, - igraph_real_t *res4); - -IGRAPH_EXPORT int igraph_adjacent_triangles(const igraph_t *graph, - igraph_vector_t *res, - const igraph_vs_t vids); - -IGRAPH_EXPORT int igraph_list_triangles(const igraph_t *graph, - igraph_vector_int_t *res); - -__END_DECLS - -#endif diff --git a/src/include/igraph_neighborhood.h b/src/include/igraph_neighborhood.h deleted file mode 100644 index 88a1c4ff19..0000000000 --- a/src/include/igraph_neighborhood.h +++ /dev/null @@ -1,47 +0,0 @@ -/* -*- mode: C -*- */ -/* - IGraph library. - Copyright (C) 2009-2012 Gabor Csardi - 334 Harvard street, Cambridge, MA 02139 USA - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA - -*/ - -#ifndef IGRAPH_NEIGHBORHOOD_H -#define IGRAPH_NEIGHBORHOOD_H - -#include "igraph_decls.h" -#include "igraph_datatype.h" -#include "igraph_iterators.h" -#include "igraph_vector_ptr.h" - -__BEGIN_DECLS - -IGRAPH_EXPORT int igraph_neighborhood_size(const igraph_t *graph, igraph_vector_t *res, - igraph_vs_t vids, igraph_integer_t order, - igraph_neimode_t mode, igraph_integer_t mindist); -IGRAPH_EXPORT int igraph_neighborhood(const igraph_t *graph, igraph_vector_ptr_t *res, - igraph_vs_t vids, igraph_integer_t order, - igraph_neimode_t mode, igraph_integer_t mindist); -IGRAPH_EXPORT int igraph_neighborhood_graphs(const igraph_t *graph, igraph_vector_ptr_t *res, - igraph_vs_t vids, igraph_integer_t order, - igraph_neimode_t mode, - igraph_integer_t mindist); - -__END_DECLS - -#endif diff --git a/src/include/igraph_nongraph.h b/src/include/igraph_nongraph.h deleted file mode 100644 index 47ebedb4a8..0000000000 --- a/src/include/igraph_nongraph.h +++ /dev/null @@ -1,92 +0,0 @@ -/* -*- mode: C -*- */ -/* - IGraph library. - Copyright (C) 2009-2012 Gabor Csardi - 334 Harvard street, Cambridge, MA 02139 USA - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA - -*/ - -#ifndef IGRAPH_NONGRAPH_H -#define IGRAPH_NONGRAPH_H - -#include "igraph_decls.h" -#include "igraph_constants.h" -#include "igraph_matrix.h" -#include "igraph_types.h" -#include "igraph_vector.h" - -__BEGIN_DECLS - -/* -------------------------------------------------- */ -/* Other, not graph related */ -/* -------------------------------------------------- */ - -/** - * \struct igraph_plfit_result_t - * \brief Result of fitting a power-law distribution to a vector - * - * This data structure contains the result of \ref igraph_power_law_fit(), - * which tries to fit a power-law distribution to a vector of numbers. The - * structure contains the following members: - * - * \member continuous Whether the fitted power-law distribution was continuous - * or discrete. - * \member alpha The exponent of the fitted power-law distribution. - * \member xmin The minimum value from which the power-law distribution was - * fitted. In other words, only the values larger than \c xmin - * were used from the input vector. - * \member L The log-likelihood of the fitted parameters; in other words, - * the probability of observing the input vector given the - * parameters. - * \member D The test statistic of a Kolmogorov-Smirnov test that compares - * the fitted distribution with the input vector. Smaller scores - * denote better fit. - * \member p The p-value of the Kolmogorov-Smirnov test. Small p-values - * (less than 0.05) indicate that the test rejected the hypothesis - * that the original data could have been drawn from the fitted - * power-law distribution. - */ -typedef struct igraph_plfit_result_t { - igraph_bool_t continuous; - double alpha; - double xmin; - double L; - double D; - double p; -} igraph_plfit_result_t; - -IGRAPH_EXPORT int igraph_running_mean(const igraph_vector_t *data, igraph_vector_t *res, - igraph_integer_t binwidth); -IGRAPH_EXPORT int igraph_random_sample(igraph_vector_t *res, igraph_real_t l, igraph_real_t h, - igraph_integer_t length); -IGRAPH_EXPORT int igraph_convex_hull(const igraph_matrix_t *data, igraph_vector_t *resverts, - igraph_matrix_t *rescoords); -IGRAPH_EXPORT int igraph_zeroin(igraph_real_t *ax, igraph_real_t *bx, - igraph_real_t (*f)(igraph_real_t x, void *info), - void *info, igraph_real_t *Tol, int *Maxit, igraph_real_t *res); -IGRAPH_EXPORT int igraph_bfgs(igraph_vector_t *b, igraph_real_t *Fmin, - igraph_scalar_function_t fminfn, igraph_vector_function_t fmingr, - int maxit, int trace, - igraph_real_t abstol, igraph_real_t reltol, int nREPORT, void *ex, - igraph_integer_t *fncount, igraph_integer_t *grcount); -IGRAPH_EXPORT int igraph_power_law_fit(const igraph_vector_t* vector, igraph_plfit_result_t* result, - igraph_real_t xmin, igraph_bool_t force_continuous); - -__END_DECLS - -#endif diff --git a/src/include/igraph_operators.h b/src/include/igraph_operators.h deleted file mode 100644 index 7992bdfe38..0000000000 --- a/src/include/igraph_operators.h +++ /dev/null @@ -1,88 +0,0 @@ -/* -*- mode: C -*- */ -/* - IGraph library. - Copyright (C) 2009-2012 Gabor Csardi - 334 Harvard street, Cambridge, MA 02139 USA - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA - -*/ - -#ifndef IGRAPH_OPERATORS_H -#define IGRAPH_OPERATORS_H - -#include "igraph_decls.h" -#include "igraph_attributes.h" -#include "igraph_constants.h" -#include "igraph_types.h" -#include "igraph_datatype.h" -#include "igraph_vector_ptr.h" - -__BEGIN_DECLS - -/* -------------------------------------------------- */ -/* Graph operators */ -/* -------------------------------------------------- */ - -IGRAPH_EXPORT int igraph_add_edge(igraph_t *graph, igraph_integer_t from, igraph_integer_t to); -IGRAPH_EXPORT int igraph_disjoint_union(igraph_t *res, - const igraph_t *left, const igraph_t *right); -IGRAPH_EXPORT int igraph_disjoint_union_many(igraph_t *res, - const igraph_vector_ptr_t *graphs); -IGRAPH_EXPORT int igraph_union(igraph_t *res, const igraph_t *left, const igraph_t *right, - igraph_vector_t *edge_map1, igraph_vector_t *edge_map2); -IGRAPH_EXPORT int igraph_union_many(igraph_t *res, const igraph_vector_ptr_t *graphs, - igraph_vector_ptr_t *edgemaps); -IGRAPH_EXPORT int igraph_intersection(igraph_t *res, - const igraph_t *left, const igraph_t *right, - igraph_vector_t *edge_map1, - igraph_vector_t *edge_map2); -IGRAPH_EXPORT int igraph_intersection_many(igraph_t *res, - const igraph_vector_ptr_t *graphs, - igraph_vector_ptr_t *edgemaps); -IGRAPH_EXPORT int igraph_difference(igraph_t *res, - const igraph_t *orig, const igraph_t *sub); -IGRAPH_EXPORT int igraph_complementer(igraph_t *res, const igraph_t *graph, - igraph_bool_t loops); -IGRAPH_EXPORT int igraph_compose(igraph_t *res, const igraph_t *g1, const igraph_t *g2, - igraph_vector_t *edge_map1, igraph_vector_t *edge_map2); -IGRAPH_EXPORT int igraph_contract_vertices(igraph_t *graph, - const igraph_vector_t *mapping, - const igraph_attribute_combination_t - *vertex_comb); -IGRAPH_EXPORT int igraph_permute_vertices(const igraph_t *graph, igraph_t *res, - const igraph_vector_t *permutation); -IGRAPH_EXPORT int igraph_connect_neighborhood(igraph_t *graph, igraph_integer_t order, - igraph_neimode_t mode); -IGRAPH_EXPORT int igraph_rewire(igraph_t *graph, - igraph_integer_t n, igraph_rewiring_t mode); -IGRAPH_EXPORT int igraph_simplify(igraph_t *graph, igraph_bool_t multiple, - igraph_bool_t loops, - const igraph_attribute_combination_t *edge_comb); -IGRAPH_EXPORT int igraph_induced_subgraph_map(const igraph_t *graph, igraph_t *res, - const igraph_vs_t vids, - igraph_subgraph_implementation_t impl, - igraph_vector_t *map, - igraph_vector_t *invmap); -IGRAPH_EXPORT int igraph_induced_subgraph(const igraph_t *graph, igraph_t *res, - const igraph_vs_t vids, igraph_subgraph_implementation_t impl); -IGRAPH_EXPORT int igraph_subgraph_edges(const igraph_t *graph, igraph_t *res, - const igraph_es_t eids, igraph_bool_t delete_vertices); -IGRAPH_EXPORT int igraph_reverse_edges(igraph_t *graph, const igraph_es_t eids); - -__END_DECLS - -#endif diff --git a/src/include/igraph_paths.h b/src/include/igraph_paths.h deleted file mode 100644 index 067449d151..0000000000 --- a/src/include/igraph_paths.h +++ /dev/null @@ -1,176 +0,0 @@ -/* -*- mode: C -*- */ -/* - IGraph library. - Copyright (C) 2009-2021 The igraph development team - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA -*/ - -#ifndef IGRAPH_PATHS_H -#define IGRAPH_PATHS_H - -#include "igraph_decls.h" -#include "igraph_constants.h" -#include "igraph_types.h" -#include "igraph_vector.h" -#include "igraph_vector_ptr.h" -#include "igraph_matrix.h" -#include "igraph_iterators.h" - -__BEGIN_DECLS - -IGRAPH_EXPORT int igraph_diameter(const igraph_t *graph, igraph_real_t *res, - igraph_integer_t *from, igraph_integer_t *to, - igraph_vector_t *path, - igraph_bool_t directed, igraph_bool_t unconn); -IGRAPH_EXPORT int igraph_diameter_dijkstra(const igraph_t *graph, - const igraph_vector_t *weights, - igraph_real_t *pres, - igraph_integer_t *pfrom, - igraph_integer_t *pto, - igraph_vector_t *path, - igraph_bool_t directed, - igraph_bool_t unconn); - -IGRAPH_EXPORT int igraph_shortest_paths(const igraph_t *graph, igraph_matrix_t *res, - const igraph_vs_t from, const igraph_vs_t to, - igraph_neimode_t mode); -IGRAPH_EXPORT int igraph_get_shortest_paths(const igraph_t *graph, - igraph_vector_ptr_t *vertices, - igraph_vector_ptr_t *edges, - igraph_integer_t from, const igraph_vs_t to, - igraph_neimode_t mode, - igraph_vector_long_t *predecessors, - igraph_vector_long_t *inbound_edges); -IGRAPH_EXPORT int igraph_get_shortest_path(const igraph_t *graph, - igraph_vector_t *vertices, - igraph_vector_t *edges, - igraph_integer_t from, - igraph_integer_t to, - igraph_neimode_t mode); - -IGRAPH_EXPORT int igraph_get_all_shortest_paths(const igraph_t *graph, - igraph_vector_ptr_t *res, - igraph_vector_t *nrgeo, - igraph_integer_t from, const igraph_vs_t to, - igraph_neimode_t mode); -IGRAPH_EXPORT int igraph_shortest_paths_dijkstra(const igraph_t *graph, - igraph_matrix_t *res, - const igraph_vs_t from, - const igraph_vs_t to, - const igraph_vector_t *weights, - igraph_neimode_t mode); -IGRAPH_EXPORT int igraph_shortest_paths_bellman_ford(const igraph_t *graph, - igraph_matrix_t *res, - const igraph_vs_t from, - const igraph_vs_t to, - const igraph_vector_t *weights, - igraph_neimode_t mode); -IGRAPH_EXPORT int igraph_get_shortest_path_bellman_ford(const igraph_t *graph, - igraph_vector_t *vertices, - igraph_vector_t *edges, - igraph_integer_t from, - igraph_integer_t to, - const igraph_vector_t *weights, - igraph_neimode_t mode); -IGRAPH_EXPORT int igraph_get_shortest_paths_dijkstra(const igraph_t *graph, - igraph_vector_ptr_t *vertices, - igraph_vector_ptr_t *edges, - igraph_integer_t from, - igraph_vs_t to, - const igraph_vector_t *weights, - igraph_neimode_t mode, - igraph_vector_long_t *predecessors, - igraph_vector_long_t *inbound_edges); -IGRAPH_EXPORT int igraph_get_shortest_paths_bellman_ford(const igraph_t *graph, - igraph_vector_ptr_t *vertices, - igraph_vector_ptr_t *edges, - igraph_integer_t from, - igraph_vs_t to, - const igraph_vector_t *weights, - igraph_neimode_t mode, - igraph_vector_long_t *predecessors, - igraph_vector_long_t *inbound_edges); -IGRAPH_EXPORT int igraph_get_shortest_path_dijkstra(const igraph_t *graph, - igraph_vector_t *vertices, - igraph_vector_t *edges, - igraph_integer_t from, - igraph_integer_t to, - const igraph_vector_t *weights, - igraph_neimode_t mode); -IGRAPH_EXPORT int igraph_get_all_shortest_paths_dijkstra(const igraph_t *graph, - igraph_vector_ptr_t *res, - igraph_vector_t *nrgeo, - igraph_integer_t from, igraph_vs_t to, - const igraph_vector_t *weights, - igraph_neimode_t mode); -IGRAPH_EXPORT int igraph_shortest_paths_johnson(const igraph_t *graph, - igraph_matrix_t *res, - const igraph_vs_t from, - const igraph_vs_t to, - const igraph_vector_t *weights); - -IGRAPH_EXPORT int igraph_average_path_length(const igraph_t *graph, - igraph_real_t *res, igraph_real_t *unconn_pairs, - igraph_bool_t directed, igraph_bool_t unconn); -IGRAPH_EXPORT int igraph_average_path_length_dijkstra(const igraph_t *graph, - igraph_real_t *res, igraph_real_t *unconn_pairs, - const igraph_vector_t *weights, - igraph_bool_t directed, igraph_bool_t unconn); -IGRAPH_EXPORT int igraph_path_length_hist(const igraph_t *graph, igraph_vector_t *res, - igraph_real_t *unconnected, igraph_bool_t directed); - -IGRAPH_EXPORT int igraph_global_efficiency(const igraph_t *graph, igraph_real_t *res, - const igraph_vector_t *weights, - igraph_bool_t directed); -IGRAPH_EXPORT int igraph_local_efficiency(const igraph_t *graph, igraph_vector_t *res, - const igraph_vs_t vids, - const igraph_vector_t *weights, - igraph_bool_t directed, igraph_neimode_t mode); -IGRAPH_EXPORT int igraph_average_local_efficiency(const igraph_t *graph, igraph_real_t *res, - const igraph_vector_t *weights, - igraph_bool_t directed, igraph_neimode_t mode); - -IGRAPH_EXPORT int igraph_eccentricity(const igraph_t *graph, - igraph_vector_t *res, - igraph_vs_t vids, - igraph_neimode_t mode); - -IGRAPH_EXPORT int igraph_radius(const igraph_t *graph, igraph_real_t *radius, - igraph_neimode_t mode); - -IGRAPH_EXPORT int igraph_get_all_simple_paths(const igraph_t *graph, - igraph_vector_int_t *res, - igraph_integer_t from, - const igraph_vs_t to, - igraph_integer_t cutoff, - igraph_neimode_t mode); - -IGRAPH_EXPORT int igraph_random_walk(const igraph_t *graph, igraph_vector_t *walk, - igraph_integer_t start, igraph_neimode_t mode, - igraph_integer_t steps, - igraph_random_walk_stuck_t stuck); - -IGRAPH_EXPORT int igraph_random_edge_walk(const igraph_t *graph, - const igraph_vector_t *weights, - igraph_vector_t *edgewalk, - igraph_integer_t start, igraph_neimode_t mode, - igraph_integer_t steps, - igraph_random_walk_stuck_t stuck); - -__END_DECLS - -#endif diff --git a/src/include/igraph_pmt.h b/src/include/igraph_pmt.h deleted file mode 100644 index ab810d6bcf..0000000000 --- a/src/include/igraph_pmt.h +++ /dev/null @@ -1,144 +0,0 @@ -/* -*- mode: C -*- */ -/* - IGraph library. - Copyright (C) 2007-2012 Gabor Csardi - 334 Harvard street, Cambridge, MA 02139 USA - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA - -*/ - -#define CONCAT2x(a,b) a ## _ ## b -#define CONCAT2(a,b) CONCAT2x(a,b) -#define CONCAT3x(a,b,c) a ## _ ## b ## _ ## c -#define CONCAT3(a,b,c) CONCAT3x(a,b,c) -#define CONCAT4x(a,b,c,d) a ## _ ## b ## _ ## c ## _ ## d -#define CONCAT4(a,b,c,d) CONCAT4x(a,b,c,d) - -#if defined(BASE_IGRAPH_REAL) - #define BASE igraph_real_t - #define SHORT - #define OUT_FORMAT "%G" - #define PRINTFUNC(val) igraph_real_printf(val) - #define FPRINTFUNC(file, val) igraph_real_fprintf(file, val) - #define ZERO 0.0 - #define ONE 1.0 - #define MULTIPLICITY 1 - -#elif defined(BASE_FLOAT) - #define BASE float - #define SHORT float - #define OUT_FORMAT "%f" - #define ZERO 0.0F - #define ONE 1.0F - #define MULTIPLICITY 1 - -#elif defined(BASE_LONG) - #define BASE long - #define SHORT long - #define OUT_FORMAT "%ld" - #define ZERO 0L - #define ONE 1L - #define MULTIPLICITY 1 - -#elif defined(BASE_CHAR) - #define BASE char - #define SHORT char - #define OUT_FORMAT "%d" - #define ZERO 0 - #define ONE 1 - #define MULTIPLICITY 1 - -#elif defined(BASE_BOOL) - #define BASE igraph_bool_t - #define SHORT bool - #define OUT_FORMAT "%d" - #define ZERO 0 - #define ONE 1 - #define MULTIPLICITY 1 - #define NOTORDERED 1 - #define NOABS 1 - #define EQ(a,b) ((a && b) || (!a && !b)) - -#elif defined(BASE_INT) - #define BASE igraph_integer_t - #define SHORT int - #define OUT_FORMAT "%" IGRAPH_PRId - #define ZERO 0 - #define ONE 1 - #define MULTIPLICITY 1 - -#elif defined(BASE_PTR) - #define BASE void* - #define SHORT ptr - #define ZERO 0 - #define MULTIPLICITY 1 - -#elif defined(BASE_COMPLEX) - #undef complex - #define BASE igraph_complex_t - #define SHORT complex - #define ZERO igraph_complex(0,0) - #define ONE {{1.0,0.0}} - #define MULTIPLICITY 2 - #define NOTORDERED 1 - #define NOABS 1 - #define SUM(a,b,c) ((a) = igraph_complex_add((b),(c))) - #define DIFF(a,b,c) ((a) = igraph_complex_sub((b),(c))) - #define PROD(a,b,c) ((a) = igraph_complex_mul((b),(c))) - #define DIV(a,b,c) ((a) = igraph_complex_div((b),(c))) - #define EQ(a,b) IGRAPH_COMPLEX_EQ((a),(b)) - #define SQ(a) IGRAPH_REAL(igraph_complex_mul((a),(a))) - -#else - #error unknown BASE_ directive -#endif - -#if defined(BASE_IGRAPH_REAL) - #define FUNCTION(dir,name) CONCAT2(dir,name) - #define TYPE(dir) CONCAT2(dir,t) -#elif defined(BASE_BOOL) - /* Special case because stdbool.h defines bool as a macro to _Bool which would - * screw things up */ - #define FUNCTION(a,c) CONCAT3x(a,bool,c) - #define TYPE(dir) CONCAT3x(dir,bool,t) -#else - #define FUNCTION(a,c) CONCAT3(a,SHORT,c) - #define TYPE(dir) CONCAT3(dir,SHORT,t) -#endif - -#if defined(HEAP_TYPE_MIN) - #define HEAPMORE < - #define HEAPMOREEQ <= - #define HEAPLESS > - #define HEAPLESSEQ >= - #undef FUNCTION - #undef TYPE - #if defined(BASE_IGRAPH_REAL) - #define FUNCTION(dir,name) CONCAT3(dir,min,name) - #define TYPE(dir) CONCAT3(dir,min,t) - #else - #define FUNCTION(a,c) CONCAT4(a,min,SHORT,c) - #define TYPE(dir) CONCAT4(dir,min,SHORT,t) - #endif -#endif - -#if defined(HEAP_TYPE_MAX) - #define HEAPMORE > - #define HEAPMOREEQ >= - #define HEAPLESS < - #define HEAPLESSEQ <= -#endif diff --git a/src/include/igraph_pmt_off.h b/src/include/igraph_pmt_off.h deleted file mode 100644 index 95a957e7fe..0000000000 --- a/src/include/igraph_pmt_off.h +++ /dev/null @@ -1,158 +0,0 @@ -/* -*- mode: C -*- */ -/* - IGraph library. - Copyright (C) 2007-2012 Gabor Csardi - 334 Harvard street, Cambridge, MA 02139 USA - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA - -*/ - -#ifdef ATOMIC - #undef ATOMIC -#endif - -#ifdef ATOMIC_IO - #undef ATOMIC_IO -#endif - -#ifdef BASE - #undef BASE -#endif - -#ifdef BASE_EPSILON - #undef BASE_EPSILON -#endif - -#ifdef CONCAT2 - #undef CONCAT2 -#endif - -#ifdef CONCAT2x - #undef CONCAT2x -#endif - -#ifdef CONCAT3 - #undef CONCAT3 -#endif - -#ifdef CONCAT3x - #undef CONCAT3x -#endif - -#ifdef CONCAT4 - #undef CONCAT4 -#endif - -#ifdef CONCAT4x - #undef CONCAT4x -#endif - -#ifdef FP - #undef FP -#endif - -#ifdef FUNCTION - #undef FUNCTION -#endif - -#ifdef IN_FORMAT - #undef IN_FORMAT -#endif - -#ifdef MULTIPLICITY - #undef MULTIPLICITY -#endif - -#ifdef ONE - #undef ONE -#endif - -#ifdef OUT_FORMAT - #undef OUT_FORMAT -#endif - -#ifdef SHORT - #undef SHORT -#endif - -#ifdef TYPE - #undef TYPE -#endif - -#ifdef ZERO - #undef ZERO -#endif - -#ifdef HEAPMORE - #undef HEAPMORE -#endif - -#ifdef HEAPLESS - #undef HEAPLESS -#endif - -#ifdef HEAPMOREEQ - #undef HEAPMOREEQ -#endif - -#ifdef HEAPLESSEQ - #undef HEAPLESSEQ -#endif - -#ifdef SUM - #undef SUM -#endif - -#ifdef SQ - #undef SQ -#endif - -#ifdef PROD - #undef PROD -#endif - -#ifdef NOTORDERED - #undef NOTORDERED -#endif - -#ifdef EQ - #undef EQ -#endif - -#ifdef DIFF - #undef DIFF -#endif - -#ifdef DIV - #undef DIV -#endif - -#ifdef NOABS - #undef NOABS -#endif - -#ifdef PRINTFUNC - #undef PRINTFUNC -#endif - -#ifdef FPRINTFUNC - #undef PRINTFUNC -#endif - -#ifdef UNSIGNED - #undef UNSIGNED -#endif diff --git a/src/include/igraph_progress.h b/src/include/igraph_progress.h deleted file mode 100644 index f7a0f25e1d..0000000000 --- a/src/include/igraph_progress.h +++ /dev/null @@ -1,183 +0,0 @@ -/* -*- mode: C -*- */ -/* - IGraph library. - Copyright (C) 2009-2012 Gabor Csardi - 334 Harvard street, Cambridge, MA 02139 USA - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA - -*/ - -#ifndef IGRAPH_PROGRESS_H -#define IGRAPH_PROGRESS_H - -#include "igraph_decls.h" -#include "igraph_types.h" - -__BEGIN_DECLS - -/** - * \section about_progress_handlers About progress handlers - * - * It is often useful to report the progress of some long - * calculation, to allow the user to follow the computation and - * guess the total running time. A couple of igraph functions - * support this at the time of writing, hopefully more will support it - * in the future. - * - * - * - * To see the progress of a computation, the user has to install a - * progress handler, as there is none installed by default. - * If an igraph function supports progress reporting, then it - * calls the installed progress handler periodically, and passes a - * percentage value to it, the percentage of computation already - * performed. To install a progress handler, you need to call - * \ref igraph_set_progress_handler(). Currently there is a single - * pre-defined progress handler, called \ref - * igraph_progress_handler_stderr(). - * - */ - -/** - * \section writing_progress_handlers Writing progress handlers - * - * - * To write a new progress handler, one needs to create a function of - * type \ref igraph_progress_handler_t. The new progress handler - * can then be installed with the \ref igraph_set_progress_handler() - * function. - * - * - * - * One can assume that the first progress handler call from a - * calculation will be call with zero as the \p percentage argument, - * and the last call from a function will have 100 as the \p - * percentage argument. Note, however, that if an error happens in the - * middle of a computation, then the 100 percent call might be - * omitted. - * - */ - -/** - * \section igraph_functions_with_progress Writing igraph functions with progress reporting - * - * - * If you want to write a function that uses igraph and supports - * progress reporting, you need to include \ref igraph_progress() - * calls in your function, usually via the \ref IGRAPH_PROGRESS() - * macro. - * - * - * - * It is good practice to always include a call to \ref - * igraph_progress() with a zero \p percentage argument, before the - * computation; and another call with 100 \p percentage value - * after the computation is completed. - * - * - * - * It is also good practice \em not to call \ref igraph_progress() too - * often, as this would slow down the computation. It might not be - * worth to support progress reporting in functions with linear or - * log-linear time complexity, as these are fast, even with a large - * amount of data. For functions with quadratic or higher time - * complexity make sure that the time complexity of the progress - * reporting is constant or at least linear. In practice this means - * having at most O(n) progress checks and at most 100 - * \ref igraph_progress() calls. - * - */ - -/** - * \section progress_and_threads Multi-threaded programs - * - * - * In multi-threaded programs, each thread has its own progress - * handler, if thread-local storage is supported and igraph is - * thread-safe. See the \ref IGRAPH_THREAD_SAFE macro for checking - * whether an igraph build is thread-safe. - * - */ - -/* -------------------------------------------------- */ -/* Progress handlers */ -/* -------------------------------------------------- */ - -/** - * \typedef igraph_progress_handler_t - * \brief Type of progress handler functions - * - * This is the type of the igraph progress handler functions. - * There is currently one such predefined function, - * \ref igraph_progress_handler_stderr(), but the user can - * write and set up more sophisticated ones. - * \param message A string describing the function or algorithm - * that is reporting the progress. Current igraph functions - * always use the name \p message argument if reporting from the - * same function. - * \param percent Numeric, the percentage that was completed by the - * algorithm or function. - * \param data User-defined data. Current igraph functions that - * report progress pass a null pointer here. Users can - * write their own progress handlers and functions with progress - * reporting, and then pass some meaningfull context here. - * \return If the return value of the progress handler is not - * \c IGRAPH_SUCCESS, then \ref igraph_progress() returns the - * error code \c IGRAPH_INTERRUPTED. The \ref IGRAPH_PROGRESS() - * macro frees all memory and finishes the igraph function with - * error code \c IGRAPH_INTERRUPTED in this case. - */ - -typedef int igraph_progress_handler_t(const char *message, igraph_real_t percent, - void *data); - -IGRAPH_EXPORT extern igraph_progress_handler_t igraph_progress_handler_stderr; - -IGRAPH_EXPORT igraph_progress_handler_t * igraph_set_progress_handler(igraph_progress_handler_t new_handler); - -IGRAPH_EXPORT int igraph_progress(const char *message, igraph_real_t percent, void *data); - -IGRAPH_EXPORT int igraph_progressf(const char *message, igraph_real_t percent, void *data, - ...); - -/** - * \define IGRAPH_PROGRESS - * \brief Report progress. - * - * The standard way to report progress from an igraph function - * \param message A string, a textual message that references the - * calculation under progress. - * \param percent Numeric scalar, the percentage that is complete. - * \param data User-defined data, this can be used in user-defined - * progress handler functions, from user-written igraph functions. - * \return If the progress handler returns with \c IGRAPH_INTERRUPTED, - * then this macro frees up the igraph allocated memory for - * temporary data and returns to the caller with \c - * IGRAPH_INTERRUPTED. - */ - -#define IGRAPH_PROGRESS(message, percent, data) \ - do { \ - if (igraph_progress((message), (percent), (data)) != IGRAPH_SUCCESS) { \ - IGRAPH_FINALLY_FREE(); \ - return IGRAPH_INTERRUPTED; \ - } \ - } while (0) - -__END_DECLS - -#endif diff --git a/src/include/igraph_psumtree.h b/src/include/igraph_psumtree.h deleted file mode 100644 index c27d576467..0000000000 --- a/src/include/igraph_psumtree.h +++ /dev/null @@ -1,51 +0,0 @@ -/* -*- mode: C -*- */ -/* - IGraph library. - Copyright (C) 2009-2012 Gabor Csardi - 334 Harvard street, Cambridge, MA 02139 USA - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA - -*/ - -#ifndef IGRAPH_PSUMTREE_H -#define IGRAPH_PSUMTREE_H - -#include "igraph_decls.h" -#include "igraph_vector.h" - -__BEGIN_DECLS - -typedef struct { - igraph_vector_t v; - long int size; - long int offset; -} igraph_psumtree_t; - -IGRAPH_EXPORT int igraph_psumtree_init(igraph_psumtree_t *t, long int size); -IGRAPH_EXPORT void igraph_psumtree_reset(igraph_psumtree_t *t); -IGRAPH_EXPORT void igraph_psumtree_destroy(igraph_psumtree_t *t); -IGRAPH_EXPORT igraph_real_t igraph_psumtree_get(const igraph_psumtree_t *t, long int idx); -IGRAPH_EXPORT long int igraph_psumtree_size(const igraph_psumtree_t *t); -IGRAPH_EXPORT int igraph_psumtree_search(const igraph_psumtree_t *t, long int *idx, - igraph_real_t elem); -IGRAPH_EXPORT int igraph_psumtree_update(igraph_psumtree_t *t, long int idx, - igraph_real_t new_value); -IGRAPH_EXPORT igraph_real_t igraph_psumtree_sum(const igraph_psumtree_t *t); - -__END_DECLS - -#endif diff --git a/src/include/igraph_qsort.h b/src/include/igraph_qsort.h deleted file mode 100644 index 94e5e7f677..0000000000 --- a/src/include/igraph_qsort.h +++ /dev/null @@ -1,40 +0,0 @@ -/* -*- mode: C -*- */ -/* - IGraph library. - Copyright (C) 2011-2012 Gabor Csardi - 334 Harvard st, Cambridge, MA 02139, USA - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA - -*/ - -#ifndef IGRAPH_QSORT_H -#define IGRAPH_QSORT_H - -#include "igraph_decls.h" - -#include - -__BEGIN_DECLS - -IGRAPH_EXPORT void igraph_qsort(void *base, size_t nel, size_t width, - int (*compar)(const void *, const void *)); -IGRAPH_EXPORT void igraph_qsort_r(void *base, size_t nel, size_t width, void *thunk, - int (*compar)(void *, const void *, const void *)); - -__END_DECLS - -#endif diff --git a/src/include/igraph_random.h b/src/include/igraph_random.h deleted file mode 100644 index cbdb5c3236..0000000000 --- a/src/include/igraph_random.h +++ /dev/null @@ -1,134 +0,0 @@ -/* -*- mode: C -*- */ -/* - IGraph library. - Copyright (C) 2003-2012 Gabor Csardi - 334 Harvard street, Cambridge, MA 02139 USA - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA - -*/ - -#ifndef IGRAPH_RANDOM_H -#define IGRAPH_RANDOM_H - -#include "igraph_decls.h" - -__BEGIN_DECLS - -#include -#include - -#include "igraph_types.h" -#include "igraph_vector.h" - -/* The new RNG interface is (somewhat) modelled based on the GSL */ - -typedef struct igraph_rng_type_t { - const char *name; - unsigned long int min; /* 'min' must always be set to 0 */ - unsigned long int max; - int (*init)(void **state); - void (*destroy)(void *state); - int (*seed)(void *state, unsigned long int seed); - unsigned long int (*get)(void *state); - igraph_real_t (*get_real)(void *state); - igraph_real_t (*get_norm)(void *state); - igraph_real_t (*get_geom)(void *state, igraph_real_t p); - igraph_real_t (*get_binom)(void *state, long int n, igraph_real_t p); - igraph_real_t (*get_exp)(void *state, igraph_real_t rate); - igraph_real_t (*get_gamma)(void *state, igraph_real_t shape, - igraph_real_t scale); -} igraph_rng_type_t; - -typedef struct igraph_rng_t { - const igraph_rng_type_t *type; - void *state; - int def; -} igraph_rng_t; - -/* --------------------------------- */ - -IGRAPH_EXPORT int igraph_rng_init(igraph_rng_t *rng, const igraph_rng_type_t *type); -IGRAPH_EXPORT void igraph_rng_destroy(igraph_rng_t *rng); - -IGRAPH_EXPORT int igraph_rng_seed(igraph_rng_t *rng, unsigned long int seed); -IGRAPH_EXPORT unsigned long int igraph_rng_max(igraph_rng_t *rng); -IGRAPH_EXPORT IGRAPH_DEPRECATED unsigned long int igraph_rng_min(igraph_rng_t *rng); -IGRAPH_EXPORT const char *igraph_rng_name(igraph_rng_t *rng); - -IGRAPH_EXPORT long int igraph_rng_get_integer(igraph_rng_t *rng, - long int l, long int h); -IGRAPH_EXPORT igraph_real_t igraph_rng_get_normal(igraph_rng_t *rng, - igraph_real_t m, igraph_real_t s); -IGRAPH_EXPORT igraph_real_t igraph_rng_get_unif(igraph_rng_t *rng, - igraph_real_t l, igraph_real_t h); -IGRAPH_EXPORT igraph_real_t igraph_rng_get_unif01(igraph_rng_t *rng); -IGRAPH_EXPORT igraph_real_t igraph_rng_get_geom(igraph_rng_t *rng, igraph_real_t p); -IGRAPH_EXPORT igraph_real_t igraph_rng_get_binom(igraph_rng_t *rng, long int n, - igraph_real_t p); -IGRAPH_EXPORT igraph_real_t igraph_rng_get_exp(igraph_rng_t *rng, igraph_real_t rate); -IGRAPH_EXPORT unsigned long int igraph_rng_get_int31(igraph_rng_t *rng); -IGRAPH_EXPORT igraph_real_t igraph_rng_get_gamma(igraph_rng_t *rng, igraph_real_t shape, - igraph_real_t scale); -IGRAPH_EXPORT int igraph_rng_get_dirichlet(igraph_rng_t *rng, - const igraph_vector_t *alpha, - igraph_vector_t *result); - -/* --------------------------------- */ - -IGRAPH_EXPORT extern const igraph_rng_type_t igraph_rngtype_glibc2; -IGRAPH_EXPORT extern const igraph_rng_type_t igraph_rngtype_rand; -IGRAPH_EXPORT extern const igraph_rng_type_t igraph_rngtype_mt19937; - -IGRAPH_EXPORT igraph_rng_t *igraph_rng_default(void); -IGRAPH_EXPORT void igraph_rng_set_default(igraph_rng_t *rng); - -/* --------------------------------- */ - -#ifdef USING_R - -void GetRNGstate(void); -void PutRNGstate(void); -#define RNG_BEGIN() GetRNGstate() -#define RNG_END() PutRNGstate() - -double Rf_dnorm4(double x, double mu, double sigma, int give_log); -#define igraph_dnorm Rf_dnorm4 - -#else - -#define RNG_BEGIN() \ - if (igraph_rng_default()->def == 1) { \ - igraph_rng_seed(igraph_rng_default(), time(0)); \ - igraph_rng_default()->def=2; \ - } -#define RNG_END() /* do nothing */ - -IGRAPH_EXPORT double igraph_dnorm(double x, double mu, double sigma, int give_log); - -#endif - -#define RNG_INTEGER(l,h) (igraph_rng_get_integer(igraph_rng_default(),(l),(h))) -#define RNG_NORMAL(m,s) (igraph_rng_get_normal(igraph_rng_default(),(m),(s))) -#define RNG_UNIF(l,h) (igraph_rng_get_unif(igraph_rng_default(),(l),(h))) -#define RNG_UNIF01() (igraph_rng_get_unif01(igraph_rng_default())) -#define RNG_GEOM(p) (igraph_rng_get_geom(igraph_rng_default(),(p))) -#define RNG_BINOM(n,p) (igraph_rng_get_binom(igraph_rng_default(),(n),(p))) -#define RNG_INT31() (igraph_rng_get_int31(igraph_rng_default())) - -__END_DECLS - -#endif diff --git a/src/include/igraph_scan.h b/src/include/igraph_scan.h deleted file mode 100644 index 0b1480f186..0000000000 --- a/src/include/igraph_scan.h +++ /dev/null @@ -1,69 +0,0 @@ -/* -*- mode: C -*- */ -/* - IGraph library. - Copyright (C) 2013 Gabor Csardi - 334 Harvard street, Cambridge, MA 02139 USA - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA - -*/ - -#ifndef IGRAPH_SCAN_H -#define IGRAPH_SCAN_H - -#include "igraph_decls.h" -#include "igraph_datatype.h" -#include "igraph_arpack.h" -#include "igraph_constants.h" -#include "igraph_vector_ptr.h" - -__BEGIN_DECLS - -IGRAPH_EXPORT int igraph_local_scan_0(const igraph_t *graph, igraph_vector_t *res, - const igraph_vector_t *weights, igraph_neimode_t mode); - -IGRAPH_EXPORT int igraph_local_scan_0_them(const igraph_t *us, const igraph_t *them, - igraph_vector_t *res, - const igraph_vector_t *weigths_them, - igraph_neimode_t mode); - -IGRAPH_EXPORT int igraph_local_scan_1_ecount(const igraph_t *graph, igraph_vector_t *res, - const igraph_vector_t *weights, - igraph_neimode_t mode); - -IGRAPH_EXPORT int igraph_local_scan_1_ecount_them(const igraph_t *us, const igraph_t *them, - igraph_vector_t *res, - const igraph_vector_t *weights, - igraph_neimode_t mode); - -IGRAPH_EXPORT int igraph_local_scan_k_ecount(const igraph_t *graph, int k, - igraph_vector_t *res, - const igraph_vector_t *weights, - igraph_neimode_t mode); - -IGRAPH_EXPORT int igraph_local_scan_k_ecount_them(const igraph_t *us, const igraph_t *them, - int k, igraph_vector_t *res, - const igraph_vector_t *weights_them, - igraph_neimode_t mode); - -IGRAPH_EXPORT int igraph_local_scan_neighborhood_ecount(const igraph_t *graph, - igraph_vector_t *res, - const igraph_vector_t *weights, - const igraph_vector_ptr_t *neighborhoods); - -__END_DECLS - -#endif diff --git a/src/include/igraph_scg.h b/src/include/igraph_scg.h deleted file mode 100644 index 7b466a4249..0000000000 --- a/src/include/igraph_scg.h +++ /dev/null @@ -1,143 +0,0 @@ -/* -*- mode: C -*- */ -/* - IGraph library. - Copyright (C) 2011-2012 Gabor Csardi - 334 Harvard st, Cambridge, MA, 02138 USA - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA - -*/ - -#ifndef IGRAPH_SCG_H -#define IGRAPH_SCG_H - -#include "igraph_decls.h" -#include "igraph_types.h" -#include "igraph_vector.h" -#include "igraph_matrix.h" -#include "igraph_sparsemat.h" - -__BEGIN_DECLS - -typedef enum { IGRAPH_SCG_SYMMETRIC = 1, IGRAPH_SCG_LAPLACIAN = 2, - IGRAPH_SCG_STOCHASTIC = 3 - } igraph_scg_matrix_t; - -typedef enum { IGRAPH_SCG_OPTIMUM = 1, IGRAPH_SCG_INTERV_KM = 2, - IGRAPH_SCG_INTERV = 3, IGRAPH_SCG_EXACT = 4 - } -igraph_scg_algorithm_t; - -typedef enum { IGRAPH_SCG_NORM_ROW = 1, IGRAPH_SCG_NORM_COL = 2 } -igraph_scg_norm_t; - -typedef enum { IGRAPH_SCG_DIRECTION_DEFAULT = 1, - IGRAPH_SCG_DIRECTION_LEFT = 2, - IGRAPH_SCG_DIRECTION_RIGHT = 3 - } igraph_scg_direction_t; - -IGRAPH_EXPORT int igraph_scg_grouping(const igraph_matrix_t *V, - igraph_vector_t *groups, - igraph_integer_t nt, - const igraph_vector_t *nt_vec, - igraph_scg_matrix_t mtype, - igraph_scg_algorithm_t algo, - const igraph_vector_t *p, - igraph_integer_t maxiter); - -IGRAPH_EXPORT int igraph_scg_semiprojectors(const igraph_vector_t *groups, - igraph_scg_matrix_t mtype, - igraph_matrix_t *L, - igraph_matrix_t *R, - igraph_sparsemat_t *Lsparse, - igraph_sparsemat_t *Rsparse, - const igraph_vector_t *p, - igraph_scg_norm_t norm); - -IGRAPH_EXPORT int igraph_scg_norm_eps(const igraph_matrix_t *V, - const igraph_vector_t *groups, - igraph_vector_t *eps, - igraph_scg_matrix_t mtype, - const igraph_vector_t *p, - igraph_scg_norm_t norm); - -IGRAPH_EXPORT int igraph_scg_adjacency(const igraph_t *graph, - const igraph_matrix_t *matrix, - const igraph_sparsemat_t *sparsemat, - const igraph_vector_t *ev, - igraph_integer_t nt, - const igraph_vector_t *nt_vec, - igraph_scg_algorithm_t algo, - igraph_vector_t *values, - igraph_matrix_t *vectors, - igraph_vector_t *groups, - igraph_bool_t use_arpack, - igraph_integer_t maxiter, - igraph_t *scg_graph, - igraph_matrix_t *scg_matrix, - igraph_sparsemat_t *scg_sparsemat, - igraph_matrix_t *L, - igraph_matrix_t *R, - igraph_sparsemat_t *Lsparse, - igraph_sparsemat_t *Rsparse); - -IGRAPH_EXPORT int igraph_scg_stochastic(const igraph_t *graph, - const igraph_matrix_t *matrix, - const igraph_sparsemat_t *sparsemat, - const igraph_vector_t *ev, - igraph_integer_t nt, - const igraph_vector_t *nt_vec, - igraph_scg_algorithm_t algo, - igraph_scg_norm_t norm, - igraph_vector_complex_t *values, - igraph_matrix_complex_t *vectors, - igraph_vector_t *groups, - igraph_vector_t *p, - igraph_bool_t use_arpack, - igraph_integer_t maxiter, - igraph_t *scg_graph, - igraph_matrix_t *scg_matrix, - igraph_sparsemat_t *scg_sparsemat, - igraph_matrix_t *L, - igraph_matrix_t *R, - igraph_sparsemat_t *Lsparse, - igraph_sparsemat_t *Rsparse); - -IGRAPH_EXPORT int igraph_scg_laplacian(const igraph_t *graph, - const igraph_matrix_t *matrix, - const igraph_sparsemat_t *sparsemat, - const igraph_vector_t *ev, - igraph_integer_t nt, - const igraph_vector_t *nt_vec, - igraph_scg_algorithm_t algo, - igraph_scg_norm_t norm, - igraph_scg_direction_t direction, - igraph_vector_complex_t *values, - igraph_matrix_complex_t *vectors, - igraph_vector_t *groups, - igraph_bool_t use_arpack, - igraph_integer_t maxiter, - igraph_t *scg_graph, - igraph_matrix_t *scg_matrix, - igraph_sparsemat_t *scg_sparsemat, - igraph_matrix_t *L, - igraph_matrix_t *R, - igraph_sparsemat_t *Lsparse, - igraph_sparsemat_t *Rsparse); - -__END_DECLS - -#endif diff --git a/src/include/igraph_separators.h b/src/include/igraph_separators.h deleted file mode 100644 index aed1d5a6f9..0000000000 --- a/src/include/igraph_separators.h +++ /dev/null @@ -1,53 +0,0 @@ -/* -*- mode: C -*- */ -/* - IGraph library. - Copyright (C) 2010-2012 Gabor Csardi - 334 Harvard street, Cambridge, MA 02139 USA - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA - -*/ - -#ifndef IGRAPH_SEPARATORS_H -#define IGRAPH_SEPARATORS_H - -#include "igraph_decls.h" -#include "igraph_constants.h" -#include "igraph_types.h" -#include "igraph_vector.h" -#include "igraph_vector_ptr.h" -#include "igraph_datatype.h" -#include "igraph_iterators.h" - -__BEGIN_DECLS - -IGRAPH_EXPORT int igraph_is_separator(const igraph_t *graph, - const igraph_vs_t candidate, - igraph_bool_t *res); - -IGRAPH_EXPORT int igraph_all_minimal_st_separators(const igraph_t *graph, - igraph_vector_ptr_t *separators); - -IGRAPH_EXPORT int igraph_is_minimal_separator(const igraph_t *graph, - const igraph_vs_t candidate, - igraph_bool_t *res); - -IGRAPH_EXPORT int igraph_minimum_size_separators(const igraph_t *graph, - igraph_vector_ptr_t *separators); - -__END_DECLS - -#endif diff --git a/src/include/igraph_sparsemat.h b/src/include/igraph_sparsemat.h deleted file mode 100644 index 6070ca834d..0000000000 --- a/src/include/igraph_sparsemat.h +++ /dev/null @@ -1,288 +0,0 @@ -/* -*- mode: C -*- */ -/* - IGraph library. - Copyright (C) 2009-2012 Gabor Csardi - 334 Harvard street, Cambridge, MA 02139 USA - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA - -*/ - -#ifndef IGRAPH_SPARSEMAT_H -#define IGRAPH_SPARSEMAT_H - -#include "igraph_decls.h" -#include "igraph_types.h" -#include "igraph_vector.h" -#include "igraph_datatype.h" -#include "igraph_arpack.h" - -#include - -__BEGIN_DECLS - -struct cs_di_sparse; -struct cs_di_symbolic; -struct cs_di_numeric; - -typedef struct { - struct cs_di_sparse *cs; -} igraph_sparsemat_t; - -typedef struct { - struct cs_di_symbolic *symbolic; -} igraph_sparsemat_symbolic_t; - -typedef struct { - struct cs_di_numeric *numeric; -} igraph_sparsemat_numeric_t; - -typedef enum { IGRAPH_SPARSEMAT_TRIPLET, - IGRAPH_SPARSEMAT_CC - } igraph_sparsemat_type_t; - -typedef struct { - igraph_sparsemat_t *mat; - int pos; - int col; -} igraph_sparsemat_iterator_t; - -IGRAPH_EXPORT int igraph_sparsemat_init(igraph_sparsemat_t *A, int rows, int cols, int nzmax); -IGRAPH_EXPORT int igraph_sparsemat_copy(igraph_sparsemat_t *to, - const igraph_sparsemat_t *from); -IGRAPH_EXPORT void igraph_sparsemat_destroy(igraph_sparsemat_t *A); -IGRAPH_EXPORT int igraph_sparsemat_realloc(igraph_sparsemat_t *A, int nzmax); - -IGRAPH_EXPORT long int igraph_sparsemat_nrow(const igraph_sparsemat_t *A); -IGRAPH_EXPORT long int igraph_sparsemat_ncol(const igraph_sparsemat_t *B); -IGRAPH_EXPORT igraph_sparsemat_type_t igraph_sparsemat_type(const igraph_sparsemat_t *A); -IGRAPH_EXPORT igraph_bool_t igraph_sparsemat_is_triplet(const igraph_sparsemat_t *A); -IGRAPH_EXPORT igraph_bool_t igraph_sparsemat_is_cc(const igraph_sparsemat_t *A); - -IGRAPH_EXPORT int igraph_sparsemat_permute(const igraph_sparsemat_t *A, - const igraph_vector_int_t *p, - const igraph_vector_int_t *q, - igraph_sparsemat_t *res); - -IGRAPH_EXPORT int igraph_sparsemat_index(const igraph_sparsemat_t *A, - const igraph_vector_int_t *p, - const igraph_vector_int_t *q, - igraph_sparsemat_t *res, - igraph_real_t *constres); - -IGRAPH_EXPORT int igraph_sparsemat_entry(igraph_sparsemat_t *A, int row, int col, - igraph_real_t elem); -IGRAPH_EXPORT int igraph_sparsemat_compress(const igraph_sparsemat_t *A, - igraph_sparsemat_t *res); -IGRAPH_EXPORT int igraph_sparsemat_transpose(const igraph_sparsemat_t *A, - igraph_sparsemat_t *res, int values); -IGRAPH_EXPORT igraph_bool_t igraph_sparsemat_is_symmetric(const igraph_sparsemat_t *A); -IGRAPH_EXPORT int igraph_sparsemat_dupl(igraph_sparsemat_t *A); -IGRAPH_EXPORT int igraph_sparsemat_fkeep(igraph_sparsemat_t *A, - igraph_integer_t (*fkeep)(igraph_integer_t, igraph_integer_t, igraph_real_t, void*), - void *other); -IGRAPH_EXPORT int igraph_sparsemat_dropzeros(igraph_sparsemat_t *A); -IGRAPH_EXPORT int igraph_sparsemat_droptol(igraph_sparsemat_t *A, igraph_real_t tol); -IGRAPH_EXPORT int igraph_sparsemat_multiply(const igraph_sparsemat_t *A, - const igraph_sparsemat_t *B, - igraph_sparsemat_t *res); -IGRAPH_EXPORT int igraph_sparsemat_add(const igraph_sparsemat_t *A, - const igraph_sparsemat_t *B, - igraph_real_t alpha, - igraph_real_t beta, - igraph_sparsemat_t *res); -IGRAPH_EXPORT int igraph_sparsemat_gaxpy(const igraph_sparsemat_t *A, - const igraph_vector_t *x, - igraph_vector_t *res); - -IGRAPH_EXPORT int igraph_sparsemat_lsolve(const igraph_sparsemat_t *A, - const igraph_vector_t *b, - igraph_vector_t *res); -IGRAPH_EXPORT int igraph_sparsemat_ltsolve(const igraph_sparsemat_t *A, - const igraph_vector_t *b, - igraph_vector_t *res); -IGRAPH_EXPORT int igraph_sparsemat_usolve(const igraph_sparsemat_t *A, - const igraph_vector_t *b, - igraph_vector_t *res); -IGRAPH_EXPORT int igraph_sparsemat_utsolve(const igraph_sparsemat_t *A, - const igraph_vector_t *b, - igraph_vector_t *res); - -IGRAPH_EXPORT int igraph_sparsemat_cholsol(const igraph_sparsemat_t *A, - const igraph_vector_t *b, - igraph_vector_t *res, - int order); - -IGRAPH_EXPORT int igraph_sparsemat_lusol(const igraph_sparsemat_t *A, - const igraph_vector_t *b, - igraph_vector_t *res, - int order, - igraph_real_t tol); - -IGRAPH_EXPORT int igraph_sparsemat_print(const igraph_sparsemat_t *A, - FILE *outstream); - -IGRAPH_EXPORT int igraph_sparsemat_eye(igraph_sparsemat_t *A, int n, int nzmax, - igraph_real_t value, - igraph_bool_t compress); - -IGRAPH_EXPORT int igraph_sparsemat_diag(igraph_sparsemat_t *A, int nzmax, - const igraph_vector_t *values, - igraph_bool_t compress); - -IGRAPH_EXPORT int igraph_sparsemat(igraph_t *graph, const igraph_sparsemat_t *A, - igraph_bool_t directed); - -IGRAPH_EXPORT int igraph_weighted_sparsemat(igraph_t *graph, const igraph_sparsemat_t *A, - igraph_bool_t directed, const char *attr, - igraph_bool_t loops); - -IGRAPH_EXPORT int igraph_get_sparsemat(const igraph_t *graph, igraph_sparsemat_t *res); - -IGRAPH_EXPORT int igraph_matrix_as_sparsemat(igraph_sparsemat_t *res, - const igraph_matrix_t *mat, - igraph_real_t tol); - -IGRAPH_EXPORT int igraph_sparsemat_as_matrix(igraph_matrix_t *res, - const igraph_sparsemat_t *spmat); - -typedef enum { IGRAPH_SPARSEMAT_SOLVE_LU, - IGRAPH_SPARSEMAT_SOLVE_QR - } igraph_sparsemat_solve_t; - -IGRAPH_EXPORT int igraph_sparsemat_arpack_rssolve(const igraph_sparsemat_t *A, - igraph_arpack_options_t *options, - igraph_arpack_storage_t *storage, - igraph_vector_t *values, - igraph_matrix_t *vectors, - igraph_sparsemat_solve_t solvemethod); - -IGRAPH_EXPORT int igraph_sparsemat_arpack_rnsolve(const igraph_sparsemat_t *A, - igraph_arpack_options_t *options, - igraph_arpack_storage_t *storage, - igraph_matrix_t *values, - igraph_matrix_t *vectors); - -IGRAPH_EXPORT int igraph_sparsemat_lu(const igraph_sparsemat_t *A, - const igraph_sparsemat_symbolic_t *dis, - igraph_sparsemat_numeric_t *din, double tol); - -IGRAPH_EXPORT int igraph_sparsemat_qr(const igraph_sparsemat_t *A, - const igraph_sparsemat_symbolic_t *dis, - igraph_sparsemat_numeric_t *din); - -IGRAPH_EXPORT int igraph_sparsemat_luresol(const igraph_sparsemat_symbolic_t *dis, - const igraph_sparsemat_numeric_t *din, - const igraph_vector_t *b, - igraph_vector_t *res); - -IGRAPH_EXPORT int igraph_sparsemat_qrresol(const igraph_sparsemat_symbolic_t *dis, - const igraph_sparsemat_numeric_t *din, - const igraph_vector_t *b, - igraph_vector_t *res); - -IGRAPH_EXPORT int igraph_sparsemat_symbqr(long int order, const igraph_sparsemat_t *A, - igraph_sparsemat_symbolic_t *dis); - -IGRAPH_EXPORT int igraph_sparsemat_symblu(long int order, const igraph_sparsemat_t *A, - igraph_sparsemat_symbolic_t *dis); - - -IGRAPH_EXPORT void igraph_sparsemat_symbolic_destroy(igraph_sparsemat_symbolic_t *dis); -IGRAPH_EXPORT void igraph_sparsemat_numeric_destroy(igraph_sparsemat_numeric_t *din); - -IGRAPH_EXPORT igraph_real_t igraph_sparsemat_max(igraph_sparsemat_t *A); -IGRAPH_EXPORT igraph_real_t igraph_sparsemat_min(igraph_sparsemat_t *A); -IGRAPH_EXPORT int igraph_sparsemat_minmax(igraph_sparsemat_t *A, - igraph_real_t *min, igraph_real_t *max); - -IGRAPH_EXPORT long int igraph_sparsemat_count_nonzero(igraph_sparsemat_t *A); -IGRAPH_EXPORT long int igraph_sparsemat_count_nonzerotol(igraph_sparsemat_t *A, - igraph_real_t tol); -IGRAPH_EXPORT int igraph_sparsemat_rowsums(const igraph_sparsemat_t *A, - igraph_vector_t *res); -IGRAPH_EXPORT int igraph_sparsemat_colsums(const igraph_sparsemat_t *A, - igraph_vector_t *res); - -IGRAPH_EXPORT int igraph_sparsemat_rowmins(igraph_sparsemat_t *A, - igraph_vector_t *res); -IGRAPH_EXPORT int igraph_sparsemat_colmins(igraph_sparsemat_t *A, - igraph_vector_t *res); - -IGRAPH_EXPORT int igraph_sparsemat_rowmaxs(igraph_sparsemat_t *A, - igraph_vector_t *res); -IGRAPH_EXPORT int igraph_sparsemat_colmaxs(igraph_sparsemat_t *A, - igraph_vector_t *res); - -IGRAPH_EXPORT int igraph_sparsemat_which_min_rows(igraph_sparsemat_t *A, - igraph_vector_t *res, - igraph_vector_int_t *pos); -IGRAPH_EXPORT int igraph_sparsemat_which_min_cols(igraph_sparsemat_t *A, - igraph_vector_t *res, - igraph_vector_int_t *pos); - -IGRAPH_EXPORT int igraph_sparsemat_scale(igraph_sparsemat_t *A, igraph_real_t by); - - -IGRAPH_EXPORT int igraph_sparsemat_add_rows(igraph_sparsemat_t *A, long int n); -IGRAPH_EXPORT int igraph_sparsemat_add_cols(igraph_sparsemat_t *A, long int n); -IGRAPH_EXPORT int igraph_sparsemat_resize(igraph_sparsemat_t *A, long int nrow, - long int ncol, int nzmax); -IGRAPH_EXPORT int igraph_sparsemat_nonzero_storage(const igraph_sparsemat_t *A); -IGRAPH_EXPORT int igraph_sparsemat_getelements(const igraph_sparsemat_t *A, - igraph_vector_int_t *i, - igraph_vector_int_t *j, - igraph_vector_t *x); -IGRAPH_EXPORT int igraph_sparsemat_getelements_sorted(const igraph_sparsemat_t *A, - igraph_vector_int_t *i, - igraph_vector_int_t *j, - igraph_vector_t *x); -IGRAPH_EXPORT int igraph_sparsemat_scale_rows(igraph_sparsemat_t *A, - const igraph_vector_t *fact); -IGRAPH_EXPORT int igraph_sparsemat_scale_cols(igraph_sparsemat_t *A, - const igraph_vector_t *fact); -IGRAPH_EXPORT int igraph_sparsemat_multiply_by_dense(const igraph_sparsemat_t *A, - const igraph_matrix_t *B, - igraph_matrix_t *res); -IGRAPH_EXPORT int igraph_sparsemat_dense_multiply(const igraph_matrix_t *A, - const igraph_sparsemat_t *B, - igraph_matrix_t *res); - -IGRAPH_EXPORT int igraph_sparsemat_view(igraph_sparsemat_t *A, int nzmax, int m, int n, - int *p, int *i, double *x, int nz); -IGRAPH_EXPORT IGRAPH_DEPRECATED int igraph_i_sparsemat_view(igraph_sparsemat_t *A, int nzmax, int m, int n, - int *p, int *i, double *x, int nz); - -IGRAPH_EXPORT int igraph_sparsemat_sort(const igraph_sparsemat_t *A, - igraph_sparsemat_t *sorted); - -IGRAPH_EXPORT int igraph_sparsemat_nzmax(const igraph_sparsemat_t *A); - -IGRAPH_EXPORT int igraph_sparsemat_neg(igraph_sparsemat_t *A); - -IGRAPH_EXPORT int igraph_sparsemat_iterator_init(igraph_sparsemat_iterator_t *it, - igraph_sparsemat_t *sparsemat); -IGRAPH_EXPORT int igraph_sparsemat_iterator_reset(igraph_sparsemat_iterator_t *it); -IGRAPH_EXPORT igraph_bool_t igraph_sparsemat_iterator_end(const igraph_sparsemat_iterator_t *it); -IGRAPH_EXPORT int igraph_sparsemat_iterator_row(const igraph_sparsemat_iterator_t *it); -IGRAPH_EXPORT int igraph_sparsemat_iterator_col(const igraph_sparsemat_iterator_t *it); -IGRAPH_EXPORT int igraph_sparsemat_iterator_idx(const igraph_sparsemat_iterator_t *it); -IGRAPH_EXPORT igraph_real_t igraph_sparsemat_iterator_get(const igraph_sparsemat_iterator_t *it); -IGRAPH_EXPORT int igraph_sparsemat_iterator_next(igraph_sparsemat_iterator_t *it); - -__END_DECLS - -#endif diff --git a/src/include/igraph_spmatrix.h b/src/include/igraph_spmatrix.h deleted file mode 100644 index 141c39afb1..0000000000 --- a/src/include/igraph_spmatrix.h +++ /dev/null @@ -1,109 +0,0 @@ -/* -*- mode: C -*- */ -/* - IGraph library. - Copyright (C) 2009-2012 Gabor Csardi - 334 Harvard street, Cambridge, MA 02139 USA - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA - -*/ - -#ifndef IGRAPH_SPMATRIX_H -#define IGRAPH_SPMATRIX_H - -#include "igraph_decls.h" -#include "igraph_vector.h" - -__BEGIN_DECLS - -/* -------------------------------------------------- */ -/* Sparse matrix */ -/* -------------------------------------------------- */ - -/** - * \section about_igraph_spmatrix_t_objects About \type igraph_spmatrix_t objects - * - * The \type igraph_spmatrix_t type stores a sparse matrix with the - * assumption that the number of nonzero elements in the matrix scales - * linearly with the row or column count of the matrix (so most of the - * elements are zero). Of course it can store an arbitrary real matrix, - * but if most of the elements are nonzero, one should use \type igraph_matrix_t - * instead. - * - * The elements are stored in column compressed format, so the elements - * in the same column are stored adjacent in the computer's memory. The storage - * requirement for a sparse matrix is O(n) where n is the number of nonzero - * elements. Actually it can be a bit larger, see the documentation of - * the vector type for an explanation. - */ -typedef struct s_spmatrix { - igraph_vector_t ridx, cidx, data; - long int nrow, ncol; -} igraph_spmatrix_t; - -#define IGRAPH_SPMATRIX_INIT_FINALLY(m, nr, nc) \ - do { IGRAPH_CHECK(igraph_spmatrix_init(m, nr, nc)); \ - IGRAPH_FINALLY(igraph_spmatrix_destroy, m); } while (0) - -IGRAPH_EXPORT int igraph_spmatrix_init(igraph_spmatrix_t *m, long int nrow, long int ncol); -IGRAPH_EXPORT void igraph_spmatrix_destroy(igraph_spmatrix_t *m); -IGRAPH_EXPORT int igraph_spmatrix_resize(igraph_spmatrix_t *m, long int nrow, long int ncol); -IGRAPH_EXPORT igraph_real_t igraph_spmatrix_e(const igraph_spmatrix_t *m, long int row, long int col); -IGRAPH_EXPORT int igraph_spmatrix_set(igraph_spmatrix_t *m, long int row, long int col, - igraph_real_t value); -IGRAPH_EXPORT int igraph_spmatrix_add_e(igraph_spmatrix_t *m, long int row, long int col, - igraph_real_t value); -IGRAPH_EXPORT int igraph_spmatrix_add_col_values(igraph_spmatrix_t *m, long int to, long int from); -IGRAPH_EXPORT long int igraph_spmatrix_count_nonzero(const igraph_spmatrix_t *m); -IGRAPH_EXPORT long int igraph_spmatrix_size(const igraph_spmatrix_t *m); -IGRAPH_EXPORT long int igraph_spmatrix_nrow(const igraph_spmatrix_t *m); -IGRAPH_EXPORT long int igraph_spmatrix_ncol(const igraph_spmatrix_t *m); -IGRAPH_EXPORT int igraph_spmatrix_copy_to(const igraph_spmatrix_t *m, igraph_real_t *to); -IGRAPH_EXPORT int igraph_spmatrix_null(igraph_spmatrix_t *m); -IGRAPH_EXPORT int igraph_spmatrix_add_cols(igraph_spmatrix_t *m, long int n); -IGRAPH_EXPORT int igraph_spmatrix_add_rows(igraph_spmatrix_t *m, long int n); -IGRAPH_EXPORT int igraph_spmatrix_clear_col(igraph_spmatrix_t *m, long int col); -IGRAPH_EXPORT int igraph_spmatrix_clear_row(igraph_spmatrix_t *m, long int row); -IGRAPH_EXPORT int igraph_spmatrix_copy(igraph_spmatrix_t *to, const igraph_spmatrix_t *from); -IGRAPH_EXPORT igraph_real_t igraph_spmatrix_max_nonzero(const igraph_spmatrix_t *m, - igraph_real_t *ridx, igraph_real_t *cidx); -IGRAPH_EXPORT igraph_real_t igraph_spmatrix_max(const igraph_spmatrix_t *m, - igraph_real_t *ridx, igraph_real_t *cidx); -IGRAPH_EXPORT void igraph_spmatrix_scale(igraph_spmatrix_t *m, igraph_real_t by); -IGRAPH_EXPORT int igraph_spmatrix_colsums(const igraph_spmatrix_t *m, igraph_vector_t *res); -IGRAPH_EXPORT int igraph_spmatrix_rowsums(const igraph_spmatrix_t *m, igraph_vector_t *res); - -IGRAPH_EXPORT int igraph_spmatrix_print(const igraph_spmatrix_t *matrix); -IGRAPH_EXPORT int igraph_spmatrix_fprint(const igraph_spmatrix_t *matrix, FILE* file); - - -typedef struct s_spmatrix_iter { - const igraph_spmatrix_t *m; /* pointer to the matrix we are iterating over */ - long int pos; /* internal index into the data vector */ - long int ri; /* row index */ - long int ci; /* column index */ - igraph_real_t value; /* value at the given cell */ -} igraph_spmatrix_iter_t; - -IGRAPH_EXPORT int igraph_spmatrix_iter_create(igraph_spmatrix_iter_t *mit, const igraph_spmatrix_t *m); -IGRAPH_EXPORT int igraph_spmatrix_iter_reset(igraph_spmatrix_iter_t *mit); -IGRAPH_EXPORT int igraph_spmatrix_iter_next(igraph_spmatrix_iter_t *mit); -IGRAPH_EXPORT igraph_bool_t igraph_spmatrix_iter_end(igraph_spmatrix_iter_t *mit); -IGRAPH_EXPORT void igraph_spmatrix_iter_destroy(igraph_spmatrix_iter_t *mit); - -__END_DECLS - -#endif diff --git a/src/include/igraph_stack.h b/src/include/igraph_stack.h deleted file mode 100644 index a186296ff4..0000000000 --- a/src/include/igraph_stack.h +++ /dev/null @@ -1,79 +0,0 @@ -/* -*- mode: C -*- */ -/* - IGraph library. - Copyright (C) 2009-2012 Gabor Csardi - 334 Harvard street, Cambridge, MA 02139 USA - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA - -*/ - -#ifndef IGRAPH_STACK_H -#define IGRAPH_STACK_H - -#include "igraph_decls.h" -#include "igraph_types.h" - -__BEGIN_DECLS - -/* -------------------------------------------------- */ -/* Plain stack */ -/* -------------------------------------------------- */ - -#define BASE_IGRAPH_REAL -#include "igraph_pmt.h" -#include "igraph_stack_pmt.h" -#include "igraph_pmt_off.h" -#undef BASE_IGRAPH_REAL - -#define BASE_LONG -#include "igraph_pmt.h" -#include "igraph_stack_pmt.h" -#include "igraph_pmt_off.h" -#undef BASE_LONG - -#define BASE_INT -#include "igraph_pmt.h" -#include "igraph_stack_pmt.h" -#include "igraph_pmt_off.h" -#undef BASE_INT - -#define BASE_CHAR -#include "igraph_pmt.h" -#include "igraph_stack_pmt.h" -#include "igraph_pmt_off.h" -#undef BASE_CHAR - -#define BASE_BOOL -#include "igraph_pmt.h" -#include "igraph_stack_pmt.h" -#include "igraph_pmt_off.h" -#undef BASE_BOOL - -#define BASE_PTR -#include "igraph_pmt.h" -#include "igraph_stack_pmt.h" -#include "igraph_pmt_off.h" -#undef BASE_PTR - -#define IGRAPH_STACK_NULL { 0,0,0 } - -IGRAPH_EXPORT void igraph_stack_ptr_free_all(igraph_stack_ptr_t* s); -IGRAPH_EXPORT void igraph_stack_ptr_destroy_all(igraph_stack_ptr_t* s); - -__END_DECLS - -#endif diff --git a/src/include/igraph_stack_pmt.h b/src/include/igraph_stack_pmt.h deleted file mode 100644 index 1a9459b690..0000000000 --- a/src/include/igraph_stack_pmt.h +++ /dev/null @@ -1,47 +0,0 @@ -/* -*- mode: C -*- */ -/* - IGraph library. - Copyright (C) 2007-2012 Gabor Csardi - 334 Harvard street, Cambridge, MA 02139 USA - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA - -*/ - -#include - -/** - * Stack data type. - * \ingroup internal - */ - -typedef struct TYPE(igraph_stack) { - BASE* stor_begin; - BASE* stor_end; - BASE* end; -} TYPE(igraph_stack); - -IGRAPH_EXPORT int FUNCTION(igraph_stack, init)(TYPE(igraph_stack)* s, long int size); -IGRAPH_EXPORT void FUNCTION(igraph_stack, destroy)(TYPE(igraph_stack)* s); -IGRAPH_EXPORT int FUNCTION(igraph_stack, reserve)(TYPE(igraph_stack)* s, long int size); -IGRAPH_EXPORT igraph_bool_t FUNCTION(igraph_stack, empty)(TYPE(igraph_stack)* s); -IGRAPH_EXPORT long int FUNCTION(igraph_stack, size)(const TYPE(igraph_stack)* s); -IGRAPH_EXPORT void FUNCTION(igraph_stack, clear)(TYPE(igraph_stack)* s); -IGRAPH_EXPORT int FUNCTION(igraph_stack, push)(TYPE(igraph_stack)* s, BASE elem); -IGRAPH_EXPORT BASE FUNCTION(igraph_stack, pop)(TYPE(igraph_stack)* s); -IGRAPH_EXPORT BASE FUNCTION(igraph_stack, top)(const TYPE(igraph_stack)* s); -IGRAPH_EXPORT int FUNCTION(igraph_stack, print)(const TYPE(igraph_stack)* s); -IGRAPH_EXPORT int FUNCTION(igraph_stack, fprint)(const TYPE(igraph_stack)* s, FILE *file); diff --git a/src/include/igraph_statusbar.h b/src/include/igraph_statusbar.h deleted file mode 100644 index c3cf4f33ba..0000000000 --- a/src/include/igraph_statusbar.h +++ /dev/null @@ -1,126 +0,0 @@ -/* -*- mode: C -*- */ -/* - IGraph library. - Copyright (C) 2010-2012 Gabor Csardi - 334 Harvard street, Cambridge, MA 02139 USA - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA - -*/ - -#ifndef IGRAPH_STATUSBAR_H -#define IGRAPH_STATUSBAR_H - -#include "igraph_decls.h" - -__BEGIN_DECLS - -/** - * \section about_status_handlers Status reporting - * - * - * In addition to the possibility of reporting the progress of an - * igraph computation via \ref igraph_progress(), it is also possible - * to report simple status messages from within igraph functions, - * without having to judge how much of the computation was performed - * already. For this one needs to install a status handler function. - * - * - * - * Status handler functions must be of type \ref igraph_status_handler_t - * and they can be install by a call to \ref igraph_set_status_handler(). - * Currently there is a simple predefined status handler function, - * called \ref igraph_status_handler_stderr(), but the user can define - * new ones. - * - * - * - * igraph functions report their status via a call to the - * \ref IGRAPH_STATUS() or the \ref IGRAPH_STATUSF() macro. - * - */ - -/** - * \typedef igraph_status_handler_t - * - * The type of the igraph status handler functions - * \param message The status message. - * \param data Additional context, with user-defined semantics. - * Existing igraph functions pass a null pointer here. - */ - -typedef int igraph_status_handler_t(const char *message, void *data); - -IGRAPH_EXPORT extern igraph_status_handler_t igraph_status_handler_stderr; - -IGRAPH_EXPORT igraph_status_handler_t * igraph_set_status_handler(igraph_status_handler_t new_handler); - -IGRAPH_EXPORT int igraph_status(const char *message, void *data); - -/** - * \define IGRAPH_STATUS - * Report the status of an igraph function. - * - * Typically this function is called only a handful of times from - * an igraph function. E.g. if an algorithm has three major - * steps, then it is logical to call it three times, to - * signal the three major steps. - * \param message The status message. - * \param data Additional context, with user-defined semantics. - * Existing igraph functions pass a null pointer here. - * \return If the status handler returns with a value other than - * \c IGRAPH_SUCCESS, then the function that called this - * macro returns as well, with error code - * \c IGRAPH_INTERRUPTED. - */ - -#define IGRAPH_STATUS(message, data) \ - do { \ - if (igraph_status((message), (data)) != IGRAPH_SUCCESS) { \ - IGRAPH_FINALLY_FREE(); \ - return IGRAPH_INTERRUPTED; \ - } \ - } while (0) - -IGRAPH_EXPORT int igraph_statusf(const char *message, void *data, ...); - -/** - * \define IGRAPH_STATUSF - * Report the status from an igraph function - * - * This is the more flexible version of \ref IGRAPH_STATUS(), - * having a printf-like syntax. As this macro takes variable - * number of arguments, they must be all supplied as a single - * argument, enclosed in parentheses. Then \ref igraph_statusf() - * is called with the given arguments. - * \param args The arguments to pass to \ref igraph_statusf(). - * \return If the status handler returns with a value other than - * \c IGRAPH_SUCCESS, then the function that called this - * macro returns as well, with error code - * \c IGRAPH_INTERRUPTED. - */ - -#define IGRAPH_STATUSF(args) \ - do { \ - if (igraph_statusf args != IGRAPH_SUCCESS) { \ - IGRAPH_FINALLY_FREE(); \ - return IGRAPH_INTERRUPTED; \ - } \ - } while (0) - -__END_DECLS - -#endif diff --git a/src/include/igraph_structural.h b/src/include/igraph_structural.h deleted file mode 100644 index 100aa476e6..0000000000 --- a/src/include/igraph_structural.h +++ /dev/null @@ -1,128 +0,0 @@ -/* -*- mode: C -*- */ -/* - IGraph library. - Copyright (C) 2009-2012 Gabor Csardi - 334 Harvard street, Cambridge, MA 02139 USA - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA - -*/ - -#ifndef IGRAPH_STRUCTURAL_H -#define IGRAPH_STRUCTURAL_H - -#include "igraph_decls.h" -#include "igraph_constants.h" -#include "igraph_types.h" -#include "igraph_vector.h" -#include "igraph_matrix.h" -#include "igraph_datatype.h" -#include "igraph_iterators.h" -#include "igraph_attributes.h" -#include "igraph_sparsemat.h" - -__BEGIN_DECLS - -/* -------------------------------------------------- */ -/* Basic query functions */ -/* -------------------------------------------------- */ - -IGRAPH_EXPORT int igraph_are_connected(const igraph_t *graph, igraph_integer_t v1, igraph_integer_t v2, igraph_bool_t *res); -IGRAPH_EXPORT int igraph_count_multiple(const igraph_t *graph, igraph_vector_t *res, igraph_es_t es); -IGRAPH_EXPORT int igraph_density(const igraph_t *graph, igraph_real_t *res, - igraph_bool_t loops); -IGRAPH_EXPORT int igraph_diversity(const igraph_t *graph, const igraph_vector_t *weights, - igraph_vector_t *res, const igraph_vs_t vs); -IGRAPH_EXPORT int igraph_girth(const igraph_t *graph, igraph_integer_t *girth, - igraph_vector_t *circle); -IGRAPH_EXPORT int igraph_has_loop(const igraph_t *graph, igraph_bool_t *res); -IGRAPH_EXPORT int igraph_has_multiple(const igraph_t *graph, igraph_bool_t *res); -IGRAPH_EXPORT int igraph_is_loop(const igraph_t *graph, igraph_vector_bool_t *res, - igraph_es_t es); -IGRAPH_EXPORT int igraph_is_multiple(const igraph_t *graph, igraph_vector_bool_t *res, - igraph_es_t es); -IGRAPH_EXPORT int igraph_is_mutual(const igraph_t *graph, igraph_vector_bool_t *res, igraph_es_t es); -IGRAPH_EXPORT int igraph_is_simple(const igraph_t *graph, igraph_bool_t *res); -IGRAPH_EXPORT int igraph_is_tree(const igraph_t *graph, igraph_bool_t *res, igraph_integer_t *root, igraph_neimode_t mode); -IGRAPH_EXPORT int igraph_maxdegree(const igraph_t *graph, igraph_integer_t *res, - igraph_vs_t vids, igraph_neimode_t mode, - igraph_bool_t loops); -IGRAPH_EXPORT int igraph_reciprocity(const igraph_t *graph, igraph_real_t *res, - igraph_bool_t ignore_loops, - igraph_reciprocity_t mode); -IGRAPH_EXPORT int igraph_strength(const igraph_t *graph, igraph_vector_t *res, - const igraph_vs_t vids, igraph_neimode_t mode, - igraph_bool_t loops, const igraph_vector_t *weights); -IGRAPH_EXPORT int igraph_sort_vertex_ids_by_degree(const igraph_t *graph, - igraph_vector_t *outvids, - igraph_vs_t vids, - igraph_neimode_t mode, - igraph_bool_t loops, - igraph_order_t order, - igraph_bool_t only_indices); - -/* -------------------------------------------------- */ -/* Structural properties */ -/* -------------------------------------------------- */ - -IGRAPH_EXPORT int igraph_minimum_spanning_tree(const igraph_t *graph, igraph_vector_t *res, - const igraph_vector_t *weights); -IGRAPH_EXPORT int igraph_minimum_spanning_tree_unweighted(const igraph_t *graph, - igraph_t *mst); -IGRAPH_EXPORT int igraph_minimum_spanning_tree_prim(const igraph_t *graph, igraph_t *mst, - const igraph_vector_t *weights); -IGRAPH_EXPORT int igraph_random_spanning_tree(const igraph_t *graph, igraph_vector_t *res, - igraph_integer_t vid); - -IGRAPH_EXPORT int igraph_subcomponent(const igraph_t *graph, igraph_vector_t *res, igraph_real_t vid, - igraph_neimode_t mode); - -IGRAPH_EXPORT int igraph_unfold_tree(const igraph_t *graph, igraph_t *tree, - igraph_neimode_t mode, const igraph_vector_t *roots, - igraph_vector_t *vertex_index); - -IGRAPH_EXPORT int igraph_maximum_cardinality_search(const igraph_t *graph, - igraph_vector_t *alpha, - igraph_vector_t *alpham1); -IGRAPH_EXPORT int igraph_is_chordal(const igraph_t *graph, - const igraph_vector_t *alpha, - const igraph_vector_t *alpham1, - igraph_bool_t *chordal, - igraph_vector_t *fill_in, - igraph_t *newgraph); -IGRAPH_EXPORT int igraph_avg_nearest_neighbor_degree(const igraph_t *graph, - igraph_vs_t vids, - igraph_neimode_t mode, - igraph_neimode_t neighbor_degree_mode, - igraph_vector_t *knn, - igraph_vector_t *knnk, - const igraph_vector_t *weights); - -IGRAPH_EXPORT int igraph_feedback_arc_set(const igraph_t *graph, igraph_vector_t *result, - const igraph_vector_t *weights, igraph_fas_algorithm_t algo); - -/* -------------------------------------------------- */ -/* Spectral Properties */ -/* -------------------------------------------------- */ - -IGRAPH_EXPORT int igraph_laplacian(const igraph_t *graph, igraph_matrix_t *res, - igraph_sparsemat_t *sparseres, - igraph_bool_t normalized, - const igraph_vector_t *weights); - -__END_DECLS - -#endif diff --git a/src/include/igraph_strvector.h b/src/include/igraph_strvector.h deleted file mode 100644 index 525fef8a83..0000000000 --- a/src/include/igraph_strvector.h +++ /dev/null @@ -1,97 +0,0 @@ -/* -*- mode: C -*- */ -/* - IGraph library. - Copyright (C) 2009-2012 Gabor Csardi - 334 Harvard street, Cambridge, MA 02139 USA - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA - -*/ - -#ifndef IGRAPH_STRVECTOR_H -#define IGRAPH_STRVECTOR_H - -#include "igraph_decls.h" -#include "igraph_vector.h" - -__BEGIN_DECLS - -/** - * Vector of strings - * \ingroup internal - */ - -typedef struct s_igraph_strvector { - char **data; - long int len; -} igraph_strvector_t; - -/** - * \define STR - * Indexing string vectors - * - * This is a macro which allows to query the elements of a string vector in - * simpler way than \ref igraph_strvector_get(). Note this macro cannot be - * used to set an element, for that use \ref igraph_strvector_set(). - * \param sv The string vector - * \param i The the index of the element. - * \return The element at position \p i. - * - * Time complexity: O(1). - */ -#define STR(sv,i) ((const char *)((sv).data[(i)])) - -#define IGRAPH_STRVECTOR_NULL { 0,0 } -#define IGRAPH_STRVECTOR_INIT_FINALLY(v, size) \ - do { IGRAPH_CHECK(igraph_strvector_init(v, size)); \ - IGRAPH_FINALLY( igraph_strvector_destroy, v); } while (0) - -IGRAPH_EXPORT int igraph_strvector_init(igraph_strvector_t *sv, long int len); -IGRAPH_EXPORT void igraph_strvector_destroy(igraph_strvector_t *sv); -IGRAPH_EXPORT long int igraph_strvector_size(const igraph_strvector_t *sv); -IGRAPH_EXPORT void igraph_strvector_get(const igraph_strvector_t *sv, - long int idx, char **value); -IGRAPH_EXPORT int igraph_strvector_set(igraph_strvector_t *sv, long int idx, - const char *value); -IGRAPH_EXPORT int igraph_strvector_set2(igraph_strvector_t *sv, long int idx, - const char *value, int len); -IGRAPH_EXPORT void igraph_strvector_clear(igraph_strvector_t *sv); -IGRAPH_EXPORT void igraph_strvector_remove_section(igraph_strvector_t *v, long int from, - long int to); -IGRAPH_EXPORT void igraph_strvector_remove(igraph_strvector_t *v, long int elem); -IGRAPH_EXPORT void igraph_strvector_move_interval(igraph_strvector_t *v, long int begin, - long int end, long int to); -IGRAPH_EXPORT int igraph_strvector_copy(igraph_strvector_t *to, - const igraph_strvector_t *from); -IGRAPH_EXPORT int igraph_strvector_append(igraph_strvector_t *to, - const igraph_strvector_t *from); -IGRAPH_EXPORT int igraph_strvector_resize(igraph_strvector_t* v, long int newsize); -IGRAPH_EXPORT int igraph_strvector_add(igraph_strvector_t *v, const char *value); -IGRAPH_EXPORT void igraph_strvector_permdelete(igraph_strvector_t *v, const igraph_vector_t *index, - long int nremove); -IGRAPH_EXPORT void igraph_strvector_remove_negidx(igraph_strvector_t *v, const igraph_vector_t *neg, - long int nremove); -IGRAPH_EXPORT int igraph_strvector_print(const igraph_strvector_t *v, FILE *file, - const char *sep); - -IGRAPH_EXPORT int igraph_strvector_index(const igraph_strvector_t *v, - igraph_strvector_t *newv, - const igraph_vector_t *idx); - - -__END_DECLS - -#endif diff --git a/src/include/igraph_threading.h b/src/include/igraph_threading.h deleted file mode 100644 index ebbdb1780c..0000000000 --- a/src/include/igraph_threading.h +++ /dev/null @@ -1,47 +0,0 @@ -/* -*- mode: C -*- */ -/* - IGraph library. - Copyright (C) 2011-2012 Gabor Csardi - 334 Harvard street, Cambridge, MA 02139 USA - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA - -*/ - -#ifndef IGRAPH_THREADING_H -#define IGRAPH_THREADING_H - -#include "igraph_decls.h" - -__BEGIN_DECLS - -/** - * \define IGRAPH_THREAD_SAFE - * - * Specifies whether igraph was built in thread-safe mode. - * - * This macro is defined to 1 if the current build of the igraph library is - * built in thread-safe mode, and 0 if it is not. A thread-safe igraph library - * attempts to use thread-local data structures instead of global ones, but - * note that this is not (and can not) be guaranteed for third-party libraries - * that igraph links to. - */ - -#define IGRAPH_THREAD_SAFE 0 - -__END_DECLS - -#endif diff --git a/src/include/igraph_threading.h.in b/src/include/igraph_threading.h.in deleted file mode 100644 index 1ddeb118d3..0000000000 --- a/src/include/igraph_threading.h.in +++ /dev/null @@ -1,47 +0,0 @@ -/* -*- mode: C -*- */ -/* - IGraph library. - Copyright (C) 2011-2012 Gabor Csardi - 334 Harvard street, Cambridge, MA 02139 USA - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA - -*/ - -#ifndef IGRAPH_THREADING_H -#define IGRAPH_THREADING_H - -#include "igraph_decls.h" - -__BEGIN_DECLS - -/** - * \define IGRAPH_THREAD_SAFE - * - * Specifies whether igraph was built in thread-safe mode. - * - * This macro is defined to 1 if the current build of the igraph library is - * built in thread-safe mode, and 0 if it is not. A thread-safe igraph library - * attempts to use thread-local data structures instead of global ones, but - * note that this is not (and can not) be guaranteed for third-party libraries - * that igraph links to. - */ - -#cmakedefine01 IGRAPH_THREAD_SAFE - -__END_DECLS - -#endif diff --git a/src/include/igraph_topology.h b/src/include/igraph_topology.h deleted file mode 100644 index 90e656b2d5..0000000000 --- a/src/include/igraph_topology.h +++ /dev/null @@ -1,285 +0,0 @@ -/* -*- mode: C -*- */ -/* - IGraph library. - Copyright (C) 2009-2012 Gabor Csardi - 334 Harvard street, Cambridge, MA 02139 USA - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA - -*/ - -#ifndef IGRAPH_TOPOLOGY_H -#define IGRAPH_TOPOLOGY_H - -#include "igraph_decls.h" -#include "igraph_constants.h" -#include "igraph_datatype.h" -#include "igraph_types.h" -#include "igraph_vector_ptr.h" - -__BEGIN_DECLS - -/* -------------------------------------------------- */ -/* Directed acyclic graphs */ -/* -------------------------------------------------- */ - -IGRAPH_EXPORT int igraph_topological_sorting(const igraph_t *graph, igraph_vector_t *res, - igraph_neimode_t mode); -IGRAPH_EXPORT int igraph_is_dag(const igraph_t *graph, igraph_bool_t *res); -IGRAPH_EXPORT int igraph_transitive_closure_dag(const igraph_t *graph, - igraph_t *closure); - -/* -------------------------------------------------- */ -/* Graph isomorphisms */ -/* -------------------------------------------------- */ - -/* Common functions */ -IGRAPH_EXPORT int igraph_simplify_and_colorize( - const igraph_t *graph, igraph_t *res, - igraph_vector_int_t *vertex_color, igraph_vector_int_t *edge_color); - -/* Generic interface */ -IGRAPH_EXPORT int igraph_isomorphic(const igraph_t *graph1, const igraph_t *graph2, - igraph_bool_t *iso); -IGRAPH_EXPORT int igraph_subisomorphic(const igraph_t *graph1, const igraph_t *graph2, - igraph_bool_t *iso); - -/* LAD */ -IGRAPH_EXPORT int igraph_subisomorphic_lad(const igraph_t *pattern, const igraph_t *target, - const igraph_vector_ptr_t *domains, - igraph_bool_t *iso, igraph_vector_t *map, - igraph_vector_ptr_t *maps, - igraph_bool_t induced, int time_limit); - -/* VF2 family*/ -/** - * \typedef igraph_isohandler_t - * Callback type, called when an isomorphism was found - * - * See the details at the documentation of \ref - * igraph_isomorphic_function_vf2(). - * \param map12 The mapping from the first graph to the second. - * \param map21 The mapping from the second graph to the first, the - * inverse of \p map12 basically. - * \param arg This extra argument was passed to \ref - * igraph_isomorphic_function_vf2() when it was called. - * \return Boolean, whether to continue with the isomorphism search. - */ - - -typedef igraph_bool_t igraph_isohandler_t(const igraph_vector_t *map12, - const igraph_vector_t *map21, void *arg); - -/** - * \typedef igraph_isocompat_t - * Callback type, called to check whether two vertices or edges are compatible - * - * VF2 (subgraph) isomorphism functions can be restricted by defining - * relations on the vertices and/or edges of the graphs, and then checking - * whether the vertices (edges) match according to these relations. - * - * This feature is implemented by two callbacks, one for - * vertices, one for edges. Every time igraph tries to match a vertex (edge) - * of the first (sub)graph to a vertex of the second graph, the vertex - * (edge) compatibility callback is called. The callback returns a - * logical value, giving whether the two vertices match. - * - * Both callback functions are of type \c igraph_isocompat_t. - * \param graph1 The first graph. - * \param graph2 The second graph. - * \param g1_num The id of a vertex or edge in the first graph. - * \param g2_num The id of a vertex or edge in the second graph. - * \param arg Extra argument to pass to the callback functions. - * \return Logical scalar, whether vertex (or edge) \p g1_num in \p graph1 - * is compatible with vertex (or edge) \p g2_num in \p graph2. - */ - -typedef igraph_bool_t igraph_isocompat_t(const igraph_t *graph1, - const igraph_t *graph2, - const igraph_integer_t g1_num, - const igraph_integer_t g2_num, - void *arg); - -IGRAPH_EXPORT int igraph_isomorphic_vf2(const igraph_t *graph1, const igraph_t *graph2, - const igraph_vector_int_t *vertex_color1, - const igraph_vector_int_t *vertex_color2, - const igraph_vector_int_t *edge_color1, - const igraph_vector_int_t *edge_color2, - igraph_bool_t *iso, - igraph_vector_t *map12, - igraph_vector_t *map21, - igraph_isocompat_t *node_compat_fn, - igraph_isocompat_t *edge_compat_fn, - void *arg); -IGRAPH_EXPORT int igraph_isomorphic_function_vf2(const igraph_t *graph1, const igraph_t *graph2, - const igraph_vector_int_t *vertex_color1, - const igraph_vector_int_t *vertex_color2, - const igraph_vector_int_t *edge_color1, - const igraph_vector_int_t *edge_color2, - igraph_vector_t *map12, igraph_vector_t *map21, - igraph_isohandler_t *isohandler_fn, - igraph_isocompat_t *node_compat_fn, - igraph_isocompat_t *edge_compat_fn, - void *arg); -IGRAPH_EXPORT int igraph_count_isomorphisms_vf2(const igraph_t *graph1, const igraph_t *graph2, - const igraph_vector_int_t *vertex_color1, - const igraph_vector_int_t *vertex_color2, - const igraph_vector_int_t *edge_color1, - const igraph_vector_int_t *edge_color2, - igraph_integer_t *count, - igraph_isocompat_t *node_compat_fn, - igraph_isocompat_t *edge_compat_fn, - void *arg); -IGRAPH_EXPORT int igraph_get_isomorphisms_vf2(const igraph_t *graph1, - const igraph_t *graph2, - const igraph_vector_int_t *vertex_color1, - const igraph_vector_int_t *vertex_color2, - const igraph_vector_int_t *edge_color1, - const igraph_vector_int_t *edge_color2, - igraph_vector_ptr_t *maps, - igraph_isocompat_t *node_compat_fn, - igraph_isocompat_t *edge_compat_fn, - void *arg); - -IGRAPH_EXPORT int igraph_subisomorphic_vf2(const igraph_t *graph1, const igraph_t *graph2, - const igraph_vector_int_t *vertex_color1, - const igraph_vector_int_t *vertex_color2, - const igraph_vector_int_t *edge_color1, - const igraph_vector_int_t *edge_color2, - igraph_bool_t *iso, - igraph_vector_t *map12, - igraph_vector_t *map21, - igraph_isocompat_t *node_compat_fn, - igraph_isocompat_t *edge_compat_fn, - void *arg); -IGRAPH_EXPORT int igraph_subisomorphic_function_vf2(const igraph_t *graph1, - const igraph_t *graph2, - const igraph_vector_int_t *vertex_color1, - const igraph_vector_int_t *vertex_color2, - const igraph_vector_int_t *edge_color1, - const igraph_vector_int_t *edge_color2, - igraph_vector_t *map12, - igraph_vector_t *map21, - igraph_isohandler_t *isohandler_fn, - igraph_isocompat_t *node_compat_fn, - igraph_isocompat_t *edge_compat_fn, - void *arg); -IGRAPH_EXPORT int igraph_count_subisomorphisms_vf2(const igraph_t *graph1, const igraph_t *graph2, - const igraph_vector_int_t *vertex_color1, - const igraph_vector_int_t *vertex_color2, - const igraph_vector_int_t *edge_color1, - const igraph_vector_int_t *edge_color2, - igraph_integer_t *count, - igraph_isocompat_t *node_compat_fn, - igraph_isocompat_t *edge_compat_fn, - void *arg); -IGRAPH_EXPORT int igraph_get_subisomorphisms_vf2(const igraph_t *graph1, - const igraph_t *graph2, - const igraph_vector_int_t *vertex_color1, - const igraph_vector_int_t *vertex_color2, - const igraph_vector_int_t *edge_color1, - const igraph_vector_int_t *edge_color2, - igraph_vector_ptr_t *maps, - igraph_isocompat_t *node_compat_fn, - igraph_isocompat_t *edge_compat_fn, - void *arg); - -/* BLISS family */ -/** - * \struct igraph_bliss_info_t - * Information about a BLISS run - * - * Some secondary information found by the BLISS algorithm is stored - * here. It is useful if you wany to study the internal working of the - * algorithm. - * \member nof_nodes The number of nodes in the search tree. - * \member nof_leaf_nodes The number of leaf nodes in the search tree. - * \member nof_bad_nodes Number of bad nodes. - * \member nof_canupdates Number of canrep updates. - * \member nof_generators Number of generators of the automorphism group. - * \member max_level Maximum level. - * \member group_size The size of the automorphism group of the graph, - * given as a string. It should be deallocated via - * \ref igraph_free() if not needed any more. - * - * See http://www.tcs.hut.fi/Software/bliss/index.html - * for details about the algorithm and these parameters. - */ -typedef struct igraph_bliss_info_t { - unsigned long nof_nodes; - unsigned long nof_leaf_nodes; - unsigned long nof_bad_nodes; - unsigned long nof_canupdates; - unsigned long nof_generators; - unsigned long max_level; - char *group_size; -} igraph_bliss_info_t; - -/** - * \typedef igraph_bliss_sh_t - * \brief Splitting heuristics for Bliss. - * - * \c IGRAPH_BLISS_FL provides good performance for many graphs, and is a reasonable - * default choice. \c IGRAPH_BLISS_FSM is recommended for graphs that have some - * combinatorial structure, and is the default of the Bliss library's command - * line tool. - * - * \enumval IGRAPH_BLISS_F First non-singleton cell. - * \enumval IGRAPH_BLISS_FL First largest non-singleton cell. - * \enumval IGRAPH_BLISS_FS First smallest non-singleton cell. - * \enumval IGRAPH_BLISS_FM First maximally non-trivially connected - * non-singleton cell. - * \enumval IGRAPH_BLISS_FLM Largest maximally non-trivially connected - * non-singleton cell. - * \enumval IGRAPH_BLISS_FSM Smallest maximally non-trivially - * connected non-singletion cell. - */ - -typedef enum { IGRAPH_BLISS_F = 0, IGRAPH_BLISS_FL, - IGRAPH_BLISS_FS, IGRAPH_BLISS_FM, - IGRAPH_BLISS_FLM, IGRAPH_BLISS_FSM - } igraph_bliss_sh_t; - -IGRAPH_EXPORT int igraph_canonical_permutation(const igraph_t *graph, const igraph_vector_int_t *colors, igraph_vector_t *labeling, - igraph_bliss_sh_t sh, igraph_bliss_info_t *info); -IGRAPH_EXPORT int igraph_isomorphic_bliss(const igraph_t *graph1, const igraph_t *graph2, - const igraph_vector_int_t *colors1, const igraph_vector_int_t *colors2, - igraph_bool_t *iso, igraph_vector_t *map12, - igraph_vector_t *map21, - igraph_bliss_sh_t sh, - igraph_bliss_info_t *info1, igraph_bliss_info_t *info2); - -IGRAPH_EXPORT int igraph_automorphisms(const igraph_t *graph, const igraph_vector_int_t *colors, - igraph_bliss_sh_t sh, igraph_bliss_info_t *info); - -IGRAPH_EXPORT int igraph_automorphism_group(const igraph_t *graph, const igraph_vector_int_t *colors, igraph_vector_ptr_t *generators, - igraph_bliss_sh_t sh, igraph_bliss_info_t *info); - -/* Functions for 3-4 graphs */ -IGRAPH_EXPORT int igraph_isomorphic_34(const igraph_t *graph1, const igraph_t *graph2, - igraph_bool_t *iso); -IGRAPH_EXPORT int igraph_isoclass(const igraph_t *graph, igraph_integer_t *isoclass); -IGRAPH_EXPORT int igraph_isoclass_subgraph(const igraph_t *graph, const igraph_vector_t *vids, - igraph_integer_t *isoclass); -IGRAPH_EXPORT int igraph_isoclass_create(igraph_t *graph, igraph_integer_t size, - igraph_integer_t number, igraph_bool_t directed); - - - - -__END_DECLS - -#endif diff --git a/src/include/igraph_transitivity.h b/src/include/igraph_transitivity.h deleted file mode 100644 index 33aee5410a..0000000000 --- a/src/include/igraph_transitivity.h +++ /dev/null @@ -1,63 +0,0 @@ -/* -*- mode: C -*- */ -/* - IGraph library. - Copyright (C) 2009-2012 Gabor Csardi - 334 Harvard street, Cambridge, MA 02139 USA - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA - -*/ - -#ifndef IGRAPH_TRANSITIVITY_H -#define IGRAPH_TRANSITIVITY_H - -#include "igraph_decls.h" -#include "igraph_datatype.h" -#include "igraph_constants.h" -#include "igraph_iterators.h" - -__BEGIN_DECLS - -IGRAPH_EXPORT int igraph_transitivity_undirected(const igraph_t *graph, - igraph_real_t *res, - igraph_transitivity_mode_t mode); -IGRAPH_EXPORT int igraph_transitivity_local_undirected(const igraph_t *graph, - igraph_vector_t *res, - const igraph_vs_t vids, - igraph_transitivity_mode_t mode); -IGRAPH_EXPORT int igraph_transitivity_local_undirected1(const igraph_t *graph, - igraph_vector_t *res, - const igraph_vs_t vids, - igraph_transitivity_mode_t mode); -IGRAPH_EXPORT int igraph_transitivity_local_undirected2(const igraph_t *graph, - igraph_vector_t *res, - const igraph_vs_t vids, - igraph_transitivity_mode_t mode); -IGRAPH_EXPORT int igraph_transitivity_local_undirected4(const igraph_t *graph, - igraph_vector_t *res, - igraph_transitivity_mode_t mode); -IGRAPH_EXPORT int igraph_transitivity_avglocal_undirected(const igraph_t *graph, - igraph_real_t *res, - igraph_transitivity_mode_t mode); -IGRAPH_EXPORT int igraph_transitivity_barrat(const igraph_t *graph, - igraph_vector_t *res, - const igraph_vs_t vids, - const igraph_vector_t *weights, - const igraph_transitivity_mode_t mode); - -__END_DECLS - -#endif diff --git a/src/include/igraph_types.h b/src/include/igraph_types.h deleted file mode 100644 index 07e4befaa6..0000000000 --- a/src/include/igraph_types.h +++ /dev/null @@ -1,75 +0,0 @@ -/* -*- mode: C -*- */ -/* - IGraph library. - Copyright (C) 2003-2012 Gabor Csardi - 334 Harvard street, Cambridge, MA 02139 USA - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA - -*/ - -#ifndef IGRAPH_TYPES_H -#define IGRAPH_TYPES_H - -#include "igraph_decls.h" - -__BEGIN_DECLS - -#ifndef _GNU_SOURCE - #define _GNU_SOURCE 1 -#endif - -#include "igraph_error.h" -#include -#include -#include - -typedef int igraph_integer_t; -typedef double igraph_real_t; -typedef int igraph_bool_t; - -/* printf format specifier for igraph_integer_t */ -#define IGRAPH_PRId "d" - -/* Replacements for printf that print doubles in the same way on all platforms - * (even for NaN and infinities) */ -IGRAPH_EXPORT int igraph_real_printf(igraph_real_t val); -IGRAPH_EXPORT int igraph_real_fprintf(FILE *file, igraph_real_t val); -IGRAPH_EXPORT int igraph_real_snprintf(char* str, size_t size, igraph_real_t val); - -/* Replacements for printf that print doubles in the same way on all platforms - * (even for NaN and infinities) with the largest possible precision */ -IGRAPH_EXPORT int igraph_real_printf_precise(igraph_real_t val); -IGRAPH_EXPORT int igraph_real_fprintf_precise(FILE *file, igraph_real_t val); -IGRAPH_EXPORT int igraph_real_snprintf_precise(char* str, size_t size, igraph_real_t val); - -#define IGRAPH_INFINITY INFINITY -#define IGRAPH_POSINFINITY INFINITY -#define IGRAPH_NEGINFINITY (-INFINITY) - -IGRAPH_EXPORT int igraph_finite(double x); -#define IGRAPH_FINITE(x) igraph_finite(x) - -IGRAPH_EXPORT int igraph_is_nan(double x); -IGRAPH_EXPORT int igraph_is_inf(double x); -IGRAPH_EXPORT int igraph_is_posinf(double x); -IGRAPH_EXPORT int igraph_is_neginf(double x); - -#define IGRAPH_NAN NAN - -__END_DECLS - -#endif diff --git a/src/include/igraph_vector.h b/src/include/igraph_vector.h deleted file mode 100644 index 8077328964..0000000000 --- a/src/include/igraph_vector.h +++ /dev/null @@ -1,183 +0,0 @@ -/* -*- mode: C -*- */ -/* - IGraph library. - Copyright (C) 2009-2012 Gabor Csardi - 334 Harvard street, Cambridge, MA 02139 USA - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA - -*/ - -#ifndef IGRAPH_VECTOR_H -#define IGRAPH_VECTOR_H - -#include "igraph_decls.h" -#include "igraph_types.h" -#include "igraph_complex.h" - -__BEGIN_DECLS - -/* -------------------------------------------------- */ -/* Flexible vector */ -/* -------------------------------------------------- */ - -#define BASE_IGRAPH_REAL -#include "igraph_pmt.h" -#include "igraph_vector_type.h" -#include "igraph_pmt_off.h" -#undef BASE_IGRAPH_REAL - -#define BASE_FLOAT -#include "igraph_pmt.h" -#include "igraph_vector_type.h" -#include "igraph_pmt_off.h" -#undef BASE_FLOAT - -#define BASE_LONG -#include "igraph_pmt.h" -#include "igraph_vector_type.h" -#include "igraph_pmt_off.h" -#undef BASE_LONG - -#define BASE_CHAR -#include "igraph_pmt.h" -#include "igraph_vector_type.h" -#include "igraph_pmt_off.h" -#undef BASE_CHAR - -#define BASE_BOOL -#include "igraph_pmt.h" -#include "igraph_vector_type.h" -#include "igraph_pmt_off.h" -#undef BASE_BOOL - -#define BASE_INT -#include "igraph_pmt.h" -#include "igraph_vector_type.h" -#include "igraph_pmt_off.h" -#undef BASE_INT - -#define BASE_COMPLEX -#include "igraph_pmt.h" -#include "igraph_vector_type.h" -#include "igraph_pmt_off.h" -#undef BASE_COMPLEX - -#define BASE_IGRAPH_REAL -#include "igraph_pmt.h" -#include "igraph_vector_pmt.h" -#include "igraph_pmt_off.h" -#undef BASE_IGRAPH_REAL - -#define BASE_FLOAT -#include "igraph_pmt.h" -#include "igraph_vector_pmt.h" -#include "igraph_pmt_off.h" -#undef BASE_FLOAT - -#define BASE_LONG -#include "igraph_pmt.h" -#include "igraph_vector_pmt.h" -#include "igraph_pmt_off.h" -#undef BASE_LONG - -#define BASE_CHAR -#include "igraph_pmt.h" -#include "igraph_vector_pmt.h" -#include "igraph_pmt_off.h" -#undef BASE_CHAR - -#define BASE_BOOL -#include "igraph_pmt.h" -#include "igraph_vector_pmt.h" -#include "igraph_pmt_off.h" -#undef BASE_BOOL - -#define BASE_INT -#include "igraph_pmt.h" -#include "igraph_vector_pmt.h" -#include "igraph_pmt_off.h" -#undef BASE_INT - -#define BASE_COMPLEX -#include "igraph_pmt.h" -#include "igraph_vector_pmt.h" -#include "igraph_pmt_off.h" -#undef BASE_COMPLEX - -/* -------------------------------------------------- */ -/* Helper macros */ -/* -------------------------------------------------- */ - -#ifndef IGRAPH_VECTOR_NULL - #define IGRAPH_VECTOR_NULL { 0,0,0 } -#endif - -#ifndef IGRAPH_VECTOR_INIT_FINALLY -#define IGRAPH_VECTOR_INIT_FINALLY(v, size) \ - do { IGRAPH_CHECK(igraph_vector_init(v, size)); \ - IGRAPH_FINALLY(igraph_vector_destroy, v); } while (0) -#endif -#ifndef IGRAPH_VECTOR_BOOL_INIT_FINALLY -#define IGRAPH_VECTOR_BOOL_INIT_FINALLY(v, size) \ - do { IGRAPH_CHECK(igraph_vector_bool_init(v, size)); \ - IGRAPH_FINALLY(igraph_vector_bool_destroy, v); } while (0) -#endif -#ifndef IGRAPH_VECTOR_CHAR_INIT_FINALLY -#define IGRAPH_VECTOR_CHAR_INIT_FINALLY(v, size) \ - do { IGRAPH_CHECK(igraph_vector_char_init(v, size)); \ - IGRAPH_FINALLY(igraph_vector_char_destroy, v); } while (0) -#endif -#ifndef IGRAPH_VECTOR_INT_INIT_FINALLY -#define IGRAPH_VECTOR_INT_INIT_FINALLY(v, size) \ - do { IGRAPH_CHECK(igraph_vector_int_init(v, size)); \ - IGRAPH_FINALLY(igraph_vector_int_destroy, v); } while (0) -#endif -#ifndef IGRAPH_VECTOR_LONG_INIT_FINALLY -#define IGRAPH_VECTOR_LONG_INIT_FINALLY(v, size) \ - do { IGRAPH_CHECK(igraph_vector_long_init(v, size)); \ - IGRAPH_FINALLY(igraph_vector_long_destroy, v); } while (0) -#endif - -/* -------------------------------------------------- */ -/* Type-specific vector functions */ -/* -------------------------------------------------- */ - -IGRAPH_EXPORT int igraph_vector_floor(const igraph_vector_t *from, igraph_vector_long_t *to); -IGRAPH_EXPORT int igraph_vector_round(const igraph_vector_t *from, igraph_vector_long_t *to); - -IGRAPH_EXPORT igraph_bool_t igraph_vector_e_tol(const igraph_vector_t *lhs, - const igraph_vector_t *rhs, - igraph_real_t tol); - -IGRAPH_EXPORT int igraph_vector_zapsmall(igraph_vector_t *v, igraph_real_t tol); - -IGRAPH_EXPORT int igraph_vector_order(const igraph_vector_t* v, const igraph_vector_t *v2, - igraph_vector_t* res, igraph_real_t maxval); -IGRAPH_EXPORT int igraph_vector_order1(const igraph_vector_t* v, - igraph_vector_t* res, igraph_real_t maxval); -IGRAPH_EXPORT int igraph_vector_order1_int(const igraph_vector_t* v, - igraph_vector_int_t* res, igraph_real_t maxval); -IGRAPH_EXPORT int igraph_vector_order2(igraph_vector_t *v); -IGRAPH_EXPORT int igraph_vector_rank(const igraph_vector_t *v, igraph_vector_t *res, - long int nodes); -IGRAPH_EXPORT int igraph_vector_is_nan(const igraph_vector_t *v, - igraph_vector_bool_t *is_nan); -IGRAPH_EXPORT igraph_bool_t igraph_vector_is_any_nan(const igraph_vector_t *v); - -__END_DECLS - -#endif diff --git a/src/include/igraph_vector_pmt.h b/src/include/igraph_vector_pmt.h deleted file mode 100644 index 1962d29256..0000000000 --- a/src/include/igraph_vector_pmt.h +++ /dev/null @@ -1,290 +0,0 @@ -/* -*- mode: C -*- */ -/* - IGraph library. - Copyright (C) 2007-2012 Gabor Csardi - 334 Harvard street, Cambridge, MA 02139 USA - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA - -*/ - -/*--------------------*/ -/* Allocation */ -/*--------------------*/ - -IGRAPH_EXPORT int FUNCTION(igraph_vector, init)(TYPE(igraph_vector)* v, long int size); -IGRAPH_EXPORT int FUNCTION(igraph_vector, init_copy)(TYPE(igraph_vector)* v, - const BASE* data, long int length); - -#ifndef NOTORDERED -IGRAPH_EXPORT int FUNCTION(igraph_vector, init_seq)(TYPE(igraph_vector)*v, BASE from, BASE to); -#endif - -IGRAPH_EXPORT int FUNCTION(igraph_vector, copy)(TYPE(igraph_vector) *to, - const TYPE(igraph_vector) *from); -IGRAPH_EXPORT void FUNCTION(igraph_vector, destroy)(TYPE(igraph_vector)* v); - -IGRAPH_EXPORT long int FUNCTION(igraph_vector, capacity)(const TYPE(igraph_vector)*v); - -/*--------------------*/ -/* Accessing elements */ -/*--------------------*/ - -#ifndef VECTOR -/** - * \ingroup vector - * \define VECTOR - * \brief Accessing an element of a vector. - * - * Usage: - * \verbatim VECTOR(v)[0] \endverbatim - * to access the first element of the vector, you can also use this in - * assignments, like: - * \verbatim VECTOR(v)[10]=5; \endverbatim - * - * Note that there are no range checks right now. - * This functionality might be redefined later as a real function - * instead of a #define. - * \param v The vector object. - * - * Time complexity: O(1). - */ -#define VECTOR(v) ((v).stor_begin) -#endif - -IGRAPH_EXPORT BASE FUNCTION(igraph_vector, e)(const TYPE(igraph_vector)* v, long int pos); -IGRAPH_EXPORT BASE* FUNCTION(igraph_vector, e_ptr)(const TYPE(igraph_vector)* v, long int pos); -IGRAPH_EXPORT void FUNCTION(igraph_vector, set)(TYPE(igraph_vector)* v, long int pos, BASE value); -IGRAPH_EXPORT BASE FUNCTION(igraph_vector, tail)(const TYPE(igraph_vector) *v); - -/*-----------------------*/ -/* Initializing elements */ -/*-----------------------*/ - -IGRAPH_EXPORT void FUNCTION(igraph_vector, null)(TYPE(igraph_vector)* v); -IGRAPH_EXPORT void FUNCTION(igraph_vector, fill)(TYPE(igraph_vector)* v, BASE e); - -/*-----------------------*/ -/* Vector views */ -/*-----------------------*/ - -IGRAPH_EXPORT const TYPE(igraph_vector) *FUNCTION(igraph_vector, view)(const TYPE(igraph_vector) *v, - const BASE *data, - long int length); - -/*-----------------------*/ -/* Copying vectors */ -/*-----------------------*/ - -IGRAPH_EXPORT void FUNCTION(igraph_vector, copy_to)(const TYPE(igraph_vector) *v, BASE* to); -IGRAPH_EXPORT int FUNCTION(igraph_vector, update)(TYPE(igraph_vector) *to, - const TYPE(igraph_vector) *from); -IGRAPH_EXPORT int FUNCTION(igraph_vector, append)(TYPE(igraph_vector) *to, - const TYPE(igraph_vector) *from); -IGRAPH_EXPORT int FUNCTION(igraph_vector, swap)(TYPE(igraph_vector) *v1, TYPE(igraph_vector) *v2); - -/*-----------------------*/ -/* Exchanging elements */ -/*-----------------------*/ - -IGRAPH_EXPORT int FUNCTION(igraph_vector, swap_elements)(TYPE(igraph_vector) *v, - long int i, long int j); -IGRAPH_EXPORT int FUNCTION(igraph_vector, reverse)(TYPE(igraph_vector) *v); -IGRAPH_EXPORT int FUNCTION(igraph_vector, shuffle)(TYPE(igraph_vector) *v); - -/*-----------------------*/ -/* Vector operations */ -/*-----------------------*/ - -IGRAPH_EXPORT void FUNCTION(igraph_vector, add_constant)(TYPE(igraph_vector) *v, BASE plus); -IGRAPH_EXPORT void FUNCTION(igraph_vector, scale)(TYPE(igraph_vector) *v, BASE by); -IGRAPH_EXPORT int FUNCTION(igraph_vector, add)(TYPE(igraph_vector) *v1, - const TYPE(igraph_vector) *v2); -IGRAPH_EXPORT int FUNCTION(igraph_vector, sub)(TYPE(igraph_vector) *v1, - const TYPE(igraph_vector) *v2); -IGRAPH_EXPORT int FUNCTION(igraph_vector, mul)(TYPE(igraph_vector) *v1, - const TYPE(igraph_vector) *v2); -IGRAPH_EXPORT int FUNCTION(igraph_vector, div)(TYPE(igraph_vector) *v1, - const TYPE(igraph_vector) *v2); -IGRAPH_EXPORT int FUNCTION(igraph_vector, cumsum)(TYPE(igraph_vector) *to, - const TYPE(igraph_vector) *from); - -#ifndef NOABS - IGRAPH_EXPORT int FUNCTION(igraph_vector, abs)(TYPE(igraph_vector) *v); -#endif - -/*------------------------------*/ -/* Comparison */ -/*------------------------------*/ - -IGRAPH_EXPORT igraph_bool_t FUNCTION(igraph_vector, all_e)(const TYPE(igraph_vector) *lhs, - const TYPE(igraph_vector) *rhs); -#ifndef NOTORDERED -IGRAPH_EXPORT igraph_bool_t FUNCTION(igraph_vector, all_l)(const TYPE(igraph_vector) *lhs, - const TYPE(igraph_vector) *rhs); -IGRAPH_EXPORT igraph_bool_t FUNCTION(igraph_vector, all_g)(const TYPE(igraph_vector) *lhs, - const TYPE(igraph_vector) *rhs); -IGRAPH_EXPORT igraph_bool_t FUNCTION(igraph_vector, all_le)(const TYPE(igraph_vector) *lhs, - const TYPE(igraph_vector) *rhs); -IGRAPH_EXPORT igraph_bool_t FUNCTION(igraph_vector, all_ge)(const TYPE(igraph_vector) *lhs, - const TYPE(igraph_vector) *rhs); -IGRAPH_EXPORT int FUNCTION(igraph_vector, lex_cmp)(const void *lhs, - const void *rhs); -IGRAPH_EXPORT int FUNCTION(igraph_vector, colex_cmp)(const void *lhs, - const void *rhs); -#endif - -/*------------------------------*/ -/* Finding minimum and maximum */ -/*------------------------------*/ - -#ifndef NOTORDERED -IGRAPH_EXPORT BASE FUNCTION(igraph_vector, min)(const TYPE(igraph_vector)* v); -IGRAPH_EXPORT BASE FUNCTION(igraph_vector, max)(const TYPE(igraph_vector)* v); -IGRAPH_EXPORT long int FUNCTION(igraph_vector, which_min)(const TYPE(igraph_vector)* v); -IGRAPH_EXPORT long int FUNCTION(igraph_vector, which_max)(const TYPE(igraph_vector)* v); -IGRAPH_EXPORT int FUNCTION(igraph_vector, minmax)(const TYPE(igraph_vector) *v, - BASE *min, BASE *max); -IGRAPH_EXPORT int FUNCTION(igraph_vector, which_minmax)(const TYPE(igraph_vector) *v, - long int *which_min, long int *which_max); -#endif - -/*-------------------*/ -/* Vector properties */ -/*-------------------*/ - -IGRAPH_EXPORT igraph_bool_t FUNCTION(igraph_vector, empty) (const TYPE(igraph_vector)* v); -IGRAPH_EXPORT long int FUNCTION(igraph_vector, size) (const TYPE(igraph_vector)* v); -IGRAPH_EXPORT igraph_bool_t FUNCTION(igraph_vector, isnull)(const TYPE(igraph_vector) *v); -IGRAPH_EXPORT BASE FUNCTION(igraph_vector, sum)(const TYPE(igraph_vector) *v); -IGRAPH_EXPORT igraph_real_t FUNCTION(igraph_vector, sumsq)(const TYPE(igraph_vector) *v); -IGRAPH_EXPORT BASE FUNCTION(igraph_vector, prod)(const TYPE(igraph_vector) *v); -#ifndef NOTORDERED -IGRAPH_EXPORT igraph_bool_t FUNCTION(igraph_vector, isininterval)(const TYPE(igraph_vector) *v, - BASE low, BASE high); -IGRAPH_EXPORT igraph_bool_t FUNCTION(igraph_vector, any_smaller)(const TYPE(igraph_vector) *v, - BASE limit); -#endif -IGRAPH_EXPORT igraph_bool_t FUNCTION(igraph_vector, is_equal)(const TYPE(igraph_vector) *lhs, - const TYPE(igraph_vector) *rhs); -#ifndef NOTORDERED -IGRAPH_EXPORT igraph_real_t FUNCTION(igraph_vector, maxdifference)(const TYPE(igraph_vector) *m1, - const TYPE(igraph_vector) *m2); -#endif - -/*------------------------*/ -/* Searching for elements */ -/*------------------------*/ - -IGRAPH_EXPORT igraph_bool_t FUNCTION(igraph_vector, contains)(const TYPE(igraph_vector) *v, BASE e); -IGRAPH_EXPORT igraph_bool_t FUNCTION(igraph_vector, search)(const TYPE(igraph_vector) *v, - long int from, BASE what, - long int *pos); -#ifndef NOTORDERED -IGRAPH_EXPORT igraph_bool_t FUNCTION(igraph_vector, binsearch_slice)(const TYPE(igraph_vector) *v, - BASE what, long int *pos, - long int start, long int end); -IGRAPH_EXPORT igraph_bool_t FUNCTION(igraph_vector, binsearch)(const TYPE(igraph_vector) *v, - BASE what, long int *pos); -IGRAPH_EXPORT igraph_bool_t FUNCTION(igraph_vector, binsearch2)(const TYPE(igraph_vector) *v, - BASE what); -#endif - -/*------------------------*/ -/* Resizing operations */ -/*------------------------*/ - -IGRAPH_EXPORT void FUNCTION(igraph_vector, clear)(TYPE(igraph_vector)* v); -IGRAPH_EXPORT int FUNCTION(igraph_vector, resize)(TYPE(igraph_vector)* v, long int newsize); -IGRAPH_EXPORT int FUNCTION(igraph_vector, resize_min)(TYPE(igraph_vector)*v); -IGRAPH_EXPORT int FUNCTION(igraph_vector, reserve)(TYPE(igraph_vector)* v, long int size); -IGRAPH_EXPORT int FUNCTION(igraph_vector, push_back)(TYPE(igraph_vector)* v, BASE e); -IGRAPH_EXPORT BASE FUNCTION(igraph_vector, pop_back)(TYPE(igraph_vector)* v); -IGRAPH_EXPORT int FUNCTION(igraph_vector, insert)(TYPE(igraph_vector) *v, long int pos, BASE value); -IGRAPH_EXPORT void FUNCTION(igraph_vector, remove)(TYPE(igraph_vector) *v, long int elem); -IGRAPH_EXPORT void FUNCTION(igraph_vector, remove_section)(TYPE(igraph_vector) *v, - long int from, long int to); - -/*-----------*/ -/* Sorting */ -/*-----------*/ - -#ifndef NOTORDERED - -IGRAPH_EXPORT void FUNCTION(igraph_vector, sort)(TYPE(igraph_vector) *v); -IGRAPH_EXPORT void FUNCTION(igraph_vector, reverse_sort)(TYPE(igraph_vector) *v); -IGRAPH_EXPORT long int FUNCTION(igraph_vector, qsort_ind)(TYPE(igraph_vector) *v, - igraph_vector_t *inds, igraph_bool_t descending); - -#endif - -/*-----------*/ -/* Printing */ -/*-----------*/ - -IGRAPH_EXPORT int FUNCTION(igraph_vector, print)(const TYPE(igraph_vector) *v); -IGRAPH_EXPORT int FUNCTION(igraph_vector, printf)(const TYPE(igraph_vector) *v, - const char *format); -IGRAPH_EXPORT int FUNCTION(igraph_vector, fprint)(const TYPE(igraph_vector) *v, FILE *file); - -#ifdef BASE_COMPLEX - -IGRAPH_EXPORT int igraph_vector_complex_real(const igraph_vector_complex_t *v, - igraph_vector_t *real); -IGRAPH_EXPORT int igraph_vector_complex_imag(const igraph_vector_complex_t *v, - igraph_vector_t *imag); -IGRAPH_EXPORT int igraph_vector_complex_realimag(const igraph_vector_complex_t *v, - igraph_vector_t *real, - igraph_vector_t *imag); -IGRAPH_EXPORT int igraph_vector_complex_create(igraph_vector_complex_t *v, - const igraph_vector_t *real, - const igraph_vector_t *imag); -IGRAPH_EXPORT int igraph_vector_complex_create_polar(igraph_vector_complex_t *v, - const igraph_vector_t *r, - const igraph_vector_t *theta); - -#endif - -IGRAPH_EXPORT int FUNCTION(igraph_vector, init_real)(TYPE(igraph_vector)*v, int no, ...); -IGRAPH_EXPORT int FUNCTION(igraph_vector, init_int)(TYPE(igraph_vector)*v, int no, ...); -IGRAPH_EXPORT int FUNCTION(igraph_vector, init_real_end)(TYPE(igraph_vector)*v, double endmark, ...); -IGRAPH_EXPORT int FUNCTION(igraph_vector, init_int_end)(TYPE(igraph_vector)*v, int endmark, ...); - -IGRAPH_EXPORT int FUNCTION(igraph_vector, move_interval)(TYPE(igraph_vector) *v, - long int begin, long int end, long int to); -IGRAPH_EXPORT int FUNCTION(igraph_vector, move_interval2)(TYPE(igraph_vector) *v, - long int begin, long int end, long int to); -IGRAPH_EXPORT void FUNCTION(igraph_vector, permdelete)(TYPE(igraph_vector) *v, - const igraph_vector_t *index, - long int nremove); -#ifndef NOTORDERED -IGRAPH_EXPORT int FUNCTION(igraph_vector, filter_smaller)(TYPE(igraph_vector) *v, BASE elem); -#endif -IGRAPH_EXPORT int FUNCTION(igraph_vector, get_interval)(const TYPE(igraph_vector) *v, - TYPE(igraph_vector) *res, - long int from, long int to); -#ifndef NOTORDERED -IGRAPH_EXPORT int FUNCTION(igraph_vector, difference_sorted)(const TYPE(igraph_vector) *v1, - const TYPE(igraph_vector) *v2, TYPE(igraph_vector) *result); -IGRAPH_EXPORT int FUNCTION(igraph_vector, intersect_sorted)(const TYPE(igraph_vector) *v1, - const TYPE(igraph_vector) *v2, TYPE(igraph_vector) *result); -#endif -IGRAPH_EXPORT int FUNCTION(igraph_vector, index)(const TYPE(igraph_vector) *v, - TYPE(igraph_vector) *newv, - const igraph_vector_t *idx); - -IGRAPH_EXPORT int FUNCTION(igraph_vector, index_int)(TYPE(igraph_vector) *v, - const igraph_vector_int_t *idx); diff --git a/src/include/igraph_vector_ptr.h b/src/include/igraph_vector_ptr.h deleted file mode 100644 index c2667be29e..0000000000 --- a/src/include/igraph_vector_ptr.h +++ /dev/null @@ -1,100 +0,0 @@ -/* -*- mode: C -*- */ -/* - IGraph library. - Copyright (C) 2009-2012 Gabor Csardi - 334 Harvard street, Cambridge, MA 02139 USA - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA - -*/ - -#ifndef IGRAPH_VECTOR_PTR_H -#define IGRAPH_VECTOR_PTR_H - -#include "igraph_decls.h" -#include "igraph_vector.h" - -__BEGIN_DECLS - -/* -------------------------------------------------- */ -/* Flexible vector, storing pointers */ -/* -------------------------------------------------- */ - -/** - * Vector, storing pointers efficiently - * \ingroup internal - * - */ -typedef struct s_vector_ptr { - void** stor_begin; - void** stor_end; - void** end; - igraph_finally_func_t* item_destructor; -} igraph_vector_ptr_t; - -#define IGRAPH_VECTOR_PTR_NULL { 0,0,0,0 } -#define IGRAPH_VECTOR_PTR_INIT_FINALLY(v, size) \ - do { IGRAPH_CHECK(igraph_vector_ptr_init(v, size)); \ - IGRAPH_FINALLY(igraph_vector_ptr_destroy, v); } while (0) - -IGRAPH_EXPORT int igraph_vector_ptr_init (igraph_vector_ptr_t* v, long int size); -IGRAPH_EXPORT int igraph_vector_ptr_init_copy (igraph_vector_ptr_t* v, void** data, long int length); -IGRAPH_EXPORT const igraph_vector_ptr_t *igraph_vector_ptr_view (const igraph_vector_ptr_t *v, - void *const *data, long int length); -IGRAPH_EXPORT void igraph_vector_ptr_destroy (igraph_vector_ptr_t* v); -IGRAPH_EXPORT void igraph_vector_ptr_free_all (igraph_vector_ptr_t* v); -IGRAPH_EXPORT void igraph_vector_ptr_destroy_all (igraph_vector_ptr_t* v); -IGRAPH_EXPORT int igraph_vector_ptr_reserve (igraph_vector_ptr_t* v, long int size); -IGRAPH_EXPORT igraph_bool_t igraph_vector_ptr_empty (const igraph_vector_ptr_t* v); -IGRAPH_EXPORT long int igraph_vector_ptr_size (const igraph_vector_ptr_t* v); -IGRAPH_EXPORT void igraph_vector_ptr_clear (igraph_vector_ptr_t* v); -IGRAPH_EXPORT void igraph_vector_ptr_null (igraph_vector_ptr_t* v); -IGRAPH_EXPORT int igraph_vector_ptr_push_back (igraph_vector_ptr_t* v, void* e); -IGRAPH_EXPORT int igraph_vector_ptr_append (igraph_vector_ptr_t *to, - const igraph_vector_ptr_t *from); -IGRAPH_EXPORT void *igraph_vector_ptr_pop_back (igraph_vector_ptr_t *v); -IGRAPH_EXPORT int igraph_vector_ptr_insert(igraph_vector_ptr_t *v, long int pos, void* e); -IGRAPH_EXPORT void* igraph_vector_ptr_e (const igraph_vector_ptr_t* v, long int pos); -IGRAPH_EXPORT void igraph_vector_ptr_set (igraph_vector_ptr_t* v, long int pos, void* value); -IGRAPH_EXPORT int igraph_vector_ptr_resize(igraph_vector_ptr_t* v, long int newsize); -IGRAPH_EXPORT void igraph_vector_ptr_copy_to(const igraph_vector_ptr_t *v, void** to); -IGRAPH_EXPORT int igraph_vector_ptr_copy(igraph_vector_ptr_t *to, const igraph_vector_ptr_t *from); -IGRAPH_EXPORT void igraph_vector_ptr_remove(igraph_vector_ptr_t *v, long int pos); -IGRAPH_EXPORT void igraph_vector_ptr_sort(igraph_vector_ptr_t *v, int(*compar)(const void*, const void*)); -IGRAPH_EXPORT int igraph_vector_ptr_index_int(igraph_vector_ptr_t *v, - const igraph_vector_int_t *idx); - -IGRAPH_EXPORT igraph_finally_func_t* igraph_vector_ptr_get_item_destructor(const igraph_vector_ptr_t *v); -IGRAPH_EXPORT igraph_finally_func_t* igraph_vector_ptr_set_item_destructor(igraph_vector_ptr_t *v, - igraph_finally_func_t *func); - -/** - * \define IGRAPH_VECTOR_PTR_SET_ITEM_DESTRUCTOR - * \brief Sets the item destructor for this pointer vector (macro version). - * - * This macro is expanded to \ref igraph_vector_ptr_set_item_destructor(), the - * only difference is that the second argument is automatically cast to an - * \c igraph_finally_func_t*. The cast is necessary in most cases as the - * destructor functions we use (such as \ref igraph_vector_destroy()) take a - * pointer to some concrete igraph data type, while \c igraph_finally_func_t - * expects \c void* - */ -#define IGRAPH_VECTOR_PTR_SET_ITEM_DESTRUCTOR(v, func) \ - igraph_vector_ptr_set_item_destructor((v), (igraph_finally_func_t*)(func)) - -__END_DECLS - -#endif diff --git a/src/include/igraph_vector_type.h b/src/include/igraph_vector_type.h deleted file mode 100644 index fef9d9ff73..0000000000 --- a/src/include/igraph_vector_type.h +++ /dev/null @@ -1,33 +0,0 @@ -/* -*- mode: C -*- */ -/* - IGraph library. - Copyright (C) 2013 Gabor Csardi - 334 Harvard street, Cambridge, MA 02139 USA - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA - -*/ - -/** - * Vector, dealing with arrays efficiently. - * \ingroup types - */ - -typedef struct TYPE(igraph_vector) { - BASE* stor_begin; - BASE* stor_end; - BASE* end; -} TYPE(igraph_vector); diff --git a/src/include/igraph_version.h b/src/include/igraph_version.h deleted file mode 100644 index fda42278d8..0000000000 --- a/src/include/igraph_version.h +++ /dev/null @@ -1,44 +0,0 @@ -/* -*- mode: C -*- */ -/* - IGraph library. - Copyright (C) 2010-2012 Gabor Csardi - 334 Harvard street, Cambridge, MA 02139 USA - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA - -*/ - -#ifndef IGRAPH_VERSION_H -#define IGRAPH_VERSION_H - -#include "igraph_decls.h" - -__BEGIN_DECLS - -#define IGRAPH_VERSION "@PACKAGE_VERSION@" -#define IGRAPH_VERSION_MAJOR @PACKAGE_VERSION_MAJOR@ -#define IGRAPH_VERSION_MINOR @PACKAGE_VERSION_MINOR@ -#define IGRAPH_VERSION_PATCH @PACKAGE_VERSION_PATCH@ -#define IGRAPH_VERSION_PRERELEASE "@PACKAGE_VERSION_PRERELEASE@" - -IGRAPH_EXPORT void igraph_version(const char **version_string, - int *major, - int *minor, - int *subminor); - -__END_DECLS - -#endif diff --git a/src/include/igraph_version.h.in b/src/include/igraph_version.h.in deleted file mode 100644 index cae3cfa114..0000000000 --- a/src/include/igraph_version.h.in +++ /dev/null @@ -1,44 +0,0 @@ -/* -*- mode: C -*- */ -/* - IGraph library. - Copyright (C) 2010-2012 Gabor Csardi - 334 Harvard street, Cambridge, MA 02139 USA - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA - -*/ - -#ifndef IGRAPH_VERSION_H -#define IGRAPH_VERSION_H - -#include "igraph_decls.h" - -__BEGIN_DECLS - -#define IGRAPH_VERSION "@PACKAGE_VERSION@" -#define IGRAPH_VERSION_MAJOR @PACKAGE_VERSION_MAJOR@ -#define IGRAPH_VERSION_MINOR @PACKAGE_VERSION_MINOR@ -#define IGRAPH_VERSION_PATCH @PACKAGE_VERSION_PATCH@ -#define IGRAPH_VERSION_PRERELEASE "@PACKAGE_VERSION_PRERELEASE@" - -IGRAPH_EXPORT int igraph_version(const char **version_string, - int *major, - int *minor, - int *subminor); - -__END_DECLS - -#endif diff --git a/src/include/igraph_visitor.h b/src/include/igraph_visitor.h deleted file mode 100644 index 936ff654bf..0000000000 --- a/src/include/igraph_visitor.h +++ /dev/null @@ -1,132 +0,0 @@ -/* -*- mode: C -*- */ -/* - IGraph library. - Copyright (C) 2009-2012 Gabor Csardi - 334 Harvard street, Cambridge, MA 02139 USA - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA - -*/ - -#ifndef IGRAPH_VISITOR_H -#define IGRAPH_VISITOR_H - -#include "igraph_decls.h" -#include "igraph_constants.h" -#include "igraph_types.h" -#include "igraph_datatype.h" - -__BEGIN_DECLS - -/* -------------------------------------------------- */ -/* Visitor-like functions */ -/* -------------------------------------------------- */ - -/** - * \typedef igraph_bfshandler_t - * Callback type for BFS function - * - * \ref igraph_bfs() is able to call a callback function, whenever a - * new vertex is found, while doing the breadth-first search. This - * callback function must be of type \c igraph_bfshandler_t. It has - * the following arguments: - * \param graph The graph that that algorithm is working on. Of course - * this must not be modified. - * \param vid The id of the vertex just found by the breadth-first - * search. - * \param pred The id of the previous vertex visited. It is -1 if - * there is no previous vertex, because the current vertex is the root - * is a search tree. - * \param succ The id of the next vertex that will be visited. It is - * -1 if there is no next vertex, because the current vertex is the - * last one in a search tree. - * \param rank The rank of the current vertex, it starts with zero. - * \param dist The distance (number of hops) of the current vertex - * from the root of the current search tree. - * \param extra The extra argument that was passed to \ref - * igraph_bfs(). - * \return A logical value, if TRUE (=non-zero), that is interpreted - * as a request to stop the BFS and return to the caller. If a BFS - * is terminated like this, then all elements of the result vectors - * that were not yet calculated at the point of the termination - * contain NaN. - * - * \sa \ref igraph_bfs() - */ - -typedef igraph_bool_t igraph_bfshandler_t(const igraph_t *graph, - igraph_integer_t vid, - igraph_integer_t pred, - igraph_integer_t succ, - igraph_integer_t rank, - igraph_integer_t dist, - void *extra); - -IGRAPH_EXPORT int igraph_bfs(const igraph_t *graph, - igraph_integer_t root, const igraph_vector_t *roots, - igraph_neimode_t mode, igraph_bool_t unreachable, - const igraph_vector_t *restricted, - igraph_vector_t *order, igraph_vector_t *rank, - igraph_vector_t *father, - igraph_vector_t *pred, igraph_vector_t *succ, - igraph_vector_t *dist, igraph_bfshandler_t *callback, - void *extra); - -IGRAPH_EXPORT int igraph_bfs_simple(igraph_t *graph, igraph_integer_t vid, igraph_neimode_t mode, - igraph_vector_t *vids, igraph_vector_t *layers, - igraph_vector_t *parents); - -/** - * \function igraph_dfshandler_t - * Callback type for the DFS function - * - * \ref igraph_dfs() is able to call a callback function, whenever a - * new vertex is discovered, and/or whenever a subtree is - * completed. These callbacks must be of type \c - * igraph_dfshandler_t. They have the following arguments: - * \param graph The graph that that algorithm is working on. Of course - * this must not be modified. - * \param vid The id of the vertex just found by the depth-first - * search. - * \param dist The distance (number of hops) of the current vertex - * from the root of the current search tree. - * \param extra The extra argument that was passed to \ref - * igraph_dfs(). - * \return A logical value, if TRUE (=non-zero), that is interpreted - * as a request to stop the DFS and return to the caller. If a DFS - * is terminated like this, then all elements of the result vectors - * that were not yet calculated at the point of the termination - * contain NaN. - * - * \sa \ref igraph_dfs() - */ - -typedef igraph_bool_t igraph_dfshandler_t(const igraph_t *graph, - igraph_integer_t vid, - igraph_integer_t dist, - void *extra); - -IGRAPH_EXPORT int igraph_dfs(const igraph_t *graph, igraph_integer_t root, - igraph_neimode_t mode, igraph_bool_t unreachable, - igraph_vector_t *order, - igraph_vector_t *order_out, igraph_vector_t *father, - igraph_vector_t *dist, igraph_dfshandler_t *in_callback, - igraph_dfshandler_t *out_callback, - void *extra); - -__END_DECLS - -#endif