From 96028044d18ea2e76844971132dc0d35a1d66ea7 Mon Sep 17 00:00:00 2001 From: jimingquan Date: Wed, 16 Feb 2022 13:12:25 +0800 Subject: [PATCH] add comment --- src/graph/executor/algo/SubgraphExecutor.h | 29 +++++++++++++++++----- 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/src/graph/executor/algo/SubgraphExecutor.h b/src/graph/executor/algo/SubgraphExecutor.h index 100edf9b4fd..19e65e9c57b 100644 --- a/src/graph/executor/algo/SubgraphExecutor.h +++ b/src/graph/executor/algo/SubgraphExecutor.h @@ -9,15 +9,32 @@ #include "graph/executor/Executor.h" // Subgraph receive result from GetNeightbors -// -// -// +// There are two Main functions +// First : Extract the deduplicated destination VID from GetNeighbors +// Second: Delete previously visited edges and save the result(iter) to the variable `resultVar` // // Member: -// historyVids_ : is hash table -// KEY : the ID of the visited destination Vertex -// VALUE : the number of steps to visit the KEY (starting vertex is 0) +// `historyVids_` : is hash table +// KEY : the VID of the visited destination Vertex +// VALUE : the number of steps to visit the KEY (starting vertex is 0) +// since each vertex will only be visited once, if it is a one-way edge expansion, there will be no +// duplicate edges. we only need to focus on the case of two-way expansion +// +// How to delete edges: +// determine whether a loop is formed by the number of steps. If the destination vid has been +// visited, and the number of steps of the destination vid differs by 2 from the current steps, it +// is judged that a loop is formed, the edge needs to be deleted // +// For example: Topology is below +// a->c, a->b, b->a, b->c +// statamate: get subgraph from 'a' both edge yield vertices as nodes, edges as relationships +// first steps : a->b, a->c, a<-b, all edges need to save +// second steps: b->a, b<-a, b->c, c<-a +// since it is a two-way expansion, the negative edge has already been visited, +// so b<-a & c<-a are deleted +// b->a : the number of steps of the destination vid `a` is 0, and the current steps is 2. it can be +// determined that a loop is formed, so this edge also needs to be deleted. +// b->c : determined by the number of steps that no loop is formed, so keep it namespace nebula { namespace graph {