1 /* -*- mode: C -*- */ 2 /* 3 IGraph library. 4 Copyright (C) 2009-2021 The igraph development team 5 6 This program is free software; you can redistribute it and/or modify 7 it under the terms of the GNU General Public License as published by 8 the Free Software Foundation; either version 2 of the License, or 9 (at your option) any later version. 10 11 This program is distributed in the hope that it will be useful, 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 GNU General Public License for more details. 15 16 You should have received a copy of the GNU General Public License 17 along with this program; if not, write to the Free Software 18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 19 02110-1301 USA 20 */ 21 22 #ifndef IGRAPH_PATHS_H 23 #define IGRAPH_PATHS_H 24 25 #include "igraph_decls.h" 26 #include "igraph_constants.h" 27 #include "igraph_types.h" 28 #include "igraph_vector.h" 29 #include "igraph_vector_ptr.h" 30 #include "igraph_matrix.h" 31 #include "igraph_iterators.h" 32 33 __BEGIN_DECLS 34 35 IGRAPH_EXPORT int igraph_diameter(const igraph_t *graph, igraph_real_t *res, 36 igraph_integer_t *from, igraph_integer_t *to, 37 igraph_vector_t *path, 38 igraph_bool_t directed, igraph_bool_t unconn); 39 IGRAPH_EXPORT int igraph_diameter_dijkstra(const igraph_t *graph, 40 const igraph_vector_t *weights, 41 igraph_real_t *pres, 42 igraph_integer_t *pfrom, 43 igraph_integer_t *pto, 44 igraph_vector_t *path, 45 igraph_bool_t directed, 46 igraph_bool_t unconn); 47 48 IGRAPH_EXPORT int igraph_shortest_paths(const igraph_t *graph, igraph_matrix_t *res, 49 const igraph_vs_t from, const igraph_vs_t to, 50 igraph_neimode_t mode); 51 IGRAPH_EXPORT int igraph_get_shortest_paths(const igraph_t *graph, 52 igraph_vector_ptr_t *vertices, 53 igraph_vector_ptr_t *edges, 54 igraph_integer_t from, const igraph_vs_t to, 55 igraph_neimode_t mode, 56 igraph_vector_long_t *predecessors, 57 igraph_vector_long_t *inbound_edges); 58 IGRAPH_EXPORT int igraph_get_shortest_path(const igraph_t *graph, 59 igraph_vector_t *vertices, 60 igraph_vector_t *edges, 61 igraph_integer_t from, 62 igraph_integer_t to, 63 igraph_neimode_t mode); 64 65 IGRAPH_EXPORT int igraph_get_all_shortest_paths(const igraph_t *graph, 66 igraph_vector_ptr_t *res, 67 igraph_vector_t *nrgeo, 68 igraph_integer_t from, const igraph_vs_t to, 69 igraph_neimode_t mode); 70 IGRAPH_EXPORT int igraph_shortest_paths_dijkstra(const igraph_t *graph, 71 igraph_matrix_t *res, 72 const igraph_vs_t from, 73 const igraph_vs_t to, 74 const igraph_vector_t *weights, 75 igraph_neimode_t mode); 76 IGRAPH_EXPORT int igraph_shortest_paths_bellman_ford(const igraph_t *graph, 77 igraph_matrix_t *res, 78 const igraph_vs_t from, 79 const igraph_vs_t to, 80 const igraph_vector_t *weights, 81 igraph_neimode_t mode); 82 IGRAPH_EXPORT int igraph_get_shortest_path_bellman_ford(const igraph_t *graph, 83 igraph_vector_t *vertices, 84 igraph_vector_t *edges, 85 igraph_integer_t from, 86 igraph_integer_t to, 87 const igraph_vector_t *weights, 88 igraph_neimode_t mode); 89 IGRAPH_EXPORT int igraph_get_shortest_paths_dijkstra(const igraph_t *graph, 90 igraph_vector_ptr_t *vertices, 91 igraph_vector_ptr_t *edges, 92 igraph_integer_t from, 93 igraph_vs_t to, 94 const igraph_vector_t *weights, 95 igraph_neimode_t mode, 96 igraph_vector_long_t *predecessors, 97 igraph_vector_long_t *inbound_edges); 98 IGRAPH_EXPORT int igraph_get_shortest_paths_bellman_ford(const igraph_t *graph, 99 igraph_vector_ptr_t *vertices, 100 igraph_vector_ptr_t *edges, 101 igraph_integer_t from, 102 igraph_vs_t to, 103 const igraph_vector_t *weights, 104 igraph_neimode_t mode, 105 igraph_vector_long_t *predecessors, 106 igraph_vector_long_t *inbound_edges); 107 IGRAPH_EXPORT int igraph_get_shortest_path_dijkstra(const igraph_t *graph, 108 igraph_vector_t *vertices, 109 igraph_vector_t *edges, 110 igraph_integer_t from, 111 igraph_integer_t to, 112 const igraph_vector_t *weights, 113 igraph_neimode_t mode); 114 IGRAPH_EXPORT int igraph_get_all_shortest_paths_dijkstra(const igraph_t *graph, 115 igraph_vector_ptr_t *res, 116 igraph_vector_t *nrgeo, 117 igraph_integer_t from, igraph_vs_t to, 118 const igraph_vector_t *weights, 119 igraph_neimode_t mode); 120 IGRAPH_EXPORT int igraph_shortest_paths_johnson(const igraph_t *graph, 121 igraph_matrix_t *res, 122 const igraph_vs_t from, 123 const igraph_vs_t to, 124 const igraph_vector_t *weights); 125 126 IGRAPH_EXPORT int igraph_average_path_length(const igraph_t *graph, 127 igraph_real_t *res, igraph_real_t *unconn_pairs, 128 igraph_bool_t directed, igraph_bool_t unconn); 129 IGRAPH_EXPORT int igraph_average_path_length_dijkstra(const igraph_t *graph, 130 igraph_real_t *res, igraph_real_t *unconn_pairs, 131 const igraph_vector_t *weights, 132 igraph_bool_t directed, igraph_bool_t unconn); 133 IGRAPH_EXPORT int igraph_path_length_hist(const igraph_t *graph, igraph_vector_t *res, 134 igraph_real_t *unconnected, igraph_bool_t directed); 135 136 IGRAPH_EXPORT int igraph_global_efficiency(const igraph_t *graph, igraph_real_t *res, 137 const igraph_vector_t *weights, 138 igraph_bool_t directed); 139 IGRAPH_EXPORT int igraph_local_efficiency(const igraph_t *graph, igraph_vector_t *res, 140 const igraph_vs_t vids, 141 const igraph_vector_t *weights, 142 igraph_bool_t directed, igraph_neimode_t mode); 143 IGRAPH_EXPORT int igraph_average_local_efficiency(const igraph_t *graph, igraph_real_t *res, 144 const igraph_vector_t *weights, 145 igraph_bool_t directed, igraph_neimode_t mode); 146 147 IGRAPH_EXPORT int igraph_eccentricity(const igraph_t *graph, 148 igraph_vector_t *res, 149 igraph_vs_t vids, 150 igraph_neimode_t mode); 151 152 IGRAPH_EXPORT int igraph_radius(const igraph_t *graph, igraph_real_t *radius, 153 igraph_neimode_t mode); 154 155 IGRAPH_EXPORT int igraph_get_all_simple_paths(const igraph_t *graph, 156 igraph_vector_int_t *res, 157 igraph_integer_t from, 158 const igraph_vs_t to, 159 igraph_integer_t cutoff, 160 igraph_neimode_t mode); 161 162 IGRAPH_EXPORT int igraph_random_walk(const igraph_t *graph, igraph_vector_t *walk, 163 igraph_integer_t start, igraph_neimode_t mode, 164 igraph_integer_t steps, 165 igraph_random_walk_stuck_t stuck); 166 167 IGRAPH_EXPORT int igraph_random_edge_walk(const igraph_t *graph, 168 const igraph_vector_t *weights, 169 igraph_vector_t *edgewalk, 170 igraph_integer_t start, igraph_neimode_t mode, 171 igraph_integer_t steps, 172 igraph_random_walk_stuck_t stuck); 173 174 __END_DECLS 175 176 #endif 177