[igraph] problem with igraph_get_all_shortest_paths
From:
Guilherme Ferraz de Arruda
Subject:
[igraph] problem with igraph_get_all_shortest_paths
Date:
Sat, 2 Jul 2011 21:32:15 -0300
Hi,
I have tryed to make a function to implement the measure proposed at "Networks and cities: An information perspective" by Rosvall et al. Some times (with some graphs) my program doesnt work well, the memory grows (up to 40Gb, using swap) and the graph has less than 6000 nodes.
I want to know if i'm using this function correctly
My code is:
// Functions for Information Measure long int GetValue(igraph_vector_t *v, long int i){ return (long int) VECTOR(*v)[i]; }
long int GetLastValue(igraph_vector_t *v){ return (long int) VECTOR(*v)[igraph_vector_size(v)-1]; }
double Ppib(igraph_t* g, igraph_vector_t *v){ long int ki = 0, kj = 0; igraph_vector_t res0;
igraph_vector_init(&res0, 0);
double acc = 1.0;
igraph_degree(g, &res0, igraph_vss_1((igraph_integer_t)VECTOR(*v)[0]), IGRAPH_ALL, IGRAPH_NO_LOOPS); ki = (double)VECTOR(res0)[0]; igraph_vector_clear(&res0);
long int l = 0; for(l=1; l<igraph_vector_size(v) - 1; l++){ igraph_degree(g, &res0, igraph_vss_1((igraph_integer_t)VECTOR(*v)[l]), IGRAPH_ALL, IGRAPH_NO_LOOPS); kj = (double)VECTOR(res0)[0];
igraph_vector_clear(&res0);
acc *= (double)1.0/(double)(kj - 1.0); }
igraph_vector_destroy(&res0);
return acc/ki; }
int CreateSMatrix(igraph_t* g, double** S){
long int N = igraph_vcount(g);
long int vertice = 0; long int i = 0, j = 0, k = 0;