Dear all, Just to keep this topic in a new thread I am writing you this new email.
Once I have calculated correctly the shortest paths of my large networks, I would like to calculate it considering the weights of the edges. To do it I am using Igraph 0.6, Gcc compiler 4.6.3 in a Ubuntu 12.04 in a machine 32 bits. I am trying to use the function igraph_shortest_paths_dijkstra. I know I need to give the weights of the graph as parameter to this function, and to read the weights I am using the macro EANV. But I got a "Segmentation fault" in my program just when I run EANV. I saw in the manual webpage (http://igraph.sourceforge.net/doc/html/ch19s05.html) that "Only a subset of the Pajek format is implemented", but there you also say that "The `weight' edge attribute might be added if there are edge weights present". My network file has the weights, but I am not sure if the format is correct. Could it be my problem? Could you be so kind in helping me (again), please? Please find in attach a small network file I am testing, and below the source code I am using (is the same I was using in the previous thread, but with the proper changes in order to work with weights). #include<igraph.h> int main(void){ igraph_t g1; igraph_matrix_t l1,v1; igraph_vs_t vertices; igraph_vector_t myweights; int i,j,nverts,nedges; FILE *ifile1; ifile1=fopen("./network.net", "r"); if (ifile1==0) {return 10;} igraph_read_graph_pajek(&g1, ifile1); fclose(ifile1); nedges=igraph_ecount(&g1); igraph_vector_init(&myweights,nedges); EANV(&g1,"weight",&myweights); nverts = igraph_vcount(&g1); igraph_vs_all(&vertices); igraph_matrix_init(&l1,0,nverts ); igraph_matrix_init(&v1,1,nverts ); for(i=0;i<nverts;i++){ igraph_shortest_paths_dijkstra(&g1,&v1,igraph_vss_1(i),vertices,&myweights,IGRAPH_ALL); igraph_matrix_rbind(&l1,&v1); } igraph_matrix_destroy(&l1); igraph_matrix_destroy(&v1); igraph_vs_destroy(&vertices); igraph_vector_destroy(&myweights); igraph_destroy(&g1); return; } Thank you very much for any help! Best, Charles -- Um axé! :) -- Charles Novaes de Santana http://www.imedea.uib-csic.es/~charles PhD student - Global Change Laboratorio Internacional de Cambio Global Department of Global Change Research Instituto Mediterráneo de Estudios Avanzados(CSIC/UIB) Calle Miquel Marques 21, 07190 Esporles - Islas Baleares - España Office phone - +34 971 610 896 Cell phone - +34 660 207 940
network.net
Description: Binary data
_______________________________________________ igraph-help mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/igraph-help
