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
|
#include <igraph.h>
#include "bench.h"
int main(void) {
igraph_t graph;
igraph_vector_t betweenness;
BENCH_INIT();
igraph_rng_seed(igraph_rng_default(), 42);
igraph_vector_init(&betweenness, 0);
/* Kautz and De Bruijn graphs are connected, therefore there should not be a dramatic difference
* in the performance of the directed and undirected calculations. */
igraph_kautz(&graph, 4, 5);
BENCH(" 1 Betweenness, Kautz(4,5), directed",
igraph_betweenness(&graph, &betweenness, igraph_vss_all(), IGRAPH_DIRECTED, NULL));
BENCH(" 2 Betweenness, Kautz(4,5), undirected",
igraph_betweenness(&graph, &betweenness, igraph_vss_all(), IGRAPH_UNDIRECTED, NULL));
igraph_destroy(&graph);
igraph_de_bruijn(&graph, 6, 5);
BENCH(" 3 Betweenness, DeBruijn(6,5), directed",
igraph_betweenness(&graph, &betweenness, igraph_vss_all(), IGRAPH_DIRECTED, NULL));
igraph_destroy(&graph);
{
igraph_vector_int_t dims;
igraph_vector_int_init_int_end(&dims, -1, 8, 8, 8, 8, -1);
igraph_square_lattice(&graph, &dims, 1, IGRAPH_UNDIRECTED, /* mutual */ 0, /* periodic */ 0);
BENCH(" 4 Betweenness, Grid(8,8,8,8), undirected",
igraph_betweenness(&graph, &betweenness, igraph_vss_all(), IGRAPH_UNDIRECTED, NULL));
igraph_destroy(&graph);
igraph_vector_int_destroy(&dims);
igraph_vector_int_init_int_end(&dims, -1, 10, 10, 10, 10, -1);
igraph_square_lattice(&graph, &dims, 1, IGRAPH_UNDIRECTED, /* mutual */ 0, /* periodic */ 0);
BENCH(" 5 Betweenness, Grid(10,10,10,10), cutoff 5",
igraph_betweenness_cutoff(&graph, &betweenness, igraph_vss_all(), IGRAPH_UNDIRECTED, NULL, 5));
BENCH(" 6 Betweenness, Grid(10,10,10,10), cutoff 8",
igraph_betweenness_cutoff(&graph, &betweenness, igraph_vss_all(), IGRAPH_UNDIRECTED, NULL, 8));
igraph_destroy(&graph);
igraph_vector_int_destroy(&dims);
}
igraph_barabasi_game(&graph, 8000, 1, 1, NULL, 1, 0, IGRAPH_UNDIRECTED, IGRAPH_BARABASI_PSUMTREE, NULL);
BENCH(" 7 Betweenness, Barabasi n=8000 m=1, undirected",
igraph_betweenness(&graph, &betweenness, igraph_vss_all(), IGRAPH_UNDIRECTED, NULL));
BENCH(" 8 Betweenness, Barabasi n=8000 m=1, undirected, cutoff 6",
igraph_betweenness_cutoff(&graph, &betweenness, igraph_vss_all(), IGRAPH_UNDIRECTED, NULL, 6));
igraph_destroy(&graph);
igraph_barabasi_game(&graph, 30000, 1, 5, NULL, 1, 0, IGRAPH_DIRECTED, IGRAPH_BARABASI_PSUMTREE, NULL);
BENCH(" 9 Betweenness, Barabasi n=30000 m=5, directed",
igraph_betweenness(&graph, &betweenness, igraph_vss_all(), IGRAPH_DIRECTED, NULL));
BENCH("10 Betweenness, Barabasi n=30000 m=5, directed, cutoff 5",
igraph_betweenness_cutoff(&graph, &betweenness, igraph_vss_all(), IGRAPH_DIRECTED, NULL, 5));
igraph_destroy(&graph);
igraph_vector_destroy(&betweenness);
return 0;
}
|