在 Neo4J 中遍历树结构时的建模替代方案和性能
我使用 Neo4J 图形数据库建模了树结构。所有节点都代表一个具有特征名称的类别。所以我必须经常从根到特定的节点/类别遍历我的树。哪个节点取决于作为输入的列表。该列表包含表示从根到目标节点的类别名称的字符串。
我想知道,将这些名称存储为边的类型而不是特定节点中的名称属性是否有效。 我认为,当我这样做时,Neo4J 不必每次在树中深入一步时都寻找每个子节点的合适名称属性。相反,Neo4J 可以在包含传出边缘的映射中查找名称。
你怎么认为?
I modelled a tree structure using the Neo4J graph database. All nodes represent a category with a characterising name. So I have to traverse my tree very often from the root to a specific node / category. To which node depends on a list coming as input. This list contains strings representing the names of the categories from the root to the target node.
I wonder, if it would be effective to store these names as the types of the edges instead of a name property in the particular nodes.
I thought that when I do so, Neo4J doesn't have to look for the fitting name property of every child node every time going a step deeper in the tree. Instead Neo4J could lookup the name in the map that contains the outgoing edges.
What do you think?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
听起来很有道理。你有多少个不同的名字?如果只是类别,那不应该是数百万。
您是否将数据加载到图表中并在两种方法之间进行性能比较?它在你的图表中对性能至关重要吗?
Sounds sensible. How many different names do you have? If it is just categories those shouldn't be millions.
Did you load your data into the graph and run a performance comparison between both approaches? Is it a performance critical thing in your graph?