igraph-help
[Top][All Lists]
Advanced

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

[igraph] Re: reading graph from files ??


From: Tamas Nepusz
Subject: [igraph] Re: reading graph from files ??
Date: Tue, 19 Jan 2010 18:02:45 +0000

> thx for reply. I don't understant what do you mean by "Store the coordinates 
> in a pair of vertex attributes" (sorry i'm a newbie)
Oh, so you're using igraph from C. Attribute handling is a little bit 
cumbersome from C, but it's usable. First, you'll have to attach the C 
attribute handler to igraph before you do anything:

igraph_i_set_attribute_table(&igraph_cattribute_table);

After that, you can set a numeric vertex attribute for all vertices like this:

igraph_cattribute_VAN_setv(&graph, "x", x);
igraph_cattribute_VAN_setv(&graph, "y", y);

When you save your graph now, the X and Y vectors will be stored in the GraphML 
file as well. To get them back later, use something like 
igraph_cattribute_VANV(&graph, "x", igraph_vss_all(), &x);

For more information, read the following chapter in the manual:

http://igraph.sourceforge.net/doc/html/ch09s02.html

-- 
Tamas





reply via email to

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