I tried to run your code, but could not on your graph, because the graph is too big for my virtual machine. It works well on smaller graphs, though.
If I just calculate the shortest paths from ta single source, i.e. igraph_shortest_paths(&g1,&l1,igraph_vss_1(0),vertices,IGRAPH_ALL); then it works well, too. This was on ubuntu 12.4 32 bit with gcc 4.6.3 and igraph 0.6.1. What is your igraph version, by the way? So I don't think inf is the problem. Could you double check that this code really fails? Gabor On Wed, Dec 5, 2012 at 4:17 PM, Charles Novaes de Santana < [email protected]> wrote: > 32 bits :) > > On Wed, Dec 5, 2012 at 10:06 PM, Gábor Csárdi <[email protected]> wrote: > > PC, I guess. 64 bit or 32 bit? > > > > G. > > > > > > On Wed, Dec 5, 2012 at 4:04 PM, Charles Novaes de Santana > > <[email protected]> wrote: > >> > >> Sorry. I am using Gcc 4.6.3 on a Ubuntu 12.04. > >> > >> Thanks, > >> > >> Charles > >> On Wed, Dec 5, 2012 at 10:01 PM, Gábor Csárdi <[email protected]> > wrote: > >> > Charles, > >> > > >> > what is your platform? OS, OS version, C compiler version? Anything > else > >> > that you might think is needed to reproduce this? > >> > > >> > G. > >> > > >> > > >> > On Wed, Dec 5, 2012 at 3:44 PM, Charles Novaes de Santana > >> > <[email protected]> wrote: > >> >> > >> >> Just to explay why I think my problem with the "infinity" values: > >> >> > >> >> Because I tryied to debug my program and I got the following message: > >> >> > >> >> Program received signal SIGSEGV, Segmentation fault. > >> >> igraph_vector_fill (v=0xbffff6ac, e=inf) at vector.pmt:682 > >> >> 682 *ptr = e; > >> >> > >> >> As the value received by function igraph_vector_fill is "e=inf" I > >> >> suppose it was my problem. > >> >> > >> >> Best, > >> >> > >> >> Charles > >> >> > >> >> On Wed, Dec 5, 2012 at 9:40 PM, Charles Novaes de Santana > >> >> <[email protected]> wrote: > >> >> > Thank you again, Tamás. You were absolutely right about my mistake > in > >> >> > printing the matrix. I did a simple cast and my matrix operations > >> >> > worked fine. > >> >> > > >> >> > But I still have problems with the "infinity" given by the > >> >> > shortest_paths function. I did the function you suggested me (to > >> >> > replace all IGRAPH_INFINITY by zeros), but I have problems in the > >> >> > calculation of the shortest paths itself, before I have the > >> >> > opportunity to replace the "inifinity" by "zero". > >> >> > > >> >> > If you don't mind, I am sending attached to this message a small > >> >> > program with the part of my code where I got the error. And an > >> >> > example > >> >> > of a network I am studying. Maybe it is an error in the format of > my > >> >> > network and I can not understand it yet. Or maybe it is because my > >> >> > network is very sparse. > >> >> > > >> >> > Thank you very much for your attention, > >> >> > > >> >> > Best, > >> >> > > >> >> > Charles > >> >> > > >> >> > /*SOURCE CODE*/ > >> >> > > >> >> > #include<igraph.h> > >> >> > > >> >> > int main(void){ > >> >> > igraph_t g1; > >> >> > igraph_matrix_t l1; > >> >> > igraph_vs_t vertices; > >> >> > > >> >> > int i,j; > >> >> > FILE *ifile1; > >> >> > > >> >> > /*Reading the network*/ > >> >> > ifile1=fopen("./network.net", "r"); > >> >> > if (ifile1==0) {return 10;} > >> >> > igraph_read_graph_pajek(&g1, ifile1); > >> >> > fclose(ifile1); > >> >> > > >> >> > /*Initializing the matrix l1 and the vector of vertices*/ > >> >> > > >> >> > igraph_vs_all(&vertices); > >> >> > igraph_matrix_init(&l1, 0, 0); > >> >> > > >> >> > /*Calculating the shortest paths*/ > >> >> > > >> >> > igraph_shortest_paths(&g1,&l1,vertices,vertices,IGRAPH_ALL); > >> >> > > >> >> > /*Desconstructors*/ > >> >> > igraph_matrix_destroy(&l1); > >> >> > igraph_vs_destroy(&vertices); > >> >> > igraph_destroy(&g1); > >> >> > return; > >> >> > } > >> >> > > >> >> > > >> >> > igraph_matrix_destroy(&l1); > >> >> > igraph_vs_destroy(&vertices); > >> >> > igraph_destroy(&g1); > >> >> > > >> >> > > >> >> > On Wed, Dec 5, 2012 at 10:32 AM, Tamás Nepusz <[email protected]> > >> >> > wrote: > >> >> >>> First, I was wondering if Igraph considers IGRAPH_INFINITY as > zero > >> >> >>> or > >> >> >>> as other value. > >> >> >> IGRAPH_INFINITY is infinity, period. It is there only to provide > us > >> >> >> with a sort-of-platform-independent way to refer to infinity. > >> >> >> > >> >> >>> I am working with shortest-paths matrices and I would > >> >> >>> like the distance between two vertices that can not reach each > >> >> >>> other > >> >> >>> to be zero. > >> >> >> Well, you have to check all the cells in the matrix and if a cell > is > >> >> >> equal to IGRAPH_INFINITY, you have to set it to zero. > >> >> >> > >> >> >>> (I tryied to do "igraph_matrix_scale(matrix,1./2)" and it gave > >> >> >>> me a zero-matrix). > >> >> >> Theoretically it should work; there is no limitation on > >> >> >> igraph_matrix_scale to work on integer values only. I have just > >> >> >> tested it on > >> >> >> my machine and it worked for me, so I guess that the error is > >> >> >> somewhere > >> >> >> else; for instance, in the way you print the values. > >> >> >> > >> >> >> Cheers, > >> >> >> -- > >> >> >> T. > >> >> >> > >> >> >> > >> >> >> _______________________________________________ > >> >> >> igraph-help mailing list > >> >> >> [email protected] > >> >> >> https://lists.nongnu.org/mailman/listinfo/igraph-help > >> >> > > >> >> > > >> >> > > >> >> > -- > >> >> > 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 > >> >> > >> >> > >> >> > >> >> -- > >> >> 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 > >> >> > >> >> _______________________________________________ > >> >> igraph-help mailing list > >> >> [email protected] > >> >> https://lists.nongnu.org/mailman/listinfo/igraph-help > >> > > >> > > >> > > >> > > >> > -- > >> > Gabor Csardi <[email protected]> MTA KFKI RMKI > >> > > >> > > >> > _______________________________________________ > >> > igraph-help mailing list > >> > [email protected] > >> > https://lists.nongnu.org/mailman/listinfo/igraph-help > >> > > >> > >> > >> > >> -- > >> 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 > >> > >> _______________________________________________ > >> igraph-help mailing list > >> [email protected] > >> https://lists.nongnu.org/mailman/listinfo/igraph-help > > > > > > > > > > -- > > Gabor Csardi <[email protected]> MTA KFKI RMKI > > > > > > _______________________________________________ > > igraph-help mailing list > > [email protected] > > https://lists.nongnu.org/mailman/listinfo/igraph-help > > > > > > -- > 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 > > _______________________________________________ > igraph-help mailing list > [email protected] > https://lists.nongnu.org/mailman/listinfo/igraph-help > -- Gabor Csardi <[email protected]> MTA KFKI RMKI
_______________________________________________ igraph-help mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/igraph-help
