diff --git a/cpp/algo_module/algorithm/algo.cpp b/cpp/algo_module/algorithm/algo.cpp index 082af992a..62e821273 100644 --- a/cpp/algo_module/algorithm/algo.cpp +++ b/cpp/algo_module/algorithm/algo.cpp @@ -7,13 +7,13 @@ void Algo::Cover(mgp_list *args, mgp_graph *memgraph_graph, mgp_result *result, try { auto list_nodes = arguments[0].ValueList(); std::unordered_set nodes; - for (const auto elem : list_nodes) { + for (const auto &elem : list_nodes) { auto node = elem.ValueNode(); nodes.insert(node); } - for (auto node : nodes) { - for (auto rel : node.OutRelationships()) { + for (const auto &node : nodes) { + for (const auto rel : node.OutRelationships()) { if (nodes.find(rel.To()) != nodes.end()) { auto record = record_factory.NewRecord(); record.Insert(std::string(kCoverRet1).c_str(), rel);