igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] Graph attributes in R and C


From: Gábor Csárdi
Subject: Re: [igraph] Graph attributes in R and C
Date: Wed, 20 Oct 2010 02:24:56 +0200

Hi Matthew,

On Wed, Oct 20, 2010 at 2:00 AM, Matthew Walker
<address@hidden> wrote:
[...]
>
> I suspect that I cannot use the C-based attribute handler for a graph that
> has been converted from R to C using R_SEXP_to_igraph().  Is this assumption
> correct?  I suspect this because of the considerable amount of attribute
> code in the file rinterface.c.

Correct. You either use the R attribute code, or the C attribute code,
but you cannot use both at the same time. The rule of thumb is, that
if you want to embed your C function into R and/or Python, then you
cannot turn on the C attribute handler.

> Thus, I guess my question is: Is there a correct way to do what I am trying
> to do?  Is there a way to convert an R-based-graph-with-attributes to a
> C-based-graph-with-attributes?  What would you do?

You can pass the graph attributes that are important to your C
function separately, as regular arguments. The R->C glue code can take
care of this.

Another option is to use the R attribute handler from C, see the code
in foreign.c for examples. E.g. the pajek exporter writes the
attributes into the output file, even if they are defined in R.
Currently only numeric and string attributes are supported here.

I hope this helps, Best,
Gabor

> Thanks greatly in advance,
>
> Matthew
>
> _______________________________________________
> 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]