简体   繁体   English

OpenCypher - 获取所有未连接到图中心的节点

[英]OpenCypher - Get all nodes that not connect to the center of the graph

I have a graph on Neptune and I used OpenCypher to query on it.我有一张关于 Neptune 的图表,我使用 OpenCypher 对其进行了查询。

At the middle of the graph I have a big connected nodes, at the edges you can see that I have some single nodes/ nodes that connected only to 1-5 other nodes.在图的中间我有一个大的连接节点,在边缘你可以看到我有一些单个节点/节点只连接到 1-5 个其他节点。 (see on the picture) (见图片)

I want to get all of them, there is an option to do so?我想得到所有这些,有一个选择吗?

I tried to think about options like take a random Id from the center and check all the nodes that don't have a path from them to this node, or maybe say get a table with all nodes and number of connected nodes to them, and ask for all nodes that not contain more than 10 nodes connected我试图考虑诸如从中心获取随机 ID 并检查所有没有从它们到该节点的路径的节点,或者说获取一个包含所有节点和连接节点数量的表,并且询问所有连接的节点不超过 10 个的节点

but I didn't find a way to write this query, Must to know that opencypher on Neptune not contains all the magic keys like 'all' predicate function, so need to find a way with the functions that neptune support但我没有找到写这个查询的方法,必须知道 Neptune 上的 opencypher 不包含所有的魔术键,如“所有”谓词 function,所以需要找到一种方法与海王星支持的功能

在此处输入图像描述

Ideally, you would want to run Weakly Connected Components algorithm to identify the largest component and then return all nodes that are not part of it.理想情况下,您会希望运行弱连接组件算法来识别最大的组件,然后返回不属于它的所有节点。 It seems that Neptune doesn't support that algorithm out-of-the-box, but you could implement it with gremlin as discussed in another SO question: Find largest connected components AWS Neptune似乎 Neptune 不支持开箱即用的算法,但您可以使用 gremlin 来实现它,如另一个 SO 问题中所述: 查找最大的连接组件 AWS Neptune

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM