From: Jean-Baptiste Hervé Date: Mon, 6 Aug 2012 07:33:08 +0000 (+0200) Subject: Platform generation : add a function to check if the graph is connected X-Git-Tag: v3_8~200 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/e93baa98dc235c0aee125a6a2ad7c300fb92645c Platform generation : add a function to check if the graph is connected --- diff --git a/include/simgrid/platf_generator.h b/include/simgrid/platf_generator.h index 38476fc0d7..963603d34e 100644 --- a/include/simgrid/platf_generator.h +++ b/include/simgrid/platf_generator.h @@ -55,6 +55,8 @@ XBT_PUBLIC(void) platf_graph_interconnect_zegura(double alpha, double beta, doub XBT_PUBLIC(void) platf_graph_interconnect_waxman(double alpha, double beta); XBT_PUBLIC(void) platf_graph_interconnect_barabasi(void); +XBT_PUBLIC(int) platf_graph_is_connected(void); + XBT_PUBLIC(void) platf_graph_promote_to_host(context_node_t node, sg_platf_host_cbarg_t parameters); XBT_PUBLIC(void) platf_graph_promote_to_cluster(context_node_t node, sg_platf_cluster_cbarg_t parameters); diff --git a/src/surf/platf_generator.c b/src/surf/platf_generator.c index 1726e963b2..90047bbb35 100644 --- a/src/surf/platf_generator.c +++ b/src/surf/platf_generator.c @@ -302,6 +302,21 @@ void platf_graph_interconnect_barabasi(void) { } } +int platf_graph_is_connected(void) { + xbt_dynar_t dynar_nodes = NULL; + xbt_node_t graph_node = NULL; + context_node_t node_data = NULL; + unsigned int i; + dynar_nodes = xbt_graph_get_nodes(platform_graph); + xbt_dynar_foreach(dynar_nodes, i, graph_node) { + node_data = xbt_graph_node_get_data(graph_node); + if(node_data->degree==0) { + return FALSE; + } + } + return TRUE; +} + void platf_graph_promote_to_host(context_node_t node, sg_platf_host_cbarg_t parameters) { node->kind = HOST; memcpy(&(node->host_parameters), parameters, sizeof(s_sg_platf_host_cbarg_t));