File: igraph_paths.h

package info (click to toggle)
igraph 0.10.2%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 16,176 kB
  • sloc: ansic: 121,500; cpp: 21,699; xml: 2,734; python: 411; makefile: 147; javascript: 20; sh: 9
file content (309 lines) | stat: -rw-r--r-- 20,270 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
/* -*- mode: C -*-  */
/*
   IGraph library.
   Copyright (C) 2009-2021  The igraph development team

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc.,  51 Franklin Street, Fifth Floor, Boston, MA
   02110-1301 USA
*/

#ifndef IGRAPH_PATHS_H
#define IGRAPH_PATHS_H

#include "igraph_constants.h"
#include "igraph_datatype.h"
#include "igraph_decls.h"
#include "igraph_error.h"
#include "igraph_iterators.h"
#include "igraph_matrix.h"
#include "igraph_types.h"
#include "igraph_vector.h"
#include "igraph_vector_list.h"

__BEGIN_DECLS

IGRAPH_EXPORT igraph_error_t igraph_diameter(const igraph_t *graph, igraph_real_t *res,
                                  igraph_integer_t *from, igraph_integer_t *to,
                                  igraph_vector_int_t *vertex_path, igraph_vector_int_t *edge_path,
                                  igraph_bool_t directed, igraph_bool_t unconn);
IGRAPH_EXPORT igraph_error_t igraph_diameter_dijkstra(const igraph_t *graph,
                                           const igraph_vector_t *weights,
                                           igraph_real_t *res,
                                           igraph_integer_t *from,
                                           igraph_integer_t *to,
                                           igraph_vector_int_t *vertex_path,
                                           igraph_vector_int_t *edge_path,
                                           igraph_bool_t directed,
                                           igraph_bool_t unconn);

IGRAPH_EXPORT igraph_error_t igraph_distances_cutoff(const igraph_t *graph, igraph_matrix_t *res,
                                                     const igraph_vs_t from, const igraph_vs_t to,
                                                     igraph_neimode_t mode, igraph_real_t cutoff);
IGRAPH_EXPORT igraph_error_t igraph_distances(const igraph_t *graph, igraph_matrix_t *res,
                                              const igraph_vs_t from, const igraph_vs_t to,
                                              igraph_neimode_t mode);
IGRAPH_EXPORT igraph_error_t igraph_distances_bellman_ford(const igraph_t *graph,
                                                     igraph_matrix_t *res,
                                                     const igraph_vs_t from,
                                                     const igraph_vs_t to,
                                                     const igraph_vector_t *weights,
                                                     igraph_neimode_t mode);
IGRAPH_EXPORT igraph_error_t igraph_distances_dijkstra_cutoff(const igraph_t *graph,
                                                              igraph_matrix_t *res,
                                                              const igraph_vs_t from,
                                                              const igraph_vs_t to,
                                                              const igraph_vector_t *weights,
                                                              igraph_neimode_t mode,
                                                              igraph_real_t cutoff);
IGRAPH_EXPORT igraph_error_t igraph_distances_dijkstra(const igraph_t *graph,
                                                       igraph_matrix_t *res,
                                                       const igraph_vs_t from,
                                                       const igraph_vs_t to,
                                                       const igraph_vector_t *weights,
                                                       igraph_neimode_t mode);
IGRAPH_EXPORT igraph_error_t igraph_distances_johnson(const igraph_t *graph,
                                                igraph_matrix_t *res,
                                                const igraph_vs_t from,
                                                const igraph_vs_t to,
                                                const igraph_vector_t *weights);
IGRAPH_EXPORT igraph_error_t igraph_distances_floyd_warshall(const igraph_t *graph,
                                                             igraph_matrix_t *res,
                                                             const igraph_vector_t *weights,
                                                             igraph_neimode_t mode);

