Hi,
I am debuting in igraph and am using c igraph 0.6.
I need to calculate distances within weighted graphs. Thus I've built the
graph from a weighted adjacency matrix, and then used
igraph_shortest_paths_dijkstra(). Everything was fine until working with
graph sizes of the order 10^4: Out of memory (apparently, the size was too
big for matrix). To overcome this situation I decided to build up the
graphs from a 3-column adjacency list (in format .ncol), that was fed into
"igraph_read_graph_ncol()". The edge query was done again using
igraph_cattribute_EANV(). When executing I get:
"Error at cattributes.c:1915 :Unknown attribute, Invalid value"
Please help me. The code is the following:
#include <igraph/igraph.h>
#include <stdio.h>
int main(void) {
FILE *fp;
fp=fopen("Matrixoutweight.ncol","r");
igraph_i_set_attribute_table(&igraph_cattribute_table);
igraph_t graph;
int i,j,nedges,nertex;
float test;
const char weight;
igraph_read_graph_ncol(&graph,fp,NULL,0,1,0);
nedges=igraph_ecount(&graph);
nertex=igraph_vcount(&graph);
igraph_vector_t weightatt;
igraph_vector_init(&weightatt,nedges);
igraph_matrix_t SP;
igraph_matrix_init(&SP,nertex,nertex);
igraph_cattribute_EANV(&graph,&weight,igraph_ess_all(IGRAPH_EDGEORDER_FROM)
, &weightatt);
igraph_shortest_paths_dijkstra(&graph,&SP,igraph_vss_all(),igraph_vss_all()
,&weightatt,IGRAPH_OUT);
for (i = 0; i < nertex ; i++)
{
for (j = 0; j < nertex; j++)
{
test=igraph_matrix_e(&SP,i,j);
printf("%d %d %f\n",i,j,test);
}
}
igraph_destroy(&graph);
igraph_vector_destroy(&weightatt);
igraph_matrix_destroy(&SP);
fclose(fp);
return 0;
}
Thanks in advance
_______________________________________________
igraph-help mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/igraph-help