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_FOREIGN_H
25 #define IGRAPH_FOREIGN_H
26 
27 #include "igraph_decls.h"
28 #include "igraph_constants.h"
29 #include "igraph_datatype.h"
30 #include "igraph_types.h"
31 #include "igraph_strvector.h"
32 
33 #include <stdio.h>
34 
35 __BEGIN_DECLS
36 
37 /* -------------------------------------------------- */
38 /* Read and write foreign formats                     */
39 /* -------------------------------------------------- */
40 
41 IGRAPH_EXPORT int igraph_read_graph_edgelist(igraph_t *graph, FILE *instream,
42                                              igraph_integer_t n, igraph_bool_t directed);
43 IGRAPH_EXPORT int igraph_read_graph_ncol(igraph_t *graph, FILE *instream,
44                                          igraph_strvector_t *predefnames, igraph_bool_t names,
45                                          igraph_add_weights_t weights, igraph_bool_t directed);
46 IGRAPH_EXPORT int igraph_read_graph_lgl(igraph_t *graph, FILE *instream,
47                                         igraph_bool_t names, igraph_add_weights_t weights,
48                                         igraph_bool_t directed);
49 IGRAPH_EXPORT int igraph_read_graph_pajek(igraph_t *graph, FILE *instream);
50 IGRAPH_EXPORT int igraph_read_graph_graphml(igraph_t *graph, FILE *instream,
51                                             int index);
52 IGRAPH_EXPORT int igraph_read_graph_dimacs(igraph_t *graph, FILE *instream,
53                                            igraph_strvector_t *problem,
54                                            igraph_vector_t *label,
55                                            igraph_integer_t *source,
56                                            igraph_integer_t *target,
57                                            igraph_vector_t *capacity,
58                                            igraph_bool_t directed);
59 IGRAPH_EXPORT int igraph_read_graph_graphdb(igraph_t *graph, FILE *instream,
60                                             igraph_bool_t directed);
61 IGRAPH_EXPORT int igraph_read_graph_gml(igraph_t *graph, FILE *instream);
62 IGRAPH_EXPORT int igraph_read_graph_dl(igraph_t *graph, FILE *instream,
63                                        igraph_bool_t directed);
64 
65 IGRAPH_EXPORT int igraph_write_graph_edgelist(const igraph_t *graph, FILE *outstream);
66 IGRAPH_EXPORT int igraph_write_graph_ncol(const igraph_t *graph, FILE *outstream,
67                                           const char *names, const char *weights);
68 IGRAPH_EXPORT int igraph_write_graph_lgl(const igraph_t *graph, FILE *outstream,
69                                          const char *names, const char *weights,
70                                          igraph_bool_t isolates);
71 IGRAPH_EXPORT int igraph_write_graph_graphml(const igraph_t *graph, FILE *outstream,
72                                              igraph_bool_t prefixattr);
73 IGRAPH_EXPORT int igraph_write_graph_pajek(const igraph_t *graph, FILE *outstream);
74 IGRAPH_EXPORT int igraph_write_graph_dimacs(const igraph_t *graph, FILE *outstream,
75                                             long int source, long int target,
76                                             const igraph_vector_t *capacity);
77 IGRAPH_EXPORT int igraph_write_graph_gml(const igraph_t *graph, FILE *outstream,
78                                          const igraph_vector_t *id, const char *creator);
79 IGRAPH_EXPORT int igraph_write_graph_dot(const igraph_t *graph, FILE *outstream);
80 IGRAPH_EXPORT int igraph_write_graph_leda(const igraph_t *graph, FILE *outstream,
81                                           const char* vertex_attr_name, const char* edge_attr_name);
82 
83 __END_DECLS
84 
85 #endif
86