[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [igraph] Using dynamics vectors to storage my graph's edges
From: |
Gábor Csárdi |
Subject: |
Re: [igraph] Using dynamics vectors to storage my graph's edges |
Date: |
Thu, 16 Jul 2009 21:13:23 +0200 |
Christian,
so you still have problems? In my previous mail, I put some comments
after your code, have you read them?
Best,
G.
On Thu, Jul 16, 2009 at 9:07 PM, Christian
Gonzalez<address@hidden> wrote:
> Ohhh, I forgot to send , the following information:
>
> address@hidden tmp]$ uname -a
> Linux ait01lnx.sigis.local 2.6.29.5-191.fc11.i686.PAE #1 SMP Tue Jun 16
> 23:19:53 EDT 2009 i686 i686 i386 GNU/Linux
>
> address@hidden tmp]$ cat /etc/fedora-release
> Fedora release 11 (Leonidas)
>
> address@hidden tmp]$ rpm -qa igraph*
> igraph-devel-0.5.1-6.fc11.i586
> igraph-0.5.1-6.fc11.i586
>
> address@hidden tmp]$ gcc -v
> Usando especificaciones internas.
> Objetivo: i586-redhat-linux
> Configurado con: ../configure --prefix=/usr --mandir=/usr/share/man
> --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla
> --enable-bootstrap --enable-shared --enable-threads=posix
> --enable-checking=release --with-system-zlib --enable-__cxa_atexit
> --disable-libunwind-exceptions
> --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk
> --disable-dssi --enable-plugin
> --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre
> --enable-libgcj-multifile --enable-java-maintainer-mode
> --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib
> --with-ppl --with-cloog --with-tune=generic --with-arch=i586
> --build=i586-redhat-linux
> Modelo de hilos: posix
> gcc versión 4.4.0 20090506 (Red Hat 4.4.0-4) (GCC)
>
> Thanks,
> Christian
>
> El 15/07/09 17:29, Christian Gonzalez escribió:
>>
>> Hello everybody,
>>
>> I'm trying to use "dynamics vector" to store my graph's edges, because I
>> have a lot of edges. But the "igraph library" doesn't handle it. there is
>> some way to store my edges in the heap memory?
>>
>>
>> this is my code.
>>
>> #include <igraph/igraph.h>
>>
>> int
>> main(int argc, char* argv[])
>> {
>> igraph_t graph;
>> igraph_vector_t result;
>> igraph_vector_t weights;
>> igraph_real_t w = 10;
>> igraph_vector_ptr_t result_vector;
>> igraph_integer_t from = 100;
>> igraph_integer_t to = 400;
>> igraph_vector_t edges;
>>
>> igraph_real_t *ptr_edges;
>> //igraph_real_t *ptr_edge[18];
>>
>> /*igraph_real_t edges_v[] = {
>> 100, 200,
>> 100, 300,
>> 200, 400,
>> 300, 600,
>> 300, 500,
>> 400, 300,
>> 500, 700,
>> 700, 600,
>> 800, 600
>> };*/
>>
>> if ( (ptr_edges = calloc(9 * 2, sizeof(igraph_real_t))) == NULL)
>> {
>> /*
>> ptr_edge[0] = 100; ptr_edge[1] = 200;
>> ptr_edge[2] = 100; ptr_edge[3] = 300;
>> ptr_edge[4] = 200; ptr_edge[5] = 400;
>> ptr_edge[6] = 300; ptr_edge[7] = 600;
>> ptr_edge[8] = 300; ptr_edge[9] = 500;
>> ptr_edge[10] = 400; ptr_edge[11] = 300;
>> ptr_edge[12] = 500; ptr_edge[13] = 700;
>> ptr_edge[14] = 700; ptr_edge[15] = 600;
>> ptr_edge[16] = 800; ptr_edge[17] = 600;
>> */
>> *(ptr_edges+0) = 100; *(ptr_edges+1) = 200;
>> *(ptr_edges+2) = 100; *(ptr_edges+3) = 300;
>> *(ptr_edges+4) = 200; *(ptr_edges+5) = 400;
>> *(ptr_edges+6) = 300; *(ptr_edges+7) = 600;
>> *(ptr_edges+8) = 300; *(ptr_edges+9) = 500;
>> *(ptr_edges+10) = 400; *(ptr_edges+11) = 300;
>> *(ptr_edges+12) = 500; *(ptr_edges+13) = 700;
>> *(ptr_edges+14) = 700; *(ptr_edges+15) = 600;
>> *(ptr_edges+16) = 800; *(ptr_edges+17) = 600;
>> }
>>
>> igraph_vector_view(&edges, ptr_edges, sizeof(9 * 2,
>> sizeof(igraph_real_t))/sizeof(igraph_real_t));
>>
>> igraph_create( &graph, &edges, 0, IGRAPH_DIRECTED);
>>
>> igraph_vector_init(&result, 0);
>>
>> igraph_vector_ptr_init(&result_vector, 1);
>>
>> VECTOR(result_vector)[0] = &result;
>>
>> igraph_vector_init( &weights, igraph_ecount(&graph) );
>>
>> printf("vertices: %i, lados: %i\n", (int)igraph_vcount(&graph),
>> (int)igraph_ecount(&graph));
>>
>> igraph_vector_fill(&weights, w);
>>
>> igraph_get_shortest_paths_dijkstra( &graph,
>> &result_vector,
>> from,
>> igraph_vss_1(to),
>> &weights,
>> IGRAPH_OUT);
>>
>>
>> for (int i = 0; i < igraph_vector_size(&result); i++)
>> {
>> printf("%ld ", (long) igraph_vector_e(&result, i));
>> }
>>
>> printf("\n");
>>
>> igraph_destroy(&graph);
>> igraph_vector_destroy(&result);
>> igraph_vector_destroy(&weights);
>> igraph_vector_ptr_destroy(&result_vector);
>>
>> return EXIT_SUCCESS;
>> }
>>
>> this is my output:
>>
>> address@hidden igraphtest]$ build/myigraph
>> vertices: 0, lados: 0
>> Error at iterators.c:709 :Cannot create iterator, invalid vertex id,
>> Invalid vertex id
>> Abortado
>>
>>
>>
>>
>>
>>
>> _______________________________________________
>> igraph-help mailing list
>> address@hidden
>> http://lists.nongnu.org/mailman/listinfo/igraph-help
>
>
>
>
>
> _______________________________________________
> igraph-help mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/igraph-help
>
--
Gabor Csardi <address@hidden> UNIL DGM