Skip to content

Commit

Permalink
comment addressed
Browse files Browse the repository at this point in the history
Signed-off-by: Jerry Guo <Jerry.Jinfeng.Guo@alliander.com>
  • Loading branch information
Jerry-Jinfeng-Guo committed Aug 28, 2024
1 parent b92d8f9 commit e9d1473
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,8 @@ inline void process_edges_dijkstra(Idx v, std::vector<EdgeWeight>& vertex_distan
}
}

inline bool is_unreachable(EdgeWeight edge_res) { return edge_res == infty; }

inline auto get_edge_weights(TransformerGraph const& graph) -> TrafoGraphEdgeProperties {
std::vector<EdgeWeight> vertex_distances(boost::num_vertices(graph), infty);
BGL_FORALL_VERTICES(v, graph, TransformerGraph) {
Expand All @@ -269,10 +271,9 @@ inline auto get_edge_weights(TransformerGraph const& graph) -> TrafoGraphEdgePro
continue;
}
auto edge_res = std::min(vertex_distances[boost::source(e, graph)], vertex_distances[boost::target(e, graph)]);
if (edge_res == infty) {
continue;
if (!is_unreachable(edge_res)) {
result.push_back({graph[e].regulated_idx, edge_res});
}
result.push_back({graph[e].regulated_idx, edge_res});
}

return result;
Expand Down

0 comments on commit e9d1473

Please sign in to comment.