[Top][All Lists]

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

Re: [igraph] igraph_get_eid strange behaviour

From: Gabor Csardi
Subject: Re: [igraph] igraph_get_eid strange behaviour
Date: Sat, 22 Mar 2008 18:16:32 +0100
User-agent: Mutt/1.5.13 (2006-08-11)


On Fri, Mar 21, 2008 at 06:41:10PM +0300, Maria Grineva wrote:
> Hi all,
> I am using igraph C library and faced with the following problem.
> I have a weighted graph and use edges attributes for it.
>     // assign weight attributes to all edges in a graph
>     igraph_cattribute_EAN_setv(&g, "weight", &weights);
> ...
> then I extract a subgraph from my weigthed graph:
>     igraph_subgraph(g, &community_graph, community_vs);
> and then I need to extract weigths from the community_graph, and I try to do 
> it
> the like  this:
>     igraph_get_edgelist(&community_graph, &community_edges, 0);
>     <iterate over community_edges>
>     { ...
>         igraph_get_eid(&community_graph, &eid, i, i+1, false);
>         EAN(&community_graph, "weight", eid);
>       ...   }  

you don't have to do this. Edge ids always go from zero to 
number_of_edges-1. You can do something like:

igraph_vector_t weights;
long int ec=igraph_ecount(&community_graph);
igraph_vector_init(&weights, ec);
for (e=0; e<ec; e++) {
  VECTOR(weights)[e] = EAN(community_graph, "weight", e);

It is quite stupid, we should have an EANV function that gives back
all value at once in a vector. THe thing is that noone was really
using attributes from C, but it seems now that some people started 
doing this...

> BUT eid provided by the igraph_get_eid is always 0. (EAN also doesn't work
> consequently).

Hmmm, we have just corrected some bugs, I think you need to make the
changes listed here:

I think the very last change is causing your trouble. Then you need 
to recompile and reinstall igraph.

Please tell me if this helps,

> What am I doing wrong?
> Maria

> _______________________________________________
> igraph-help mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/igraph-help

Csardi Gabor <address@hidden>    UNIL DGM

reply via email to

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