Improve expansion performance

Reviewers: buda

Reviewed By: buda

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D2794
This commit is contained in:
Matej Ferencevic 2020-06-29 15:36:50 +02:00
parent a7b672ebbf
commit 0a2f2bfc90

View File

@ -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(