From 0a2f2bfc90076acea4e2d80edec0f4bb5f1156b9 Mon Sep 17 00:00:00 2001 From: Matej Ferencevic Date: Mon, 29 Jun 2020 15:36:50 +0200 Subject: [PATCH] Improve expansion performance Reviewers: buda Reviewed By: buda Subscribers: pullbot Differential Revision: https://phabricator.memgraph.io/D2794 --- src/query/plan/operator.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/query/plan/operator.cpp b/src/query/plan/operator.cpp index 94d48314f..d0035091e 100644 --- a/src/query/plan/operator.cpp +++ b/src/query/plan/operator.cpp @@ -792,16 +792,14 @@ auto ExpandFromVertex(const VertexAccessor &vertex, wrapper(direction, *vertex.InEdges(view, edge_types)))> chain_elements(memory); - size_t in_degree = UnwrapDegreeResult(vertex.InDegree(view)); - if (direction != EdgeAtom::Direction::OUT && in_degree > 0) { + if (direction != EdgeAtom::Direction::OUT) { auto edges = UnwrapEdgesResult(vertex.InEdges(view, edge_types)); if (edges.begin() != edges.end()) { chain_elements.emplace_back( wrapper(EdgeAtom::Direction::IN, std::move(edges))); } } - size_t out_degree = UnwrapDegreeResult(vertex.OutDegree(view)); - if (direction != EdgeAtom::Direction::IN && out_degree > 0) { + if (direction != EdgeAtom::Direction::IN) { auto edges = UnwrapEdgesResult(vertex.OutEdges(view, edge_types)); if (edges.begin() != edges.end()) { chain_elements.emplace_back(