IGRAPH_EXPORT IGRAPH_DEPRECATED igraph_error_t igraph_shortest_paths(const igraph_t *graph, igraph_matrix_t *res,
                                        const igraph_vs_t from, const igraph_vs_t to,
                                        igraph_neimode_t mode);
IGRAPH_EXPORT IGRAPH_DEPRECATED igraph_error_t igraph_shortest_paths_bellman_ford(const igraph_t *graph,
                                                     igraph_matrix_t *res,
                                                     const igraph_vs_t from,
                                                     const igraph_vs_t to,
                                                     const igraph_vector_t *weights,
                                                     igraph_neimode_t mode);
IGRAPH_EXPORT IGRAPH_DEPRECATED igraph_error_t igraph_shortest_paths_dijkstra(const igraph_t *graph,
                                                 igraph_matrix_t *res,
                                                 const igraph_vs_t from,
                                                 const igraph_vs_t to,
                                                 const igraph_vector_t *weights,
                                                 igraph_neimode_t mode);
IGRAPH_EXPORT IGRAPH_DEPRECATED igraph_error_t igraph_shortest_paths_johnson(const igraph_t *graph,
                                                igraph_matrix_t *res,
                                                const igraph_vs_t from,
                                                const igraph_vs_t to,
                                                const igraph_vector_t *weights);

IGRAPH_EXPORT igraph_error_t igraph_get_shortest_paths(const igraph_t *graph,
                                            igraph_vector_int_list_t *vertices,
                                            igraph_vector_int_list_t *edges,
                                            igraph_integer_t from, const igraph_vs_t to,
                                            igraph_neimode_t mode,
                                            igraph_vector_int_t *parents,
                                            igraph_vector_int_t *inbound_edges);
IGRAPH_EXPORT igraph_error_t igraph_get_shortest_paths_bellman_ford(const igraph_t *graph,
                                                      igraph_vector_int_list_t *vertices,
                                                      igraph_vector_int_list_t *edges,
                                                      igraph_integer_t from,
                                                      igraph_vs_t to,
                                                      const igraph_vector_t *weights,
                                                      igraph_neimode_t mode,
                                                      igraph_vector_int_t *parents,
                                                      igraph_vector_int_t *inbound_edges);
IGRAPH_EXPORT igraph_error_t igraph_get_shortest_paths_dijkstra(const igraph_t *graph,
                                                     igraph_vector_int_list_t *vertices,
                                                     igraph_vector_int_list_t *edges,
                                                     igraph_integer_t from,
                                                     igraph_vs_t to,
                                                     const igraph_vector_t *weights,
                                                     igraph_neimode_t mode,
                                                     igraph_vector_int_t *parents,
                                                     igraph_vector_int_t *inbound_edges);

IGRAPH_EXPORT igraph_error_t igraph_get_shortest_path(const igraph_t *graph,
                                           igraph_vector_int_t *vertices,
                                           igraph_vector_int_t *edges,
                                           igraph_integer_t from,
                                           igraph_integer_t to,
                                           igraph_neimode_t mode);
IGRAPH_EXPORT igraph_error_t igraph_get_shortest_path_bellman_ford(const igraph_t *graph,
                                                        igraph_vector_int_t *vertices,
                                                        igraph_vector_int_t *edges,
                                                        igraph_integer_t from,
                                                        igraph_integer_t to,
                                                        const igraph_vector_t *weights,
                                                        igraph_neimode_t mode);
IGRAPH_EXPORT igraph_error_t igraph_get_shortest_path_dijkstra(const igraph_t *graph,
                                                    igraph_vector_int_t *vertices,
                                                    igraph_vector_int_t *edges,
                                                    igraph_integer_t from,
                                                    igraph_integer_t to,
                                                    const igraph_vector_t *weights,
                                                    igraph_neimode_t mode);

IGRAPH_EXPORT igraph_error_t igraph_get_all_shortest_paths(const igraph_t *graph,
                                                igraph_vector_int_list_t *vertices,
                                                igraph_vector_int_list_t *edges,
                                                igraph_vector_int_t *nrgeo,
                                                igraph_integer_t from, const igraph_vs_t to,
                                                igraph_neimode_t mode);
