From c0ac114abf08b38220319ed2ffa6e28b06718386 Mon Sep 17 00:00:00 2001 From: kdeweese Date: Wed, 28 Aug 2024 15:47:00 -0700 Subject: [PATCH] change cc dfs to bfs for better performance --- include/graph/algorithm/connected_components.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/graph/algorithm/connected_components.hpp b/include/graph/algorithm/connected_components.hpp index bbc45ad..55194af 100644 --- a/include/graph/algorithm/connected_components.hpp +++ b/include/graph/algorithm/connected_components.hpp @@ -17,7 +17,7 @@ #include "graph/graph.hpp" #include "graph/views/incidence.hpp" #include "graph/views/vertexlist.hpp" -#include "graph/views/depth_first_search.hpp" +#include "graph/views/breadth_first_search.hpp" #include #ifndef GRAPH_CC_HPP @@ -102,8 +102,8 @@ void connected_components(G&& g, // graph } visited[uid] = true; component[uid] = cid; - vertices_depth_first_search_view dfs(g, uid); - for (auto&& [vid, v] : dfs) { + vertices_breadth_first_search_view bfs(g, uid); + for (auto&& [vid, v] : bfs) { component[vid] = cid; visited[vid] = true; }