|
From: | Gábor Csárdi |
Subject: | Re: [igraph] Comparing large graphs |
Date: | Wed, 5 Dec 2012 16:01:47 -0500 |
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
<address@hidden> 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 <address@hidden> 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
>> address@hidden
>> 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
address@hidden
https://lists.nongnu.org/mailman/listinfo/igraph-help
[Prev in Thread] | Current Thread | [Next in Thread] |