From 8c0812e5a2a50d689d1723b1813a0cf8f8a6a543 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jean-Baptiste=20Herv=C3=A9?= Date: Wed, 1 Aug 2012 11:17:08 +0200 Subject: [PATCH] Platform generation : add the Zegura algorithm topology --- include/simgrid/platf_generator.h | 1 + src/surf/platf_generator.c | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/include/simgrid/platf_generator.h b/include/simgrid/platf_generator.h index 72ff74ed72..4ee6cce2f0 100644 --- a/include/simgrid/platf_generator.h +++ b/include/simgrid/platf_generator.h @@ -36,6 +36,7 @@ XBT_PUBLIC(void) platf_graph_interconnect_ring(void); XBT_PUBLIC(void) platf_graph_interconnect_clique(void); XBT_PUBLIC(void) platf_graph_interconnect_uniform(double alpha); XBT_PUBLIC(void) platf_graph_interconnect_exponential(double alpha); +XBT_PUBLIC(void) platf_graph_interconnect_zegura(double alpha, double beta, double r); XBT_PUBLIC(void) platf_graph_interconnect_barabasi(void); XBT_PUBLIC(void) platf_graph_promote_to_host(context_node_t node, sg_platf_host_cbarg_t parameters); diff --git a/src/surf/platf_generator.c b/src/surf/platf_generator.c index 889c14765e..f4f933472d 100644 --- a/src/surf/platf_generator.c +++ b/src/surf/platf_generator.c @@ -224,6 +224,33 @@ void platf_graph_interconnect_exponential(double alpha) { } } +void platf_graph_interconnect_zegura(double alpha, double beta, double r) { + /* Create a topology where the probability follows the model of Zegura + * (see Zegura, Calvert, Donahoo, A quantitative comparison of graph-based models + * for Internet topology, IEEE/ACM Transactions on Networking, 1997.) + * + * alpha : Probability of connexion for short edges + * beta : Probability of connexion for long edges + * r : Limit between long and short edges (between 0 and sqrt(2) since nodes are placed on the unit square) + */ + xbt_dynar_t dynar_nodes = NULL; + xbt_node_t first_node = NULL; + xbt_node_t second_node = NULL; + unsigned int i,j; + dynar_nodes = xbt_graph_get_nodes(platform_graph); + xbt_dynar_foreach(dynar_nodes, i, first_node) { + xbt_dynar_foreach(dynar_nodes, j, second_node) { + if(j>=i) + break; + double d = platf_node_distance(first_node, second_node); + double proba = d < r ? alpha : beta; + if(RngStream_RandU01(rng_stream) < proba) { + platf_node_connect(first_node, second_node); + } + } + } +} + void platf_graph_interconnect_barabasi(void) { /* Create a topology constructed according to the Barabasi-Albert algorithm (follows power laws) (see Barabasi and Albert, Emergence of scaling in random networks, Science 1999, num 59, p509­-512.) */ -- 2.20.1