Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to query subgraphs quickly by neo4j

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "neo4j how to quickly query sub-graph," interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let Xiaobian take you to learn "neo4j how to quickly query sub-graphs"!

1. defined

The process of searching subgraphs uses a similar approach to path extension, starting from a specified node, traversing along a particular relationship type, and returning all nodes and relationships that can be reached.

APOC provides two processes for searching subgraphs:

- subgraphNodes(): Returns only reachable nodes;

- subgraphAll(): Returns nodes and relationships.

Unlike the path extension procedures expand and expandConfig, they do not return all paths.

2. application

The process of searching a subgraph does not traverse all possible paths (i.e. all possible sequences of nodes and edges) and is therefore better than the path extension process in terms of both efficiency and cost. Applicable scenarios include:

- Find the k-nearest neighbors of a node;

- jud whether node are connected;

- Divide a graph into subgraphs.

Rational use of CALL apoc. path. subgraphNodes

MATCH (intopice:Intopiece) WHERE intopice.order_number = "To be entered"CALL apoc.path.subgraphNodes(intopice, {maxLevel:1}) YIELD nodeturn node.order_number as order_number ,node.into_state as into_state,node.roster_type as roster_type---MATCH (intopice:Intopiece) WHERE intopice.order_number = "To be entered"CALL apoc.path.subgraphNodes(intopice, {maxLevel:2}) YIELD nodeturn node.order_number as order_number ,node.into_state as into_state,node.roster_type as roster_type to this, I believe that everyone has a deeper understanding of"neo4j how to quickly query sub-graphs," so let's actually operate it! Here is the website, more related content can enter the relevant channels for inquiry, pay attention to us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report