File: igraph_cliques.c

package info (click to toggle)
python-igraph 0.9.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 21,944 kB
  • sloc: ansic: 225,735; cpp: 23,208; python: 17,085; xml: 2,407; yacc: 1,164; sh: 531; lex: 486; pascal: 158; sed: 45; makefile: 23; javascript: 20; fortran: 8
file content (32 lines) | stat: -rw-r--r-- 734 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

#include <igraph.h>

#include "bench.h"

int main() {
    igraph_t g;
    igraph_vector_ptr_t res;
    igraph_integer_t i, n;

    igraph_rng_seed(igraph_rng_default(), 42);

    igraph_erdos_renyi_game(&g, IGRAPH_ERDOS_RENYI_GNM, 100, 3000, /* directed = */ 0, /* loops= */ 0);

    igraph_vector_ptr_init(&res, 0);

    BENCH("1 Cliques in random graph with 100 vertices and 3000 edges",
          igraph_cliques(&g, &res, /* min_size= */ 0, /* max_size= */ 0);
         );

    igraph_destroy(&g);

    n = igraph_vector_ptr_size(&res);
    for (i = 0; i < n; i++) {
        igraph_vector_t *v = VECTOR(res)[i];
        igraph_vector_destroy(v);
        igraph_free(v);
    }
    igraph_vector_ptr_destroy(&res);

    return 0;
}