igraph-help
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [igraph] New user of igraph in C. Basic question about data importa


From: Gábor Csárdi
Subject: Re: [igraph] New user of igraph in C. Basic question about data importation
Date: Tue, 28 Apr 2009 12:21:48 +0200

Paul,

On Tue, Apr 28, 2009 at 5:15 AM, Paul Johnson <address@hidden> wrote:
[...]
> Thanks very much for the quick answer. I think I understand.  I've
> made a small test program to see if I understand. It seems to work!
> But I don't know if I'm doing this fully properly.  Would you care to
> comment on my effort?  The file is attached.

I mean something like this:

igraph_empty(&graph, nodes, IGRAPH_DIRECTED);
igraph_adjlist_init(&graph, &myAList, IGRAPH_OUT);

for (i=0; i<nodes; i++) {
  igraph_vector_t *neis=igraph_adjlist_get(&myAList, i);
  /* put the neighbors if node 'i' into neis here, by using
     igraph_vector_push_back, or some other method */
}

igraph_adjlist(&graph2, &myAList, IGRAPH_DIRECTED, /*duplicate*/=0);
igraph_destroy(&graph);
igraph_adjlist_destroy(&myAList);

You did kind of the same, but I am not sure why you need
igraph_update. If you put the neighbors of a vertex into a vector, you
can just put them into the adjacency list immediately.

> I wish your igraph_vector objects had a "print" method to dump their
> contents onto the screen or to a file.  Since the results of the
> diagnostics (e.g., triad census) are vectors, that would be
> convenient!  If I write something up, will you accept patches?

We do accept patches, but this has been added recently:
http://bazaar.launchpad.net/~igraph/igraph/0.6-main/revision/1495

Best,
G.

> pj
>
> --
> Paul E. Johnson
> Professor, Political Science
> 1541 Lilac Lane, Room 504
> University of Kansas
>
> _______________________________________________
> igraph-help mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/igraph-help
>
>



-- 
Gabor Csardi <address@hidden>     UNIL DGM




reply via email to

[Prev in Thread] Current Thread [Next in Thread]