IGRAPH_EXPORT igraph_error_t igraph_get_all_shortest_paths_dijkstra(const igraph_t *graph,
                                                         igraph_vector_int_list_t *vertices,
                                                         igraph_vector_int_list_t *edges,
                                                         igraph_vector_int_t *nrgeo,
                                                         igraph_integer_t from, igraph_vs_t to,
                                                         const igraph_vector_t *weights,
                                                         igraph_neimode_t mode);

IGRAPH_EXPORT igraph_error_t igraph_average_path_length(const igraph_t *graph,
                                             igraph_real_t *res, igraph_real_t *unconn_pairs,
                                             igraph_bool_t directed, igraph_bool_t unconn);
IGRAPH_EXPORT igraph_error_t igraph_average_path_length_dijkstra(const igraph_t *graph,
                                                      igraph_real_t *res, igraph_real_t *unconn_pairs,
                                                      const igraph_vector_t *weights,
                                                      igraph_bool_t directed, igraph_bool_t unconn);
IGRAPH_EXPORT igraph_error_t igraph_path_length_hist(const igraph_t *graph, igraph_vector_t *res,
                                          igraph_real_t *unconnected, igraph_bool_t directed);

IGRAPH_EXPORT igraph_error_t igraph_global_efficiency(const igraph_t *graph, igraph_real_t *res,
                                           const igraph_vector_t *weights,
                                           igraph_bool_t directed);
IGRAPH_EXPORT igraph_error_t igraph_local_efficiency(const igraph_t *graph, igraph_vector_t *res,
                                          const igraph_vs_t vids,
                                          const igraph_vector_t *weights,
                                          igraph_bool_t directed, igraph_neimode_t mode);
IGRAPH_EXPORT igraph_error_t igraph_average_local_efficiency(const igraph_t *graph, igraph_real_t *res,
                                                  const igraph_vector_t *weights,
                                                  igraph_bool_t directed, igraph_neimode_t mode);

IGRAPH_EXPORT igraph_error_t igraph_eccentricity(const igraph_t *graph,
                                      igraph_vector_t *res,
                                      igraph_vs_t vids,
                                      igraph_neimode_t mode);

IGRAPH_EXPORT igraph_error_t igraph_eccentricity_dijkstra(const igraph_t *graph,
                        const igraph_vector_t *weights,
                        igraph_vector_t *res,
                        igraph_vs_t vids,
                        igraph_neimode_t mode);

IGRAPH_EXPORT igraph_error_t igraph_radius(const igraph_t *graph, igraph_real_t *radius,
                                igraph_neimode_t mode);

IGRAPH_EXPORT igraph_error_t igraph_graph_center(const igraph_t *graph,
                                 igraph_vector_int_t *res,
                                 igraph_neimode_t mode);

IGRAPH_EXPORT igraph_error_t igraph_pseudo_diameter(const igraph_t *graph,
                                         igraph_real_t *diameter,
                                         igraph_integer_t vid_start,
                                         igraph_integer_t *from,
                                         igraph_integer_t *to,
                                         igraph_bool_t directed,
                                         igraph_bool_t unconn);
IGRAPH_EXPORT igraph_error_t igraph_pseudo_diameter_dijkstra(const igraph_t *graph,
                                                  const igraph_vector_t *weights,
                                                  igraph_real_t *diameter,
                                                  igraph_integer_t vid_start,
                                                  igraph_integer_t *from,
                                                  igraph_integer_t *to,
                                                  igraph_bool_t directed,
                                                  igraph_bool_t unconn);

IGRAPH_EXPORT igraph_error_t igraph_get_all_simple_paths(const igraph_t *graph,
                                              igraph_vector_int_t *res,
                                              igraph_integer_t from,
                                              const igraph_vs_t to,
                                              igraph_integer_t cutoff,
                                              igraph_neimode_t mode);

