- /* Create the topology graph */
- if (!routeGraph_)
- routeGraph_ = xbt_graph_new_graph(1, nullptr);
- if (!graphNodeMap_)
- graphNodeMap_ = xbt_dict_new_homogeneous(&graph_node_map_elem_free);
-
- /* we don't check whether the route already exist, because the algorithm may find another path through some other
- * nodes */
-
- /* Add the route to the base */
- sg_platf_route_cbarg_t e_route = newExtendedRoute(hierarchy_, route, 1);
- newRoute(src->id(), dst->id(), e_route);
-
- // Symmetrical YES
- if (route->symmetrical == true) {
- if (!route->gw_dst && !route->gw_src)
- XBT_DEBUG("Load Route from \"%s\" to \"%s\"", dstName, srcName);
+ new_edge(src->id(), dst->id(), new_extended_route(hierarchy_, src, dst, gw_src, gw_dst, link_list, symmetrical, 1));
+
+ if (symmetrical == true)
+ new_edge(dst->id(), src->id(), new_extended_route(hierarchy_, dst, src, gw_dst, gw_src, link_list, symmetrical, 0));
+}
+
+void DijkstraZone::new_edge(int src_id, int dst_id, simgrid::kernel::routing::RouteCreationArgs* route)
+{
+ XBT_DEBUG("Create Route from '%d' to '%d'", src_id, dst_id);
+
+ // Get the extremities, or create them if they don't exist yet
+ xbt_node_t src = node_map_search(src_id);
+ if (src == nullptr)
+ src = this->route_graph_new_node(src_id);
+
+ xbt_node_t dst = node_map_search(dst_id);
+ if (dst == nullptr)
+ dst = this->route_graph_new_node(dst_id);
+
+ // Make sure that this graph edge was not already added to the graph
+ if (xbt_graph_get_edge(route_graph_, src, dst) != nullptr) {
+ if (route->gw_dst == nullptr || route->gw_src == nullptr)
+ THROWF(arg_error, 0, "Route from %s to %s already exists", route->src->get_cname(), route->dst->get_cname());