- xbt_dynar_t dynar=NULL;
- xbt_dynar_t dynar1=NULL;
- xbt_node_t * route=NULL;
-
- xbt_graph_t graph = xbt_graph_read(graph_file);
- n=xbt_dynar_length(xbt_graph_get_nodes( graph));
-
- double *adj=xbt_graph_get_length_matrix(graph);
-
-
- for(i=0;i<n;i++)
- {
- for(j=0;j<n;j++)
- {
- fprintf(stderr,"%le\t",adj[i*n+j] );
- }
- fprintf(stderr,"\n" );
+
+ xbt_dynar_t edges = NULL;
+ xbt_dynar_t nodes = NULL;
+
+ xbt_graph_t graph =
+ xbt_graph_read(graph_file, &node_label_and_data, NULL);
+
+ n = xbt_dynar_length(xbt_graph_get_nodes(graph));
+
+ if (test_export_xml) {
+ XBT_INFO("---- Testing XML export. Exporting to testgraph.xml ----");
+ xbt_graph_export_graphxml(graph, "testgraph.xml", NULL, NULL, NULL,
+ NULL);
+ }
+ if (test_export_dot) {
+ XBT_INFO("---- Testing GraphViz export. Exporting to testgraph.dot ----");
+ xbt_graph_export_graphviz(graph, "testgraph.dot", node_name, NULL);
+ }
+
+ if (test_export_length) {
+ char *buf = NULL;
+ double *adj = NULL;
+
+ XBT_INFO("---- Dumping Edge lengths ----");
+ adj = xbt_graph_get_length_matrix(graph);
+ buf = xbt_new0(char, n * 20);
+ for (i = 0; i < n; i++) {
+ for (j = 0; j < n; j++) {
+ sprintf(buf + strlen(buf), "%le\t", adj[i * n + j]);
+ }
+ XBT_INFO("%s", buf);
+ buf[0] = '\000';
+ }
+ free(buf);
+ free(adj);
+ }
+
+ if (test_shortest_paths) {
+ char *buf = NULL;
+ xbt_node_t *route = NULL;
+
+ XBT_INFO("---- Testing Shortest Paths ----");
+ route = xbt_graph_shortest_paths(graph);
+ buf = xbt_new0(char, n * 40);
+ for (i = 0; i < n; i++) {
+ for (j = 0; j < n; j++) {
+ if (route[i * n + j])
+ snprintf(buf + strlen(buf), 40, "%s\t",
+ node_name(route[i * n + j]));
+ }
+ XBT_INFO("%s", buf);
+ buf[0] = '\000';