IGRAPH_EXPORT igraph_error_t igraph_random_walk(const igraph_t *graph,
                                     const igraph_vector_t *weights,
                                     igraph_vector_int_t *vertices,
                                     igraph_vector_int_t *edges,
                                     igraph_integer_t start,
                                     igraph_neimode_t mode,
                                     igraph_integer_t steps,
                                     igraph_random_walk_stuck_t stuck);

IGRAPH_EXPORT igraph_error_t igraph_get_k_shortest_paths(const igraph_t *graph,
                                          const igraph_vector_t *weights,
                                          igraph_vector_int_list_t *vertex_paths,
                                          igraph_vector_int_list_t *edge_paths,
                                          igraph_integer_t k,
                                          igraph_integer_t from,
                                          igraph_integer_t to,
                                          igraph_neimode_t mode);

IGRAPH_EXPORT igraph_error_t igraph_spanner(const igraph_t *graph,
                                igraph_vector_int_t *spanner,
                                igraph_real_t stretch,
                                const igraph_vector_t *weights);

IGRAPH_EXPORT igraph_error_t igraph_get_widest_paths(const igraph_t *graph,
                                             igraph_vector_int_list_t *vertices,
                                             igraph_vector_int_list_t *edges,
                                             igraph_integer_t from,
                                             igraph_vs_t to,
                                             const igraph_vector_t *weights,
                                             igraph_neimode_t mode,
                                             igraph_vector_int_t *parents,
                                             igraph_vector_int_t *inbound_edges);
IGRAPH_EXPORT igraph_error_t igraph_get_widest_path(const igraph_t *graph,
                                             igraph_vector_int_t *vertices,
                                             igraph_vector_int_t *edges,
                                             igraph_integer_t from,
                                             igraph_integer_t to,
                                             const igraph_vector_t *weights,
                                             igraph_neimode_t mode);
IGRAPH_EXPORT igraph_error_t igraph_widest_path_widths_floyd_warshall(const igraph_t *graph,
                                                   igraph_matrix_t *res,
                                                   const igraph_vs_t from,
                                                   const igraph_vs_t to,
                                                   const igraph_vector_t *weights,
                                                   igraph_neimode_t mode);
IGRAPH_EXPORT igraph_error_t igraph_widest_path_widths_dijkstra(const igraph_t *graph,
                                             igraph_matrix_t *res,
                                             const igraph_vs_t from,
                                             const igraph_vs_t to,
                                             const igraph_vector_t *weights,
                                             igraph_neimode_t mode);
IGRAPH_EXPORT igraph_error_t igraph_voronoi(const igraph_t *graph,
                                            igraph_vector_int_t *membership,
                                            igraph_vector_t *distances,
                                            const igraph_vector_int_t *generators,
                                            const igraph_vector_t *weights,
                                            igraph_neimode_t mode,
                                            igraph_voronoi_tiebreaker_t tiebreaker);

IGRAPH_EXPORT igraph_error_t igraph_expand_path_to_pairs(igraph_vector_int_t *path);

IGRAPH_EXPORT igraph_error_t igraph_vertex_path_from_edge_path(
   const igraph_t *graph, igraph_integer_t start,
   const igraph_vector_int_t *edge_path, igraph_vector_int_t *vertex_path,
   igraph_neimode_t mode
);

/* Deprecated functions: */

IGRAPH_EXPORT IGRAPH_DEPRECATED igraph_error_t igraph_random_edge_walk(const igraph_t *graph,
                                                            const igraph_vector_t *weights,
                                                            igraph_vector_int_t *edgewalk,
                                                            igraph_integer_t start,
                                                            igraph_neimode_t mode,
                                                            igraph_integer_t steps,
                                                            igraph_random_walk_stuck_t stuck);

__END_DECLS

#endif