我有以下图表
这些关系中的每一个都是“ USES_COMPONENT
”
在对 Neo4j 密码结果进行标准化后,我有一个类似的结构
{
'1': {
'label': 'Product',
'properties': {...},
'type': 'VERTEX'
},
'2': {
'label': 'Component',
'properties': {...},
'type': 'VERTEX'
},
'3': {
'label': 'USES_COMPONENT',
'properties': {...},
'type': 'EDGE',
'direction': 'OUT',
'from': '1',
'to': '2'
}
}
最终描述了整个图(与原始密码响应非常相似)
我当前的密码查询是:(Froot Loops 的 uuid 是a1
。我分配了这个。)
MATCH p = (pr:Product)-[:USES_COMPONENT*]->()
WHERE pr.meta_uuid = 'a1'
RETURN p
我需要做的是找出每个组件离根(Froot Loops)多少步。
所以Corn Flour Blend
将是1
一步之遥,而Whole Grain Yellow Corn Flour
将是2
几步之遥。
我对密码实现或 python 实现感到满意。或者,两者的结合。
Some notes:
USES_COMPONENT
relationship, and that will never be circular. No matter how far out you follow a USES_COMPONENT
path, it will never hit Froot Loops.I appreciate everyone's help. I am not even entirely sure what to google, so if I've missed something obvious, a link would be appreciated.
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句