xbt_graph_free_graph(g, xbt_free_f, xbt_free_f, nullptr);
}
+void platform_graph_export_csv(const std::string& output_filename) {
+ auto* g = xbt_graph_new_graph(0, nullptr);
+ std::map<std::string, xbt_node_t, std::less<>> nodes;
+ std::map<std::string, xbt_edge_t, std::less<>> edges;
+ s4u::Engine::get_instance()->get_netzone_root()->extract_xbt_graph(g, &nodes, &edges);
+
+ std::ofstream fs;
+ fs.open(output_filename, std::ofstream::out);
+ xbt_assert(not fs.fail(), "Failed to open %s", output_filename.c_str());
+
+ fs << "src,dst" << std::endl;
+ for (auto const& elm : edges) {
+ const char* src_s = static_cast<char*>(elm.second->src->data);
+ const char* dst_s = static_cast<char*>(elm.second->dst->data);
+ fs << src_s << "," << dst_s << std::endl;
+ }
+ fs.close();
+ xbt_graph_free_graph(g, xbt_free_f, xbt_free_f, nullptr);
+}
+
/* Callbacks */
static std::vector<NetZoneContainer*> currentContainer; /* push and pop, used only in creation */
static void on_netzone_creation(s4u::NetZone const& netzone)