4
Copyright (C) 2009-2012 Gabor Csardi <csardi.gabor@gmail.com>
5
334 Harvard street, Cambridge, MA 02139 USA
7
This program is free software; you can redistribute it and/or modify
8
it under the terms of the GNU General Public License as published by
9
the Free Software Foundation; either version 2 of the License, or
10
(at your option) any later version.
12
This program is distributed in the hope that it will be useful,
13
but WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
GNU General Public License for more details.
17
You should have received a copy of the GNU General Public License
18
along with this program; if not, write to the Free Software
19
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
24
#ifndef IGRAPH_DATATYPE_H
25
#define IGRAPH_DATATYPE_H
30
# define __BEGIN_DECLS extern "C" {
31
# define __END_DECLS }
33
# define __BEGIN_DECLS /* empty */
34
# define __END_DECLS /* empty */
37
#include "igraph_types.h"
38
#include "igraph_vector.h"
45
* \brief The internal data structure for storing graphs.
47
* It is simple and efficient. It has the following members:
48
* - <b>n</b> The number of vertices, reduntant.
49
* - <b>directed</b> Whether the graph is directed.
50
* - <b>from</b> The first column of the edge list.
51
* - <b>to</b> The second column of the edge list.
52
* - <b>oi</b> The index of the edge list by the first column. Thus
53
* the first edge according to this order goes from
54
* \c from[oi[0]] to \c to[oi[0]]. The length of
55
* this vector is the same as the number of edges in the graph.
56
* - <b>ii</b> The index of the edge list by the second column.
57
* The length of this vector is the same as the number of edges.
58
* - <b>os</b> Contains pointers to the edgelist (\c from
59
* and \c to for every vertex. The first edge \em from
60
* vertex \c v is edge no. \c from[oi[os[v]]] if
61
* \c os[v]<os[v+1]. If \c os[v]==os[v+1] then
62
* there are no edges \em from node \c v. Its length is
63
* the number of vertices plus one, the last element is always the
64
* same as the number of edges and is contained only to ease the
66
* - <b>is</b> This is basically the same as <b>os</b>, but this time
67
* for the incoming edges.
69
* For undirected graph, the same edge list is stored, ie. an
70
* undirected edge is stored only once, and for checking whether there
71
* is an undirected edge from \c v1 to \c v2 one
72
* should search for both \c from=v1, \c to=v2 and
73
* \c from=v2, \c to=v1.
75
* The storage requirements for a graph with \c |V| vertices
76
* and \c |E| edges is \c O(|E|+|V|).
78
typedef struct igraph_s {
80
igraph_bool_t directed;