~ubuntu-branches/ubuntu/trusty/igraph/trusty-proposed

« back to all changes in this revision

Viewing changes to include/igraph_datatype.h

  • Committer: Package Import Robot
  • Author(s): Mathieu Malaterre
  • Date: 2013-05-27 14:01:54 UTC
  • mfrom: (4.1.1 experimental)
  • Revision ID: package-import@ubuntu.com-20130527140154-oxwwmr0gj3kdy4ol
Tags: 0.6.5-2
Upload to sid

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- mode: C -*-  */
 
2
/* 
 
3
   IGraph library.
 
4
   Copyright (C) 2009-2012  Gabor Csardi <csardi.gabor@gmail.com>
 
5
   334 Harvard street, Cambridge, MA 02139 USA
 
6
   
 
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.
 
11
   
 
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.
 
16
   
 
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 
 
20
   02110-1301 USA
 
21
 
 
22
*/
 
23
 
 
24
#ifndef IGRAPH_DATATYPE_H
 
25
#define IGRAPH_DATATYPE_H
 
26
 
 
27
#undef __BEGIN_DECLS
 
28
#undef __END_DECLS
 
29
#ifdef __cplusplus
 
30
# define __BEGIN_DECLS extern "C" {
 
31
# define __END_DECLS }
 
32
#else
 
33
# define __BEGIN_DECLS /* empty */
 
34
# define __END_DECLS /* empty */
 
35
#endif
 
36
 
 
37
#include "igraph_types.h"
 
38
#include "igraph_vector.h"
 
39
 
 
40
__BEGIN_DECLS
 
41
 
 
42
/**
 
43
 * \ingroup internal
 
44
 * \struct igraph_t
 
45
 * \brief The internal data structure for storing graphs.
 
46
 *
 
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
 
65
 *   queries.
 
66
 * - <b>is</b> This is basically the same as <b>os</b>, but this time
 
67
 *   for the incoming edges.
 
68
 * 
 
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.
 
74
 *
 
75
 * The storage requirements for a graph with \c |V| vertices
 
76
 * and \c |E| edges is \c O(|E|+|V|).
 
77
 */
 
78
typedef struct igraph_s {
 
79
  igraph_integer_t n;
 
80
  igraph_bool_t directed;
 
81
  igraph_vector_t from;
 
82
  igraph_vector_t to;
 
83
  igraph_vector_t oi;
 
84
  igraph_vector_t ii;
 
85
  igraph_vector_t os;
 
86
  igraph_vector_t is;
 
87
  void *attr;
 
88
} igraph_t;
 
89
 
 
90
__END_DECLS
 
91
 
 
92
#endif