3

I am trying to understand Neo4J java traversal API but after a thorough reading I am stuck on certain points.

What I seem to know:

Difference between PathExpander and BranchOrderingPolicy. As per my understanding, the former tells what relationships are eligible to be explored from a particular position and the latter specifies the ordering in which they should be evaluated.

I would like to know the following things:

  1. Whether or to what extent this understanding is correct or if it can be altered to give the correct understanding.

  2. If correct, how is PathExpander different from Evaluator.

  3. How does PathExpander and BranchOrderingPolicy work. What I intend to ask is, is PathExpander consulted everytime a relationship is added to the traversal and what does it do with the iterable of relationships returned. Similarly with branch ordering.

  4. During traversal how and when do the components Expander, BranchOrdering, Evaluator, Uniqueness come into picture. Basically I wish to know the template algorithm where one would say like first expander is asked for a collection of relationships to expand and then ordering policy is consulted to select one of the eligibles....

  5. If correct, does the ordering policy specified by BranchOrderingPolicy apply on the eligible relationships only(after expander has done). Perhaps it must be.

Please include anything else that might be helpful in understanding the API.

4

1 回答 1

6

我将尽我所能描述这些部分。

  1. PathExpander至于和之间的区别BranchOrderingPolicyPathExpander第一次从该分支继续遍历时,为每个遍历分支调用 a 。(遍历分支是一个节点,包括通向该节点的路径,注意可能有许多路径,即到同一个节点的许多分支,主要取决于唯一性)。调用的结果PathExpanderIterator<Relationship>在需要时从该遍历分支中懒惰地提供新的关系。这让我们BranchOrderingPolicy它查看所有活着的遍历分支。我所说的“活着”是指一个具有一个或多个关系的分支,以便可以从中创建更多分支。给定所有活动的分支,它会选择其中一个,跟随其下一个关系(从该分支上的关系迭代器中检索,如果它是第一个调用,则可能使用PathExpander(如上所述)初始化该迭代器。
  2. PathExpander和之间的区别Evaluator:拆分在很大程度上是为了方便和关注点分离。PathExpander增加分支和Evaluator过滤器的数量,即减少分支的数量。扩展器创建由Evaluator. 话虽如此,您可以编写一个PathExpander同时执行这些操作的程序,并且这样做可能会更有效。但是将它们分开的方便,可以有多个Evaluators 是非常有用的。
  3. 见上文 (1)
  4. 其中一些在 (1) 中进行了描述,但更广泛的情况是,它BranchOrderingPolicy是遍历中的驱动程序 - 从每个活着的分支中,它选择一个并跟随它到一个新分支的关系。只有符合所选唯一性的分支才会被创建。分支的关系在每个分支第一次发生这种情况时被检索,以惰性关系迭代器的形式使用PathExpander. 新分支在第一次被选择时被评估,其中一个评估结果是该分支是否是死胡同,另一个是是否将其包含在结果中给用户。
  5. 我认为以上解释了

这是足够的信息吗?

于 2014-01-10T13:22:11.010 回答