igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] graph object structure


From: Tamas Nepusz
Subject: Re: [igraph] graph object structure
Date: Mon, 18 Oct 2010 09:13:33 +0100

Dear John,

> I view it as a list structure with 9 members, 1st as the edge number, 2nd 
> direction logical value, 9th the vertices metadata. What I am not 
> understanding is the contents in the 3rd-8th members.
>  
> Can anyone give me some hints? Thanks!
The edge list is stored in the vectors from and to, the source vertex of edge i 
is given by from[i] and the target is given by to[i]. The remaining members are 
indexing data structures on top of the edge list. The ordering according to the 
first column of the edge list is given by oi, so the first edge in the ordering 
defined by the source vertex IDs is given by from[oi[0]]]. Similarly, the first 
edge in the ordering defined by the target vertex IDs is from[ii[0]]. 
Therefore, the length of oi and ii naturally matches the number of edges in the 
graph.
The vectors os and is serve as second-level indices by vertex IDs, so the ID of 
the first edge originating from vertex i is given by from[oi[os[i]]], the 
second one is given by from[oi[os[i]+1]] and so on, up to and not including 
from[oi[os[i+1]]]. When a vertex does not have outgoing edges, from[oi[os[i]]] 
equals from[oi[os[i+1]]]. The last elements of os and is are sentinels, they 
are always equal to the number of edges, so the length of os and is is always 
equal to the number of vertices. Finally, attr is a pointer to a data structure 
holding graph, vertex and edge attributes. Its type is unspecified, since 
attributes are handled by functions implementing a separate attribute handler 
interface. The attribute handler used depends on the environment in which 
igraph is embedded: there is a C attribute handler which enables numeric and 
strings attributes, there is an R attribute handler which can store arbitrary R 
objects in the attributes, there is a Python attribute handler for storing 
Python objects and so on. In the latter cases, the actual attribute handling is 
done by the host language and not igraph itself.

-- 
Tamas




reply via email to

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