-
Notifications
You must be signed in to change notification settings - Fork 199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
【求助】使用Traversal API快速查找出目标label 的节点 #482
Comments
您好,期望将lebel== "MyLabel"的节点查询出来,然后遍历打印它们的ID,获取它们的边,可以在您的代码后使用 也可以使用PathTraversal来获取,代码可以这样写 lgraph_api::traversal::PathTraversal path_traver(db, txn, lgraph_api::traversal::TRAVERSAL_PARALLEL);
front_traver.SetFrontier([&](VertexIterator &vit) {return vit.GetLabel() == "MyLabel";});
ParallelVector<Path>& path0 = front_traver.GetFrontier();
for (auto &path : path0) {
// 现在的path只包含1个点(label== "MyLabel"的点)
LOG_INFO() << path.GetStartVertex().GetId();
}
path_traver.ExpandOutEdges();
ParallelVector<Path>& path1 = front_traver.GetFrontier();
for (auto &path : path1) {
// 现在的path只包含1条边,起点为(label== "MyLabel"的点),GetNthEdge获取边
auto edge = path.GetNthEdge(0);
} |
懂了!感谢感谢 |
1、请问如果这个节点有两条edge,这样匹配之后是不是会出现两个path? |
|
感谢耐心解答,另外 |
|
看了半天官方文档和源码UT,但是没有看明白怎么使用Traversal API快速查找出目标label 的节点。
我写了如下代码:
期望将lebel== "MyLabel"的节点查询出来,然后遍历打印它们的ID,获取它们的边,请问该怎么做?
The text was updated successfully, but these errors were encountered: