igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] Enquiry about reading Pajek file


From: Tamas Nepusz
Subject: Re: [igraph] Enquiry about reading Pajek file
Date: Tue, 06 Sep 2011 12:02:43 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.21) Gecko/20110831 Lightning/1.0b2 Thunderbird/3.1.13

> I need to read a Pajek .net file. From what I know, I need to install the 
> graph attribute handler first before I can call the function 
> igraph_read_graph_pajek.
Yes, that's true.

> Is there any example to show how to use the igraph_read_graph_pajek function 
> with the attribute handler interface?
Nothing particular, just call igraph_read_graph_pajek as usual and the
vertex/edge attributes will be stored by igraph automatically if the
attribute handler is attached. I guess you know this page already:

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

The above page lists how the one-character attribute names of Pajek are
renamed on-the-fly to more human-readable forms. For instance, vertex
colours will be stored in the "color" vertex attribute as strings, and
vertex labels will be stored in the "label" attribute (I guess).

To retrieve the values of a string attribute for all the vertices, you can
simply use the macros and functions in the C attribute handler:

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

E.g., igraph_cattribute_VASV or simply the VASV macro queries the value of a
string vertex attribute for many vertices. These macro names are formed
using the following rules:

- The first character is G for [g]raph attributes, V for [v]ertex
attributes, E for [e]dge attributes.
- The second character is always A (standing for [a]ttribute).
- The third character is N for [n]umeric attributes, S for [s]tring attributes.
- The optional fourth character is V if the function/macro queries the
attribute for more than one vertex or edge. V stands for [v]ector.

Note that the C attribute handler supports string and numeric attributes
only, and you have to know the type of an attribute in advance to access it.
If you want to query the attribute names/types for a particular graph, use
igraph_cattribute_list():

http://igraph.sourceforge.net/doc/html/ch09s02s01.html#igraph_cattribute_list

Cheers,
Tamas



reply via email to

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