igraph 0.3.3 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +5 -0
- data/Manifest.txt +12 -1
- data/README.txt +50 -10
- data/Rakefile.rb +1 -1
- data/ext/cIGraph.c +347 -110
- data/ext/cIGraph.h +98 -0
- data/ext/cIGraph_attribute_handler.c +23 -13
- data/ext/cIGraph_community.c +654 -0
- data/ext/cIGraph_connectivity.c +230 -0
- data/ext/cIGraph_file.c +634 -3
- data/ext/cIGraph_generators_deterministic.c +324 -0
- data/ext/cIGraph_generators_random.c +718 -0
- data/ext/cIGraph_layout.c +43 -0
- data/ext/cIGraph_layout3d.c +119 -0
- data/ext/cIGraph_min_cuts.c +195 -0
- data/ext/cIGraph_randomisation.c +57 -0
- data/ext/cIGraph_utility.c +2 -0
- data/test/tc_add_delete.rb +21 -0
- data/test/tc_community.rb +72 -0
- data/test/tc_connectivity.rb +22 -0
- data/test/tc_file_read_write.rb +193 -3
- data/test/tc_generators_deterministic.rb +61 -0
- data/test/tc_generators_random.rb +82 -8
- data/test/tc_isomorphic.rb +1 -1
- data/test/tc_layout.rb +10 -0
- data/test/tc_layout3d.rb +34 -0
- data/test/tc_mincuts.rb +20 -0
- data/test/tc_randomisation.rb +15 -0
- data/test/test_all.rb +6 -0
- metadata +15 -4
- data/test/test_draw.rb +0 -61
data/History.txt
CHANGED
data/Manifest.txt
CHANGED
@@ -11,21 +11,27 @@ ext/cIGraph_basic_properties.c
|
|
11
11
|
ext/cIGraph_basic_query.c
|
12
12
|
ext/cIGraph_centrality.c
|
13
13
|
ext/cIGraph_cliques.c
|
14
|
+
ext/cIGraph_community.c
|
14
15
|
ext/cIGraph_components.c
|
16
|
+
ext/cIGraph_connectivity.c
|
15
17
|
ext/cIGraph_dijkstra.c
|
16
18
|
ext/cIGraph_direction.c
|
17
19
|
ext/cIGraph_error_handlers.c
|
18
20
|
ext/cIGraph_file.c
|
21
|
+
ext/cIGraph_generators_deterministic.c
|
19
22
|
ext/cIGraph_generators_random.c
|
20
23
|
ext/cIGraph_independent_vertex_sets.c
|
21
24
|
ext/cIGraph_isomorphism.c
|
22
25
|
ext/cIGraph_iterators.c
|
23
26
|
ext/cIGraph_kcores.c
|
24
27
|
ext/cIGraph_layout.c
|
28
|
+
ext/cIGraph_layout3d.c
|
25
29
|
ext/cIGraph_matrix.c
|
30
|
+
ext/cIGraph_min_cuts.c
|
26
31
|
ext/cIGraph_motif.c
|
27
32
|
ext/cIGraph_operators.c
|
28
33
|
ext/cIGraph_other_ops.c
|
34
|
+
ext/cIGraph_randomisation.c
|
29
35
|
ext/cIGraph_selectors.c
|
30
36
|
ext/cIGraph_shortest_paths.c
|
31
37
|
ext/cIGraph_spanning.c
|
@@ -42,7 +48,9 @@ test/tc_basic_properties.rb
|
|
42
48
|
test/tc_basic_query.rb
|
43
49
|
test/tc_centrality.rb
|
44
50
|
test/tc_cliques.rb
|
51
|
+
test/tc_community.rb
|
45
52
|
test/tc_components.rb
|
53
|
+
test/tc_connectivity.rb
|
46
54
|
test/tc_copy.rb
|
47
55
|
test/tc_cores.rb
|
48
56
|
test/tc_create.rb
|
@@ -50,14 +58,18 @@ test/tc_dijkstra.rb
|
|
50
58
|
test/tc_directedness.rb
|
51
59
|
test/tc_error_handling.rb
|
52
60
|
test/tc_file_read_write.rb
|
61
|
+
test/tc_generators_deterministic.rb
|
53
62
|
test/tc_generators_random.rb
|
54
63
|
test/tc_independent_vertex_sets.rb
|
55
64
|
test/tc_isomorphic.rb
|
56
65
|
test/tc_iterators.rb
|
57
66
|
test/tc_layout.rb
|
67
|
+
test/tc_layout3d.rb
|
58
68
|
test/tc_matrix.rb
|
69
|
+
test/tc_mincuts.rb
|
59
70
|
test/tc_motif.rb
|
60
71
|
test/tc_other_ops.rb
|
72
|
+
test/tc_randomisation.rb
|
61
73
|
test/tc_selectors.rb
|
62
74
|
test/tc_shortest_paths.rb
|
63
75
|
test/tc_spanning.rb
|
@@ -67,4 +79,3 @@ test/tc_topological_sort.rb
|
|
67
79
|
test/tc_transitivity.rb
|
68
80
|
test/tc_vertex_neighbourhood.rb
|
69
81
|
test/test_all.rb
|
70
|
-
test/test_draw.rb
|
data/README.txt
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
IGraph is a Ruby extension for interfacing with the C igraph library (http://cneurocvs.rmki.kfki.hu/igraph/). igraph is a library for creating and manipulating graphs with a particular emphasis on network analysis functions.
|
4
4
|
|
5
|
-
IGraph is currently in
|
5
|
+
IGraph is currently in beta status and the API should be considered stable. The main documentation can be found at http://igraph.rubyforge.org/igraph/ though it is incomplete in places. you can also see the test suite for examples of how to use the various functions.
|
6
6
|
|
7
7
|
All bug reports, feature requests and patches are welcome. Please email alexg (at) kuicr.kyoto-u.ac.jp or use the rubyforge forums: http://rubyforge.org/forum/?group_id=3943
|
8
8
|
|
@@ -16,22 +16,62 @@ IGraph is only available as a gem. The installation requires the location of you
|
|
16
16
|
|
17
17
|
== Documentation
|
18
18
|
|
19
|
-
Graph objects are represented in the IGraph class. See the IGraph class documentation for a list of available methods available to build and query graph objects.
|
19
|
+
Graph objects are represented in the IGraph class. See the IGraph class documentation for a list of available methods available to build and query graph objects. The graph generators will use simple Integers as the vertices, but you can use any object as a vertex and edges can also be annotated with any kind of object.
|
20
20
|
|
21
21
|
Note that many functions require 'mode' constants to tell igraph how you want certain calculations to be made. The constants are listed under the IGraph documentation and should also be made explicit in each methods documentation.
|
22
22
|
|
23
|
-
Here
|
23
|
+
Here are three examples which translate the C tutorial programs from the igraph documentation (http://cneurocvs.rmki.kfki.hu/igraph/doc/html/igraph-tutorial.html).
|
24
24
|
|
25
|
-
|
25
|
+
= 1.
|
26
26
|
|
27
|
-
|
28
|
-
graph = IGraph.new([],true)
|
27
|
+
require 'igraph'
|
29
28
|
|
30
|
-
|
31
|
-
|
29
|
+
g = IGraph::GenerateRandom.erdos_renyi_game(IGraph::ERDOS_RENYI_GNP,
|
30
|
+
1000, 5.0/1000,
|
31
|
+
false, false)
|
32
32
|
|
33
|
-
|
34
|
-
graph
|
33
|
+
d = g.diameter(false,true).size-1
|
34
|
+
puts "Diameter of a random graph with average degree 5: #{d}"
|
35
|
+
|
36
|
+
= 2.
|
37
|
+
|
38
|
+
require 'igraph'
|
39
|
+
|
40
|
+
graph = IGraph::Generate.lattice([30,30],false,false,true)
|
41
|
+
puts "Average path (lattice): #{graph.average_path_length(false,true)}"
|
42
|
+
|
43
|
+
graph.add_edges(Array.new(20){rand(graph.vcount)})
|
44
|
+
puts "Average path (randomised): #{graph.average_path_length(false,true)}"
|
45
|
+
|
46
|
+
= 3.
|
47
|
+
|
48
|
+
require 'igraph'
|
49
|
+
|
50
|
+
edges = [
|
51
|
+
0, 1, 0, 2, 0, 3, 0, 4, 0, 5, 0, 6, 0, 7, 0, 8,
|
52
|
+
0, 10, 0,11, 0,12, 0,13, 0,17, 0,19, 0,21, 0,31,
|
53
|
+
1, 2, 1, 3, 1, 7, 1,13, 1,17, 1,19, 1,21, 1,30,
|
54
|
+
2, 3, 2, 7, 2,27, 2,28, 2,32, 2, 9, 2, 8, 2,13,
|
55
|
+
3, 7, 3,12, 3,13, 4, 6, 4,10, 5, 6, 5,10, 5,16,
|
56
|
+
6, 16, 8,32, 8,32, 8,33, 9,33,13,33,14,32,14,33,
|
57
|
+
15,32,15,33,18,32,18,33,19,33,20,32,20,33,
|
58
|
+
22,32,22,33,23,25,23,27,23,32,23,33,23,29,
|
59
|
+
24,25,24,27,24,31,25,31,26,29,26,33,27,33,
|
60
|
+
28,31,28,33,29,32,29,33,30,32,30,33,31,32,31,33,
|
61
|
+
32,33
|
62
|
+
]
|
63
|
+
|
64
|
+
g = IGraph.new(edges,false)
|
65
|
+
vs = g.vertices
|
66
|
+
|
67
|
+
max = vs.zip(g.degree(vs,IGraph::ALL,true)).max{|a,b| a[1] <=> b[1]}
|
68
|
+
puts "Maximum degree is #{sprintf("%10i",max[1])}, vertex #{max[0]}."
|
69
|
+
|
70
|
+
max = vs.zip(g.closeness(vs,IGraph::ALL)).max{|a,b| a[1] <=> b[1]}
|
71
|
+
puts "Maximum closeness is #{sprintf("%10f",max[1])}, vertex #{max[0]}."
|
72
|
+
|
73
|
+
max = vs.zip(g.betweenness(vs,IGraph::ALL)).max{|a,b| a[1] <=> b[1]}
|
74
|
+
puts "Maximum betweenness is #{sprintf("%10f",max[1])}, vertex #{max[0]}."
|
35
75
|
|
36
76
|
== License
|
37
77
|
|
data/Rakefile.rb
CHANGED
data/ext/cIGraph.c
CHANGED
@@ -165,12 +165,65 @@ VALUE cIGraph_initialize(int argc, VALUE *argv, VALUE self){
|
|
165
165
|
}
|
166
166
|
|
167
167
|
/* Interface to the iGraph[http://cneurocvs.rmki.kfki.hu/igraph/] library
|
168
|
-
* for graph and network computation.
|
169
|
-
*
|
168
|
+
* for graph and network computation.
|
169
|
+
*
|
170
|
+
* Basic graph operations are defined on the IGraph class itself, but many
|
171
|
+
* other operations are defined in Modules included into IGraph:
|
172
|
+
*
|
173
|
+
* - Deterministic graph generation: IGraph::Generate
|
174
|
+
* - Random graph generation: IGraph::GenerateRandom
|
175
|
+
* - Graph randomisation: IGraph::Randomise
|
176
|
+
* - Shortest paths: IGraph::ShortestPaths
|
177
|
+
* - Vertex neighborhoods: IGraph::Neighborhood
|
178
|
+
* - Graph components: IGraph::Components
|
179
|
+
* - Closeness centrality calculations: IGraph::Closeness
|
180
|
+
* - Spanning tree: IGraph::Spanning
|
181
|
+
* - Transitivity calculations: IGraph::Transitivity
|
182
|
+
* - Spectral properties: IGraph::Spectral
|
183
|
+
* - Coreness: IGraph::KCores
|
184
|
+
* - Other operations: IGraph::OtherOperations
|
185
|
+
* - Clique calculations: IGraph::Cliques
|
186
|
+
* - Independent vertex sets: IGraph::IndependentVertexSets
|
187
|
+
* - Graph isomorphism: IGraph::Isomorphism
|
188
|
+
* - Motifs: IGraph::Motifs
|
189
|
+
* - Sorting: IGraph::Sorting
|
190
|
+
* - File read/write: IGraph::FileRead, IGraph::FileWrite
|
191
|
+
* - Graph layout algorithms: IGraph::Layout
|
192
|
+
* - Minimum cuts: IGraph::MinimumCuts
|
193
|
+
* - Connectivity: IGraph::Connectivity
|
194
|
+
* - Community: IGraph::Community
|
195
|
+
*
|
196
|
+
* Some methods return (or require as a paramter) an IGraphMatrix object. This
|
197
|
+
* class wraps the igraph C matrix type.
|
170
198
|
*/
|
171
199
|
|
172
200
|
void Init_igraph(){
|
173
201
|
|
202
|
+
//Modules
|
203
|
+
VALUE cIGraph_generate;
|
204
|
+
VALUE cIGraph_genrandom;
|
205
|
+
VALUE cIGraph_connectivity;
|
206
|
+
VALUE cIGraph_mincuts;
|
207
|
+
VALUE cIGraph_layout;
|
208
|
+
VALUE cIGraph_clique;
|
209
|
+
VALUE cIGraph_indyver;
|
210
|
+
VALUE cIGraph_isomor;
|
211
|
+
VALUE cIGraph_motifs;
|
212
|
+
VALUE cIGraph_sorting;
|
213
|
+
VALUE cIGraph_filewrite;
|
214
|
+
VALUE cIGraph_fileread;
|
215
|
+
VALUE cIGraph_community;
|
216
|
+
VALUE cIGraph_shortestpaths;
|
217
|
+
VALUE cIGraph_neighborhoodm;
|
218
|
+
VALUE cIGraph_components;
|
219
|
+
VALUE cIGraph_closenessm;
|
220
|
+
VALUE cIGraph_spanning;
|
221
|
+
VALUE cIGraph_transitivitym;
|
222
|
+
VALUE cIGraph_spectral;
|
223
|
+
VALUE cIGraph_kcore;
|
224
|
+
VALUE cIGraph_otherop;
|
225
|
+
VALUE cIGraph_randomise;
|
226
|
+
|
174
227
|
igraph_i_set_attribute_table(&cIGraph_attribute_table);
|
175
228
|
igraph_set_error_handler(cIGraph_error_handler);
|
176
229
|
igraph_set_warning_handler(cIGraph_warning_handler);
|
@@ -184,36 +237,40 @@ void Init_igraph(){
|
|
184
237
|
|
185
238
|
rb_include_module(cIGraph, rb_mEnumerable);
|
186
239
|
|
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
|
-
rb_define_singleton_method(
|
214
|
-
rb_define_singleton_method(
|
215
|
-
rb_define_singleton_method(
|
216
|
-
rb_define_singleton_method(
|
240
|
+
|
241
|
+
/* Functions for deterministically generating graphs. */
|
242
|
+
cIGraph_generate = rb_define_module_under(cIGraph, "Generate");
|
243
|
+
rb_include_module(cIGraph, cIGraph_generate);
|
244
|
+
|
245
|
+
rb_define_singleton_method(cIGraph_generate, "adjacency", cIGraph_adjacency, 2); /* in cIGraph_generators_deterministic.c */
|
246
|
+
rb_define_singleton_method(cIGraph_generate, "star", cIGraph_star, 3); /* in cIGraph_generators_deterministic.c */
|
247
|
+
rb_define_singleton_method(cIGraph_generate, "lattice", cIGraph_lattice, 4); /* in cIGraph_generators_deterministic.c */
|
248
|
+
rb_define_singleton_method(cIGraph_generate, "ring", cIGraph_ring, 4); /* in cIGraph_generators_deterministic.c */
|
249
|
+
rb_define_singleton_method(cIGraph_generate, "tree", cIGraph_tree, 3); /* in cIGraph_generators_deterministic.c */
|
250
|
+
rb_define_singleton_method(cIGraph_generate, "full", cIGraph_full, 3); /* in cIGraph_generators_deterministic.c */
|
251
|
+
rb_define_singleton_method(cIGraph_generate, "atlas", cIGraph_atlas, 1); /* in cIGraph_generators_deterministic.c */
|
252
|
+
rb_define_singleton_method(cIGraph_generate, "extended_chordal_ring", cIGraph_extended_chordal_ring, 2); /* in cIGraph_generators_deterministic.c */
|
253
|
+
|
254
|
+
/* Functions for randomly generating graphs. */
|
255
|
+
cIGraph_genrandom = rb_define_module_under(cIGraph, "GenerateRandom");
|
256
|
+
rb_include_module(cIGraph, cIGraph_genrandom);
|
257
|
+
|
258
|
+
rb_define_singleton_method(cIGraph_genrandom, "grg_game", cIGraph_grg_game, 3); /* in cIGraph_generators_random.c */
|
259
|
+
rb_define_singleton_method(cIGraph_genrandom, "barabasi_game", cIGraph_barabasi_game, 4); /* in cIGraph_generators_random.c */
|
260
|
+
rb_define_singleton_method(cIGraph_genrandom, "nonlinear_barabasi_game", cIGraph_nonlinear_barabasi_game, 6); /* in cIGraph_generators_random.c */
|
261
|
+
rb_define_singleton_method(cIGraph_genrandom, "erdos_renyi_game", cIGraph_erdos_renyi_game, 5); /* in cIGraph_generators_random.c */
|
262
|
+
rb_define_singleton_method(cIGraph_genrandom, "watts_strogatz_game", cIGraph_watts_strogatz_game, 4); /* in cIGraph_generators_random.c */
|
263
|
+
rb_define_singleton_method(cIGraph_genrandom, "degree_sequence_game", cIGraph_degree_sequence_game, 2); /* in cIGraph_generators_random.c */
|
264
|
+
rb_define_singleton_method(cIGraph_genrandom, "growing_random_game", cIGraph_growing_random_game, 4); /* in cIGraph_generators_random.c */
|
265
|
+
rb_define_singleton_method(cIGraph_genrandom, "callaway_traits_game", cIGraph_callaway_traits_game, 6); /* in cIGraph_generators_random.c */
|
266
|
+
rb_define_singleton_method(cIGraph_genrandom, "establishment_game", cIGraph_establishment_game, 6); /* in cIGraph_generators_random.c */
|
267
|
+
rb_define_singleton_method(cIGraph_genrandom, "preference_game", cIGraph_preference_game, 6); /* in cIGraph_generators_random.c */
|
268
|
+
rb_define_singleton_method(cIGraph_genrandom, "asymmetric_preference_game", cIGraph_asymmetric_preference_game, 5); /* in cIGraph_generators_random.c */
|
269
|
+
rb_define_singleton_method(cIGraph_genrandom, "recent_degree_game", cIGraph_recent_degree_game, 7); /* in cIGraph_generators_random.c */
|
270
|
+
rb_define_singleton_method(cIGraph_genrandom, "barabasi_aging_game", cIGraph_barabasi_aging_game, 11); /* in cIGraph_generators_random.c */
|
271
|
+
rb_define_singleton_method(cIGraph_genrandom, "recent_degree_aging_game", cIGraph_recent_degree_aging_game, 9); /* in cIGraph_generators_random.c */
|
272
|
+
rb_define_singleton_method(cIGraph_genrandom, "cited_type_game", cIGraph_cited_type_game, 5); /* in cIGraph_generators_random.c */
|
273
|
+
rb_define_singleton_method(cIGraph_genrandom, "citing_cited_type_game", cIGraph_citing_cited_type_game, 5); /* in cIGraph_generators_random.c */
|
217
274
|
|
218
275
|
rb_define_method(cIGraph, "[]", cIGraph_get_edge_attr, 2); /* in cIGraph_attribute_handler.c */
|
219
276
|
rb_define_method(cIGraph, "[]=", cIGraph_set_edge_attr, 3); /* in cIGraph_attribute_handler.c */
|
@@ -257,95 +314,275 @@ rb_define_singleton_method(cIGraph, "erdos_renyi_game", cIGraph_erdos_renyi_game
|
|
257
314
|
rb_define_method(cIGraph, "are_connected", cIGraph_are_connected,2); /* in cIGraph_basic_properties.c */
|
258
315
|
rb_define_alias (cIGraph, "are_connected?", "are_connected");
|
259
316
|
|
260
|
-
rb_define_method(cIGraph, "
|
261
|
-
rb_define_method(cIGraph, "
|
262
|
-
rb_define_method(cIGraph, "get_all_shortest_paths", cIGraph_get_all_shortest_paths, 3); /* in cIGraph_shortest_paths.c */
|
263
|
-
rb_define_method(cIGraph, "average_path_length", cIGraph_average_path_length, 2); /* in cIGraph_shortest_paths.c */
|
264
|
-
rb_define_method(cIGraph, "diameter", cIGraph_diameter, 2); /* in cIGraph_shortest_paths.c */
|
265
|
-
rb_define_method(cIGraph, "girth", cIGraph_girth, 0); /* in cIGraph_shortest_paths.c */
|
317
|
+
rb_define_method(cIGraph, "to_directed", cIGraph_to_directed, 1); /* in cIGraph_direction.c */
|
318
|
+
rb_define_method(cIGraph, "to_undirected", cIGraph_to_undirected, 1); /* in cIGraph_direction.c */
|
266
319
|
|
320
|
+
/* These methods randomise a graph by rewiring the edges. */
|
321
|
+
cIGraph_randomise = rb_define_module_under(cIGraph, "Randomise");
|
322
|
+
rb_include_module(cIGraph, cIGraph_randomise);
|
323
|
+
|
324
|
+
rb_define_method(cIGraph_randomise, "rewire_edges", cIGraph_rewire_edges, 1); /* in cIGraph_randomisation.c */
|
325
|
+
rb_define_method(cIGraph_randomise, "rewire", cIGraph_rewire, 1); /* in cIGraph_randomisation.c */
|
326
|
+
|
327
|
+
/* Functions for calculating the shortest path through a graph */
|
328
|
+
cIGraph_shortestpaths = rb_define_module_under(cIGraph, "ShortestPaths");
|
329
|
+
rb_include_module(cIGraph, cIGraph_shortestpaths);
|
330
|
+
|
331
|
+
rb_define_method(cIGraph_shortestpaths, "shortest_paths", cIGraph_shortest_paths, 2); /* in cIGraph_shortest_paths.c */
|
332
|
+
rb_define_method(cIGraph_shortestpaths, "get_shortest_paths", cIGraph_get_shortest_paths, 3); /* in cIGraph_shortest_paths.c */
|
333
|
+
rb_define_method(cIGraph_shortestpaths, "get_all_shortest_paths", cIGraph_get_all_shortest_paths, 3); /* in cIGraph_shortest_paths.c */
|
334
|
+
rb_define_method(cIGraph_shortestpaths, "average_path_length", cIGraph_average_path_length, 2); /* in cIGraph_shortest_paths.c */
|
335
|
+
rb_define_method(cIGraph_shortestpaths, "diameter", cIGraph_diameter, 2); /* in cIGraph_shortest_paths.c */
|
336
|
+
rb_define_method(cIGraph_shortestpaths, "girth", cIGraph_girth, 0); /* in cIGraph_shortest_paths.c */
|
337
|
+
|
338
|
+
rb_define_method(cIGraph_shortestpaths, "dijkstra_shortest_paths", cIGraph_dijkstra_shortest_paths, 3); /* in cIGraph_dijkstra.c */
|
339
|
+
|
340
|
+
/* Functions for querying the neighborhood of vertices */
|
341
|
+
cIGraph_neighborhoodm = rb_define_module_under(cIGraph, "Neighborhood");
|
342
|
+
rb_include_module(cIGraph, cIGraph_neighborhoodm);
|
343
|
+
|
344
|
+
rb_define_method(cIGraph_neighborhoodm, "neighbourhood_size", cIGraph_neighborhood_size, 3); /* in cIGraph_vertex_neighbourhood.c */
|
345
|
+
rb_define_method(cIGraph_neighborhoodm, "neighbourhood", cIGraph_neighborhood, 3); /* in cIGraph_vertex_neighbourhood.c */
|
346
|
+
rb_define_method(cIGraph_neighborhoodm, "neighbourhood_graphs", cIGraph_neighborhood_graphs, 3); /* in cIGraph_vertex_neighbourhood.c */
|
347
|
+
rb_define_alias (cIGraph_neighborhoodm, "neighborhood_size", "neighbourhood_size");
|
348
|
+
rb_define_alias (cIGraph_neighborhoodm, "neighborhood", "neighbourhood");
|
349
|
+
rb_define_alias (cIGraph_neighborhoodm, "neighborhood_graphs", "neighbourhood_graphs");
|
350
|
+
rb_define_method(cIGraph_neighborhoodm, "connect_neighborhood", cIGraph_connect_neighborhood, 2); /* in cIGraph_generators_deterministic.c */
|
351
|
+
|
352
|
+
/* Functions for splitting the graph into components */
|
353
|
+
cIGraph_components = rb_define_module_under(cIGraph, "Components");
|
354
|
+
rb_include_module(cIGraph, cIGraph_components);
|
355
|
+
|
356
|
+
rb_define_method(cIGraph_components, "subcomponent", cIGraph_subcomponent, 2); /* in cIGraph_components.c */
|
357
|
+
rb_define_method(cIGraph_components, "subgraph", cIGraph_subgraph, 1); /* in cIGraph_components.c */
|
358
|
+
rb_define_method(cIGraph_components, "clusters", cIGraph_clusters, 1); /* in cIGraph_components.c */
|
359
|
+
rb_define_method(cIGraph_components, "decompose", cIGraph_decompose, -1); /* in cIGraph_components.c */
|
360
|
+
|
361
|
+
/* Graph centrality functions */
|
362
|
+
cIGraph_closenessm = rb_define_module_under(cIGraph, "Closeness");
|
363
|
+
rb_include_module(cIGraph, cIGraph_closenessm);
|
364
|
+
|
365
|
+
rb_define_method(cIGraph_closenessm, "closeness", cIGraph_closeness, 2); /* in cIGraph_centrality.c */
|
366
|
+
rb_define_method(cIGraph_closenessm, "betweenness", cIGraph_betweenness, 2); /* in cIGraph_centrality.c */
|
367
|
+
rb_define_method(cIGraph_closenessm, "edge_betweenness", cIGraph_edge_betweenness, 1); /* in cIGraph_centrality.c */
|
368
|
+
rb_define_method(cIGraph_closenessm, "pagerank", cIGraph_pagerank, 5); /* in cIGraph_centrality.c */
|
369
|
+
rb_define_method(cIGraph_closenessm, "constraint", cIGraph_constraint, -1); /* in cIGraph_centrality.c */
|
370
|
+
rb_define_method(cIGraph_closenessm, "maxdegree", cIGraph_maxdegree, 3); /* in cIGraph_centrality.c */
|
371
|
+
|
372
|
+
/* Minimum spanning tree functions */
|
373
|
+
cIGraph_spanning = rb_define_module_under(cIGraph, "Spanning");
|
374
|
+
rb_include_module(cIGraph, cIGraph_spanning);
|
375
|
+
|
376
|
+
rb_define_method(cIGraph_spanning, "minimum_spanning_tree_unweighted", cIGraph_minimum_spanning_tree_unweighted, 0); /* in cIGraph_spanning.c */
|
377
|
+
rb_define_method(cIGraph_spanning, "minimum_spanning_tree_prim", cIGraph_minimum_spanning_tree_prim, 1); /* in cIGraph_spanning.c */
|
378
|
+
|
379
|
+
/* Graph transitivity functions */
|
380
|
+
cIGraph_transitivitym = rb_define_module_under(cIGraph, "Transitivity");
|
381
|
+
rb_include_module(cIGraph, cIGraph_transitivitym);
|
267
382
|
|
268
|
-
rb_define_method(
|
383
|
+
rb_define_method(cIGraph_transitivitym, "transitivity", cIGraph_transitivity, 0); /* in cIGraph_transitivity.c */
|
384
|
+
rb_define_method(cIGraph_transitivitym, "transitivity_local", cIGraph_transitivity_local, 1); /* in cIGraph_transitivity.c */
|
385
|
+
rb_define_method(cIGraph_transitivitym, "transitivity_avglocal", cIGraph_transitivity_avglocal, 0); /* in cIGraph_transitivity.c */
|
269
386
|
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
rb_define_alias (cIGraph, "neighborhood_size", "neighbourhood_size");
|
274
|
-
rb_define_alias (cIGraph, "neighborhood", "neighbourhood");
|
275
|
-
rb_define_alias (cIGraph, "neighborhood_graphs", "neighbourhood_graphs");
|
387
|
+
/* Functions for the Laplacian matrix. */
|
388
|
+
cIGraph_spectral = rb_define_module_under(cIGraph, "Spectral");
|
389
|
+
rb_include_module(cIGraph, cIGraph_spectral);
|
276
390
|
|
277
|
-
rb_define_method(
|
278
|
-
rb_define_method(cIGraph, "subgraph", cIGraph_subgraph, 1); /* in cIGraph_components.c */
|
279
|
-
rb_define_method(cIGraph, "clusters", cIGraph_clusters, 1); /* in cIGraph_components.c */
|
280
|
-
rb_define_method(cIGraph, "decompose", cIGraph_decompose, -1); /* in cIGraph_components.c */
|
391
|
+
rb_define_method(cIGraph_spectral, "laplacian", cIGraph_laplacian, 1); /* in cIGraph_spectral.c */
|
281
392
|
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
rb_define_method(cIGraph, "pagerank", cIGraph_pagerank, 5); /* in cIGraph_centrality.c */
|
286
|
-
rb_define_method(cIGraph, "constraint", cIGraph_constraint, -1); /* in cIGraph_centrality.c */
|
287
|
-
rb_define_method(cIGraph, "maxdegree", cIGraph_maxdegree, 3); /* in cIGraph_centrality.c */
|
393
|
+
/* Functions for finding the coreness of a graph */
|
394
|
+
cIGraph_kcore = rb_define_module_under(cIGraph, "KCores");
|
395
|
+
rb_include_module(cIGraph, cIGraph_kcore);
|
288
396
|
|
289
|
-
rb_define_method(
|
290
|
-
rb_define_method(cIGraph, "minimum_spanning_tree_prim", cIGraph_minimum_spanning_tree_prim, 1); /* in cIGraph_spanning.c */
|
397
|
+
rb_define_method(cIGraph_kcore, "coreness", cIGraph_coreness, 1); /* in cIGraph_kcores.c */
|
291
398
|
|
292
|
-
|
293
|
-
|
294
|
-
|
399
|
+
/* Other general graph operations */
|
400
|
+
cIGraph_otherop = rb_define_module_under(cIGraph, "OtherOperations");
|
401
|
+
rb_include_module(cIGraph, cIGraph_otherop);
|
295
402
|
|
296
|
-
rb_define_method(
|
297
|
-
rb_define_method(
|
403
|
+
rb_define_method(cIGraph_otherop, "density", cIGraph_density, 1); /* in cIGraph_other_ops.c */
|
404
|
+
rb_define_method(cIGraph_otherop, "simplify", cIGraph_simplify, 2); /* in cIGraph_other_ops.c */
|
405
|
+
rb_define_method(cIGraph_otherop, "reciprocity", cIGraph_reciprocity, 1); /* in cIGraph_other_ops.c */
|
406
|
+
rb_define_method(cIGraph_otherop, "bibcoupling", cIGraph_bibcoupling, 1); /* in cIGraph_other_ops.c */
|
407
|
+
rb_define_method(cIGraph_otherop, "cocitation", cIGraph_cocitation, 1); /* in cIGraph_other_ops.c */
|
408
|
+
rb_define_method(cIGraph_otherop, "get_adjacency", cIGraph_get_adjacency, 1); /* in cIGraph_other_ops.c */
|
409
|
+
|
410
|
+
/* Clique finding functions */
|
411
|
+
cIGraph_clique = rb_define_module_under(cIGraph, "Cliques");
|
412
|
+
rb_include_module(cIGraph, cIGraph_clique);
|
413
|
+
|
414
|
+
rb_define_method(cIGraph_clique, "cliques", cIGraph_cliques, 2); /* in cIGraph_cliques.c */
|
415
|
+
rb_define_method(cIGraph_clique, "largest_cliques", cIGraph_largest_cliques, 0); /* in cIGraph_cliques.c */
|
416
|
+
rb_define_method(cIGraph_clique, "maximal_cliques", cIGraph_maximal_cliques, 0); /* in cIGraph_cliques.c */
|
417
|
+
rb_define_method(cIGraph_clique, "clique_number", cIGraph_clique_number, 0); /* in cIGraph_cliques.c */
|
418
|
+
|
419
|
+
/* Independent vertex set finding functions */
|
420
|
+
cIGraph_indyver = rb_define_module_under(cIGraph, "IndependentVertexSets");
|
421
|
+
rb_include_module(cIGraph, cIGraph_indyver);
|
422
|
+
|
423
|
+
rb_define_method(cIGraph_indyver, "independent_vertex_sets", cIGraph_independent_vertex_sets, 2); /* in cIGraph_independent_vertex_sets.c */
|
424
|
+
rb_define_method(cIGraph_indyver, "largest_independent_vertex_sets", cIGraph_largest_independent_vertex_sets, 0); /* in cIGraph_independent_vertex_sets.c */
|
425
|
+
rb_define_method(cIGraph_indyver, "maximal_independent_vertex_sets", cIGraph_maximal_independent_vertex_sets, 0); /* in cIGraph_independent_vertex_sets.c */
|
426
|
+
rb_define_method(cIGraph_indyver, "independence_number", cIGraph_independence_number, 0); /* in cIGraph_independent_vertex_sets.c */
|
427
|
+
|
428
|
+
/* Functions for isomorphism and isoclasses */
|
429
|
+
cIGraph_isomor = rb_define_module_under(cIGraph, "Isomorphism");
|
430
|
+
rb_include_module(cIGraph, cIGraph_isomor);
|
431
|
+
|
432
|
+
rb_define_method(cIGraph_isomor, "isomorphic", cIGraph_isomorphic, 1); /* in cIGraph_isomorphism.c */
|
433
|
+
rb_define_method(cIGraph_isomor, "isomorphic_vf2", cIGraph_isomorphic_vf2, 1); /* in cIGraph_isomorphism.c */
|
434
|
+
rb_define_method(cIGraph_isomor, "isoclass", cIGraph_isoclass, 0); /* in cIGraph_isomorphism.c */
|
435
|
+
rb_define_method(cIGraph_isomor, "isoclass_subgraph", cIGraph_isoclass_subgraph, 1); /* in cIGraph_isomorphism.c */
|
436
|
+
rb_define_singleton_method(cIGraph_generate, "isoclass_create", cIGraph_isoclass_create, 3); /* in cIGraph_isomorphism.c */
|
437
|
+
|
438
|
+
/* Motif finding functions */
|
439
|
+
cIGraph_motifs = rb_define_module_under(cIGraph, "Motifs");
|
440
|
+
rb_include_module(cIGraph, cIGraph_motifs);
|
441
|
+
|
442
|
+
rb_define_method(cIGraph_motifs, "motifs_randesu", cIGraph_motifs_randesu, 2); /* in cIGraph_motif.c */
|
443
|
+
rb_define_method(cIGraph_motifs, "motifs_randesu_no", cIGraph_motifs_randesu_no, 2); /* in cIGraph_motif.c */
|
444
|
+
rb_define_method(cIGraph_motifs, "motifs_randesu_estimate", cIGraph_motifs_randesu_estimate, 4); /* in cIGraph_motif.c */
|
445
|
+
|
446
|
+
/* Graph sorting functions. */
|
447
|
+
cIGraph_sorting = rb_define_module_under(cIGraph, "Sorting");
|
448
|
+
rb_include_module(cIGraph, cIGraph_sorting);
|
449
|
+
|
450
|
+
rb_define_method(cIGraph_sorting, "topological_sorting", cIGraph_topological_sorting, 1); /* in cIGraph_topological_sort.c */
|
451
|
+
|
452
|
+
/* Functions for reading graphs from files */
|
453
|
+
cIGraph_fileread = rb_define_module_under(cIGraph, "FileRead");
|
454
|
+
rb_include_module(cIGraph, cIGraph_fileread);
|
455
|
+
|
456
|
+
rb_define_singleton_method(cIGraph_fileread, "read_graph_edgelist", cIGraph_read_graph_edgelist, 2); /* in cIGraph_file.c */
|
457
|
+
rb_define_singleton_method(cIGraph_fileread, "read_graph_graphml", cIGraph_read_graph_graphml, 2); /* in cIGraph_file.c */
|
458
|
+
rb_define_singleton_method(cIGraph_fileread, "read_graph_ncol", cIGraph_read_graph_ncol, 5); /* in cIGraph_file.c */
|
459
|
+
rb_define_singleton_method(cIGraph_fileread, "read_graph_lgl", cIGraph_read_graph_lgl, 3); /* in cIGraph_file.c */
|
460
|
+
rb_define_singleton_method(cIGraph_fileread, "read_graph_dimacs", cIGraph_read_graph_dimacs, 2); /* in cIGraph_file.c */
|
461
|
+
rb_define_singleton_method(cIGraph_fileread, "read_graph_graphdb", cIGraph_read_graph_graphdb, 2); /* in cIGraph_file.c */
|
462
|
+
rb_define_singleton_method(cIGraph_fileread, "read_graph_gml", cIGraph_read_graph_gml, 1); /* in cIGraph_file.c */
|
463
|
+
rb_define_singleton_method(cIGraph_fileread, "read_graph_pajek", cIGraph_read_graph_pajek, 2); /* in cIGraph_file.c */
|
464
|
+
|
465
|
+
/* Functions for writing graphs to files */
|
466
|
+
cIGraph_filewrite = rb_define_module_under(cIGraph, "FileWrite");
|
467
|
+
rb_include_module(cIGraph, cIGraph_filewrite);
|
468
|
+
|
469
|
+
rb_define_method(cIGraph_filewrite, "write_graph_edgelist", cIGraph_write_graph_edgelist, 1); /* in cIGraph_file.c */
|
470
|
+
rb_define_method(cIGraph_filewrite, "write_graph_graphml", cIGraph_write_graph_graphml, 1); /* in cIGraph_file.c */
|
471
|
+
rb_define_method(cIGraph_filewrite, "write_graph_gml", cIGraph_write_graph_gml, 1); /* in cIGraph_file.c */
|
472
|
+
rb_define_method(cIGraph_filewrite, "write_graph_ncol", cIGraph_write_graph_ncol, 3); /* in cIGraph_file.c */
|
473
|
+
rb_define_method(cIGraph_filewrite, "write_graph_lgl", cIGraph_write_graph_lgl, 4); /* in cIGraph_file.c */
|
474
|
+
rb_define_method(cIGraph_filewrite, "write_graph_dimacs", cIGraph_write_graph_dimacs, 4); /* in cIGraph_file.c */
|
475
|
+
rb_define_method(cIGraph_filewrite, "write_graph_pajek", cIGraph_write_graph_pajek, 1); /* in cIGraph_file.c */
|
476
|
+
|
477
|
+
/* Graph layout functions */
|
478
|
+
cIGraph_layout = rb_define_module_under(cIGraph, "Layout");
|
479
|
+
rb_include_module(cIGraph, cIGraph_layout);
|
480
|
+
|
481
|
+
rb_define_method(cIGraph_layout, "layout_random", cIGraph_layout_random, 0); /* in cIGraph_layout.c */
|
482
|
+
rb_define_method(cIGraph_layout, "layout_circle", cIGraph_layout_circle, 0); /* in cIGraph_layout.c */
|
483
|
+
rb_define_method(cIGraph_layout, "layout_fruchterman_reingold", cIGraph_layout_fruchterman_reingold, 6); /* in cIGraph_layout.c */
|
484
|
+
rb_define_method(cIGraph_layout, "layout_kamada_kawai", cIGraph_layout_kamada_kawai, 5); /* in cIGraph_layout.c */
|
485
|
+
rb_define_method(cIGraph_layout, "layout_reingold_tilford", cIGraph_layout_reingold_tilford, 1); /* in cIGraph_layout.c */
|
486
|
+
rb_define_method(cIGraph_layout, "layout_reingold_tilford_circular", cIGraph_layout_reingold_tilford_circular, 1); /* in cIGraph_layout.c */
|
487
|
+
rb_define_method(cIGraph_layout, "layout_grid_fruchterman_reingold", cIGraph_layout_grid_fruchterman_reingold, 7); /* in cIGraph_layout.c */
|
488
|
+
rb_define_method(cIGraph_layout, "layout_lgl", cIGraph_layout_lgl, 7); /* in cIGraph_layout.c */
|
489
|
+
|
490
|
+
rb_define_method(cIGraph_layout, "layout_random_3d", cIGraph_layout_random_3d, 0); /* in cIGraph_layout3d.c */
|
491
|
+
rb_define_method(cIGraph_layout, "layout_sphere", cIGraph_layout_sphere, 0); /* in cIGraph_layout3d.c */
|
492
|
+
rb_define_method(cIGraph_layout, "layout_fruchterman_reingold_3d", cIGraph_layout_fruchterman_reingold_3d, 5); /* in cIGraph_layout3d.c */
|
493
|
+
rb_define_method(cIGraph_layout, "layout_kamada_kawai_3d", cIGraph_layout_kamada_kawai_3d, 5); /* in cIGraph_layout3d.c */
|
494
|
+
|
495
|
+
rb_define_singleton_method(cIGraph_layout, "layout_merge_dla", cIGraph_layout_merge_dla, 2); /* in cIGraph_layout.c */
|
496
|
+
|
497
|
+
/* Minimum cuts related functions */
|
498
|
+
cIGraph_mincuts = rb_define_module_under(cIGraph, "MinimumCuts");
|
499
|
+
rb_include_module(cIGraph, cIGraph_mincuts);
|
500
|
+
|
501
|
+
rb_define_method(cIGraph_mincuts, "maxflow_value", cIGraph_maxflow_value, 3); /* in cIGraph_min_cuts.c */
|
502
|
+
rb_define_method(cIGraph_mincuts, "st_mincut_value", cIGraph_st_mincut_value, 3); /* in cIGraph_min_cuts.c */
|
503
|
+
rb_define_method(cIGraph_mincuts, "mincut_value", cIGraph_mincut_value, 1); /* in cIGraph_min_cuts.c */
|
504
|
+
rb_define_method(cIGraph_mincuts, "mincut", cIGraph_mincut, 1); /* in cIGraph_min_cuts.c */
|
505
|
+
|
506
|
+
/* Vertex and edge connectivity functions */
|
507
|
+
cIGraph_connectivity = rb_define_module_under(cIGraph, "Connectivity");
|
508
|
+
rb_include_module(cIGraph, cIGraph_connectivity);
|
509
|
+
|
510
|
+
rb_define_method(cIGraph_connectivity, "st_edge_connectivity", cIGraph_st_edge_connectivity, 2); /* in cIGraph_connectivity.c */
|
511
|
+
rb_define_method(cIGraph_connectivity, "edge_connectivity", cIGraph_edge_connectivity, 0); /* in cIGraph_connectivity.c */
|
512
|
+
rb_define_method(cIGraph_connectivity, "st_vertex_connectivity", cIGraph_st_vertex_connectivity, 3); /* in cIGraph_connectivity.c */
|
513
|
+
rb_define_method(cIGraph_connectivity, "vertex_connectivity", cIGraph_vertex_connectivity, 0); /* in cIGraph_connectivity.c */
|
514
|
+
rb_define_method(cIGraph_connectivity, "edge_disjoint_paths", cIGraph_edge_disjoint_paths, 2); /* in cIGraph_connectivity.c */
|
515
|
+
rb_define_method(cIGraph_connectivity, "vertex_disjoint_paths", cIGraph_vertex_disjoint_paths, 2); /* in cIGraph_connectivity.c */
|
516
|
+
rb_define_method(cIGraph_connectivity, "adhesion", cIGraph_adhesion, 0); /* in cIGraph_connectivity.c */
|
517
|
+
rb_define_method(cIGraph_connectivity, "cohesion", cIGraph_cohesion, 0); /* in cIGraph_connectivity.c */
|
518
|
+
|
519
|
+
/* Community and modularity related functions */
|
520
|
+
cIGraph_community = rb_define_module_under(cIGraph, "Community");
|
521
|
+
rb_include_module(cIGraph, cIGraph_community);
|
522
|
+
|
523
|
+
rb_define_method(cIGraph_community, "modularity", cIGraph_modularity, 1); /* in cIGraph_community.c */
|
524
|
+
rb_define_method(cIGraph_community, "community_to_membership", cIGraph_community_to_membership, 2); /* in cIGraph_community.c */
|
525
|
+
rb_define_method(cIGraph_community, "community_spinglass", cIGraph_community_spinglass, 8); /* in cIGraph_community.c */
|
526
|
+
rb_define_method(cIGraph_community, "community_spinglass_single", cIGraph_community_spinglass_single, 5); /* in cIGraph_community.c */
|
527
|
+
rb_define_method(cIGraph_community, "community_leading_eigenvector", cIGraph_community_leading_eigenvector, 1); /* in cIGraph_community.c */
|
528
|
+
rb_define_method(cIGraph_community, "community_leading_eigenvector_naive", cIGraph_community_leading_eigenvector_naive, 1); /* in cIGraph_community.c */
|
529
|
+
rb_define_method(cIGraph_community, "community_leading_eigenvector_step", cIGraph_community_leading_eigenvector_step, 2); /* in cIGraph_community.c */ rb_define_method(cIGraph_community, "community_walktrap", cIGraph_community_walktrap, 2); /* in cIGraph_community.c */
|
530
|
+
rb_define_method(cIGraph_community, "community_edge_betweenness", cIGraph_community_edge_betweenness, 1); /* in cIGraph_community.c */
|
531
|
+
rb_define_method(cIGraph_community, "community_eb_get_merges", cIGraph_community_eb_get_merges, 1); /* in cIGraph_community.c */
|
532
|
+
rb_define_method(cIGraph_community, "community_fastgreedy", cIGraph_community_fastgreedy, 0); /* in cIGraph_community.c */
|
533
|
+
|
534
|
+
rb_define_const(cIGraph, "VERSION", rb_str_new2("0.9.0"));
|
535
|
+
|
536
|
+
rb_define_const(cIGraph, "EDGEORDER_ID", INT2NUM(1));
|
537
|
+
rb_define_const(cIGraph, "EDGEORDER_FROM", INT2NUM(2));
|
538
|
+
rb_define_const(cIGraph, "EDGEORDER_TO", INT2NUM(3));
|
298
539
|
|
299
|
-
|
540
|
+
rb_define_const(cIGraph, "OUT", INT2NUM(1));
|
541
|
+
rb_define_const(cIGraph, "IN", INT2NUM(2));
|
542
|
+
rb_define_const(cIGraph, "ALL", INT2NUM(3));
|
543
|
+
rb_define_const(cIGraph, "TOTAL", INT2NUM(4));
|
300
544
|
|
301
|
-
|
545
|
+
rb_define_const(cIGraph_components, "WEAK", INT2NUM(1));
|
546
|
+
rb_define_const(cIGraph_components, "STRONG", INT2NUM(2));
|
302
547
|
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
rb_define_method(cIGraph, "layout_fruchterman_reingold", cIGraph_layout_fruchterman_reingold, 6); /* in cIGraph_layout.c */
|
342
|
-
rb_define_method(cIGraph, "layout_kamada_kawai", cIGraph_layout_kamada_kawai, 5); /* in cIGraph_layout.c */
|
343
|
-
rb_define_method(cIGraph, "layout_reingold_tilford", cIGraph_layout_reingold_tilford, 1); /* in cIGraph_layout.c */
|
344
|
-
rb_define_method(cIGraph, "layout_reingold_tilford_circular", cIGraph_layout_reingold_tilford_circular, 1); /* in cIGraph_layout.c */
|
345
|
-
rb_define_method(cIGraph, "layout_grid_fruchterman_reingold", cIGraph_layout_grid_fruchterman_reingold, 7); /* in cIGraph_layout.c */
|
346
|
-
rb_define_method(cIGraph, "layout_lgl", cIGraph_layout_lgl, 7); /* in cIGraph_layout.c */
|
347
|
-
|
348
|
-
//Matrix class
|
548
|
+
rb_define_const(cIGraph, "ARBITRARY", INT2NUM(0));
|
549
|
+
rb_define_const(cIGraph, "MUTUAL", INT2NUM(1));
|
550
|
+
rb_define_const(cIGraph, "EACH", INT2NUM(0));
|
551
|
+
rb_define_const(cIGraph, "COLLAPSE", INT2NUM(1));
|
552
|
+
|
553
|
+
rb_define_const(cIGraph_otherop, "GET_ADJACENCY_UPPER", INT2NUM(0));
|
554
|
+
rb_define_const(cIGraph_otherop, "GET_ADJACENCY_LOWER", INT2NUM(1));
|
555
|
+
rb_define_const(cIGraph_otherop, "GET_ADJACENCY_BOTH", INT2NUM(2));
|
556
|
+
|
557
|
+
rb_define_const(cIGraph, "ERDOS_RENYI_GNP", INT2NUM(0));
|
558
|
+
rb_define_const(cIGraph, "ERDOS_RENYI_GNM", INT2NUM(1));
|
559
|
+
|
560
|
+
rb_define_const(cIGraph_generate, "ADJ_DIRECTED", INT2NUM(0));
|
561
|
+
rb_define_const(cIGraph_generate, "ADJ_UNDIRECTED", INT2NUM(1));
|
562
|
+
rb_define_const(cIGraph_generate, "ADJ_MAX", INT2NUM(2));
|
563
|
+
rb_define_const(cIGraph_generate, "ADJ_MIN", INT2NUM(3));
|
564
|
+
rb_define_const(cIGraph_generate, "ADJ_PLUS", INT2NUM(4));
|
565
|
+
rb_define_const(cIGraph_generate, "ADJ_UPPER", INT2NUM(5));
|
566
|
+
rb_define_const(cIGraph_generate, "ADJ_LOWER", INT2NUM(6));
|
567
|
+
|
568
|
+
rb_define_const(cIGraph_generate, "STAR_OUT", INT2NUM(0));
|
569
|
+
rb_define_const(cIGraph_generate, "STAR_IN", INT2NUM(1));
|
570
|
+
rb_define_const(cIGraph_generate, "STAR_UNDIRECTED", INT2NUM(2));
|
571
|
+
|
572
|
+
rb_define_const(cIGraph_generate, "TREE_OUT", INT2NUM(0));
|
573
|
+
rb_define_const(cIGraph_generate, "TREE_IN", INT2NUM(1));
|
574
|
+
rb_define_const(cIGraph_generate, "TREE_UNDIRECTED", INT2NUM(2));
|
575
|
+
|
576
|
+
rb_define_const(cIGraph_connectivity, "VCONN_NEI_ERROR", INT2NUM(0));
|
577
|
+
rb_define_const(cIGraph_connectivity, "VCONN_NEI_INFINITY", INT2NUM(1));
|
578
|
+
rb_define_const(cIGraph_connectivity, "VCONN_NEI_IGNORE", INT2NUM(2));
|
579
|
+
|
580
|
+
rb_define_const(cIGraph_community, "SPINCOMM_UPDATE_SIMPLE", INT2NUM(0));
|
581
|
+
rb_define_const(cIGraph_community, "SPINCOMM_UPDATE_CONFIG", INT2NUM(1));
|
582
|
+
|
583
|
+
/* This class wraps the igraph matrix type. It can be created from and
|
584
|
+
* converted to an Array of Ruby Arrays.
|
585
|
+
*/
|
349
586
|
cIGraphMatrix = rb_define_class("IGraphMatrix", rb_cObject);
|
350
587
|
|
351
588
|
rb_define_alloc_func(cIGraphMatrix, cIGraph_matrix_alloc);
|