#[repr(C)]pub struct igraph_s {
pub n: igraph_integer_t,
pub directed: igraph_bool_t,
pub from: igraph_vector_t,
pub to: igraph_vector_t,
pub oi: igraph_vector_t,
pub ii: igraph_vector_t,
pub os: igraph_vector_t,
pub is: igraph_vector_t,
pub attr: *mut c_void,
}Expand description
\ingroup internal \struct igraph_t \brief The internal data structure for storing graphs.
It is simple and efficient. It has the following members:
- n The number of vertices, redundant.
- directed Whether the graph is directed.
- from The first column of the edge list.
- to The second column of the edge list.
- oi The index of the edge list by the first column. Thus the first edge according to this order goes from \c from[oi[0]] to \c to[oi[0]]. The length of this vector is the same as the number of edges in the graph.
- ii The index of the edge list by the second column. The length of this vector is the same as the number of edges.
- os Contains pointers to the edgelist (\c from and \c to for every vertex. The first edge \em from vertex \c v is edge no. \c from[oi[os[v]]] if \c os[v]<os[v+1]. If \c os[v]==os[v+1] then there are no edges \em from node \c v. Its length is the number of vertices plus one, the last element is always the same as the number of edges and is contained only to ease the queries.
- is This is basically the same as os, but this time for the incoming edges.
For undirected graphs, the same edge list is stored, i.e. an undirected edge is stored only once. Currently, undirected edges are canonicalized so that the index of the ‘from’ vertex is not greater than the index of the ‘to’ vertex. Thus, if v1 <= v2, only the edge (v1, v2) needs to be searched for, not (v2, v1), to determine if v1 and v2 are connected. However, this fact is NOT guaranteed by the documented public API, and should not be relied upon by the implementation of any functions, except those belonging to the minimal API in type_indexededgelist.c.
The storage requirements for a graph with \c |V| vertices and \c |E| edges is \c O(|E|+|V|).
Fields§
§n: igraph_integer_t§directed: igraph_bool_t§from: igraph_vector_t§to: igraph_vector_t§oi: igraph_vector_t§ii: igraph_vector_t§os: igraph_vector_t§is: igraph_vector_t§attr: *mut c_void