igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] Loading weights


From: Gábor Csárdi
Subject: Re: [igraph] Loading weights
Date: Sat, 3 Jan 2009 17:48:53 +0100

Hi,

by default no attributes are supported from C, you can turn on an
experimental attribute handler with

igraph_i_set_attribute_table(&igraph_cattribute_table);

There is an EAN macro to make the query a bit simpler, but the the
pair of SETEANV (which would be EANV) is missing. :(

See more at http://cneurocvs.rmki.kfki.hu/igraph/doc/html/ch09s02.html

Btw., it is much easier to use igraph from R or Python, especially the
attributes, just in case you don't have to use C.

Gabor

On Sat, Jan 3, 2009 at 5:36 PM, Alvaro Graves Fuenzalida
<address@hidden> wrote:
> Hi,
>
> I've been trying to load a graph and consider the weights. According to the
> documentation, using igraph_read_graph_ncol creates an edge attribute called
> "weight" for every edge. However when I try to access it, it crashes. This
> is what I'm currently doing (omitting several lines of code):
>
>
> igraph_bool_t names = 1;
> igraph_bool_t weight = 1;
> igraph_eit_t edgeit;
>
> igraph_read_graph_ncol(&g, stdin, NULL, names,  weight, isdirected);
> igraph_eit_create(&g, igraph_ess_all(IGRAPH_EDGEORDER_ID), &edgeit);
>
> while(! IGRAPH_EIT_END(edgeit)){
>       printf("Peso edge %f is %f\n", IGRAPH_EIT_GET(edgeit), EAN(&g, "name",
> IGRAPH_EIT_GET(edgeit)));
>       IGRAPH_EIT_NEXT(edgeit);
> }
>
>
> What am I doing wrong? Also, is there an easier way to load the weights in a
> vector than using an iterator? Thanks in advance.
>
>
> _______________________________________________
> 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]