A Neighbor Graph Update Method for Approximate Nearest Neighbor Search

By constructing a nearest neighbor graph and its reverse graph, deleting and compensating the in-degree of neighbor vertices, and optimizing the nearest neighbor graph structure, the low search performance and memory problems caused by dynamic data changes in the existing technology are solved, and efficient approximate nearest neighbor search is achieved.

CN117150082BActive Publication Date: 2025-09-30NORTHEASTERN UNIV CHINA
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311078258.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-08-25
Publication Date
2025-09-30
Estimated Expiration
2043-08-25

AI Technical Summary

Technical Problem

Existing approximate nearest neighbor search methods cannot effectively cope with the dynamic changes of data in vector database systems, resulting in poor search performance and memory issues.

Method used

By constructing a neighbor graph and its reverse graph, deleting expired vertices and their connecting edges, and inserting new vertices through the minimum angle maximization edge selection strategy and historical query optimization, the in-and-out degrees of neighbor vertices are compensated and the neighbor graph structure is optimized.

Benefits of technology

It improves search efficiency, solves the performance degradation problem caused by updates, supports streaming updates, and expands the applicability of vector databases.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117150082B_ABST
    Figure CN117150082B_ABST
Patent Text Reader

Abstract

The present invention provides a neighbor graph update method for approximate nearest neighbor search, relating to the field of data query technology. The method first constructs a neighbor graph and its reverse graph based on data sequences within a vector database system; then deletes expired vertices and their connecting edges from the neighbor graph; then compensates the out-degrees of the predecessor neighbor vertices of the expired vertices; selects edges based on a minimum angle maximization edge selection strategy; and compensates the in-degrees of the successor neighbor vertices of the expired vertices; simultaneously, performs secondary refinement on inserted new vertices; and finally, optimizes the neighbor graph structure based on historical queries. This method eliminates the performance degradation caused by updates, supports streaming updates, and avoids rebuilding the neighbor graph due to updates, thereby expanding the applicability of vector databases.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data query technology, and in particular to a neighbor graph updating method for approximate nearest neighbor search. Background Art

[0002] With the continuous advancement of information technology, data such as images, videos, and text has exploded in volume. This data is represented as high-dimensional vectors using deep learning methods and stored in vector database systems. Therefore, how to quickly retrieve valid information from massive amounts of high-dimensional vector data is a hot topic of research. However, nearest neighbor search algorithms often suffer from the "curse of dimensionality" problem when working with high-dimensional data, resulting in poor search performance. Approximate nearest neighbor search methods offer a balance between accuracy and speed to meet practical needs. Approximate nearest neighbor search algorithms based on nearest neighbor graphs offer both high speed and high accuracy. Consequently, the core index structure of current vector database systems (such as Milvus, Qdrant, and Zilliz) is the nearest neighbor graph—HNSW. However, existing vector database systems still have some shortcomings: their core HNSW is designed for static data and struggles to adapt to dynamic data changes. For example, in the "Pai Li Tao" feature of a shopping app, merchants upload product images to create an index. When merchants change product images, the app needs to delete the outdated vertices and insert new ones. Currently, HNSW is designed for static data in vector database systems and cannot handle the data updates that arise from real-world user interactions with the system. Therefore, for vector database systems, updating the neighbor graph is a must, as it directly impacts the applicability of the vector database.

[0003] The paper "Malkov YA, Yashunin D A. Efficient and robust approximate nearest neighbor search using hierarchical navigable small world graphs [J]. IEEE transactions on pattern analysis and machine intelligence, 2018, 42(4): 824-836." proposes an incremental indexing structure. It continuously inserts vectors from the dataset into the nearest neighbor graph, selects a set of candidate neighbors based on the current graph, eliminates the longest edges of all triangles according to the edge selection strategy relative to the neighborhood graph, and reduces the average out-degree of the graph to a constant related to the dimension, thus forming a nearest neighbor graph. The HNSW algorithm proposes a mask method for deletion. The main idea is to mark expired nodes as deleted. When we perform a best-first search, we still visit the vertices marked "deleted", thereby preserving the connectivity of the original nearest neighbor graph.

[0004] The paper "Wang J, Yi X, Guo R, et al. Milvus: A Purpose-Built Vector Data Management System[C] / / SIGMOD / PODS'21: International Conference on Management of Data.2021" is a purpose-built data management system for efficiently managing large-scale vector data. Milvus supports both simple and complex queries for vector similarity search, but its core index structure does not support dynamic data changes, which significantly limits its applicability.

[0005] Although the method described in the document "Malkov YA, Yashunin D A. Efficient and robust approximate nearest neighbor search using hierarchical navigable small world graphs [J]. IEEE transactions on pattern analysis and machine intelligence, 2018, 42(4): 824-836." shows good performance in searching vectors, it cannot well support the update of the nearest neighbor graph method. In real applications, databases can use nearest neighbor graphs to maintain similarity relationships between feature vectors. Over time, these feature vectors need to be adjusted. However, the nearest neighbor graph-based algorithm can only process static data and cannot support the dynamic changes of feature vectors in real scenarios. Summary of the Invention

[0006] The technical problem to be solved by the present invention is to address the shortcomings of the above-mentioned existing technologies and provide a neighbor graph updating method for approximate nearest neighbor search, so as to solve the problem that the existing approximate nearest neighbor search cannot cope with the data update problem caused by the interaction between users and vector database systems in the real world.

[0007] To solve the above technical problems, the technical solution adopted by the present invention is: a neighbor graph updating method for approximate nearest neighbor search, comprising the following steps:

[0008] Step 1: Based on the data sequence in the vector database system, construct the neighbor graph G and its reverse graph G′;

[0009] When constructing a neighbor graph, its reverse graph is also constructed to obtain the information of the predecessor neighbor vertices of the expired vertices in the neighbor graph, that is, the predecessor neighbor vertex of each vertex in the neighbor graph is equal to the successor neighbor vertex of the corresponding vertex in the reverse graph;

[0010] Step 2: Delete expired vertices and their connected edges in the neighbor graph;

[0011] Given an expired vertex ev, first obtain its predecessor neighbor vertex set N in (ev) and the set of successor neighbor vertices N out (ev); for each predecessor neighbor vertex pn j ∈N in , delete the edge on the neighbor graph G <pn j ,ev>, delete the edge on the reverse graph G′ <ev,pn j > For each successor neighbor vertex sn k ∈N out, delete the edge on the neighbor graph G <ev,sn k >, delete the edge on the reverse graph G′ <sn k ,ev>; Finally, after deleting the edges between the expired vertex ev and all its predecessor neighbors and successor neighbors, we can obtain the neighbor graph G and reverse graph G′ after deleting the expired vertex;

[0012] Step 3: Compensate the out-degree of the predecessor neighbor vertex of the expired vertex;

[0013] First, all predecessor neighbor vertices of the expired vertex are obtained in the neighbor graph. Second, for each predecessor neighbor vertex of the expired vertex, the l vertices closest to the predecessor neighbor vertex and their first-order neighbors are obtained as the candidate neighbor set through a greedy algorithm. The l vertices are sorted in ascending order according to distance using a priority queue to obtain a priority queue.

[0014] Step 4: Select edges based on the edge selection strategy of maximizing the minimum angle;

[0015] In the edge selection stage, first use the bisection algorithm to select an angle threshold; secondly, take the nearest candidate neighbors from the priority queue in turn and calculate the angle between the vertices; if the minimum angle between the vertex selected from the priority queue and the neighbor already in the neighbor graph is greater than the threshold, then add the vertex to the neighbor set; if the set number of neighbor vertices cannot be selected at the angle threshold, this may result in no neighbors in some directions; at this time, the angle threshold should be reduced and the neighbor vertices should be reselected; if the set number of neighbors have been selected at the angle threshold, record the current angle threshold; at this time, the angle threshold should be increased and the neighbor vertices should be reselected; if the set number of neighbors can still be selected after increasing the angle, it means that the angle threshold is too small; otherwise, the current angle threshold is the optimal angle threshold; finally, output the neighbor vertex set generated under the optimal angle threshold;

[0016] Step 5: Compensate the in-degree of the successor neighbor vertex of the expired vertex;

[0017] The problem of increasing the in-degree of the successor neighbor vertices of an expired vertex is transformed into the problem of increasing the out-degree of the predecessor neighbor vertices of the expired vertex in the reverse neighbor graph. Specifically, all predecessor neighbor vertices of the expired vertex in the reverse graph with out-degree less than a threshold are treated as new vertices and reinserted into the reverse graph. The number of neighbors of the new vertex is determined according to the threshold. The in-degree of the neighbor vertices selected by the reverse graph cannot exceed the maximum out-degree limit of the neighbor graph.

[0018] Step 6: Perform secondary refinement on the inserted new vertices;

[0019] Perform secondary refinement on the inserted new vertices. That is, after the number of newly inserted vertices reaches a set number, reselect neighbors for all newly inserted vertices based on all vertices to further improve the neighborhood graph structure.

[0020] Step 7: Optimize the neighbor graph structure based on historical queries;

[0021] First, the recall rate of the historical query set of the neighbor graph is calculated; if the recall rate of a query point in the historical query set is lower than the threshold, it is inserted into the neighbor graph as a temporary point, and neighbors are selected for these temporary points according to the edge selection strategy based on maximizing the minimum angle, and bidirectional edges are established; at the same time, the access frequency of the temporary point is set to 1; since the distribution of temporary points is closer to the distribution of query points, temporary points cannot be connected to each other; next, the historical query is re-executed; when the first-order neighborhood of the temporary vertex is visited, the access frequency of the temporary vertex is increased by 1; finally, all temporary vertices and their connections whose access frequency is lower than the set threshold are deleted.

[0022] The beneficial effects of adopting the above technical solution are as follows: the present invention provides a neighbor graph update method for approximate nearest neighbor search, which first solves the memory and efficiency problems caused by the HNSW mask algorithm deleting nodes. Secondly, by designing an edge selection strategy that maximizes the minimum angle and an insertion algorithm guided by historical queries, the previous problems of uneven distribution of neighbor nodes in the neighbor graph and overfitting of the data set are solved, thereby improving search efficiency. Finally, the deletion and insertion methods proposed in the present invention eliminate the problem of performance degradation caused by updates, support streaming updates, and avoid rebuilding the neighbor graph due to updates, which increases the scope of application of vector databases.

[0023] The method of the present invention solves the problem that the existing graph algorithm of ANNS only supports static indexing and cannot reflect the real-time changes in the corpus required for many key real-world scenarios. In this case, retaining expired nodes will waste time, reduce search accuracy and efficiency, and cause memory problems, while removing these nodes and their edges will destroy the connectivity of the graph, resulting in inefficiency in the search phase. The present invention ensures the connectivity of the neighbor graph by better compensating the neighbors of expired nodes with edges, realizes the deletion of vertex information, and completes the insertion of new nodes through a better edge selection strategy and historical query optimization, completing the update of the neighbor graph without rebuilding the index. This update algorithm can reflect corpus updates in the index in real time without affecting search performance. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] Figure 1 A flowchart of a method for updating a neighbor graph for approximate nearest neighbor search provided by an embodiment of the present invention;

[0025] Figure 2A diagram comparing the insertion process of the HNSW algorithm provided in an embodiment of the present invention and the insertion process of the method of the present invention, wherein (a) is a schematic diagram of the insertion process of the HNSW algorithm, (b) is a schematic diagram of the insertion process of the method of the present invention, and (c) is a schematic diagram of the method of the present invention using historical queries to optimize the neighbor graph structure;

[0026] Figure 3 A comparison diagram of the deletion process of the HNSW algorithm provided in an embodiment of the present invention and the HNSW deletion process, wherein (a) is a schematic diagram of the deletion process of the HNSW algorithm, and (b) is a schematic diagram of the deletion process of the method of the present invention. DETAILED DESCRIPTION

[0027] The following embodiments of the present invention are described in further detail with reference to the accompanying drawings and examples. The following examples are used to illustrate the present invention but are not intended to limit the scope of the present invention.

[0028] In this embodiment, a neighbor graph updating method for approximate nearest neighbor search includes two parts: node updating and node connection optimization. Figure 1 As shown, the specific steps include:

[0029] Step 1: Based on the data sequence in the vector database system, construct a neighbor graph G and its reverse graph G′. The key difficulty in deleting expired vertices in the neighbor graph is that each vertex can only know its successor neighbors, but not its predecessor neighbors, making it impossible to delete the connection between the expired vertex and its predecessor neighbors. To solve this problem, the present invention constructs its reverse graph at the same time as constructing the neighbor graph, which is used to obtain information about the predecessor neighbor vertices of the expired vertices in the neighbor graph. That is, the predecessor neighbor vertex of each vertex in the neighbor graph is equal to the successor neighbor vertex of the corresponding vertex in the reverse graph.

[0030] Step 2: Delete expired vertices and their connected edges in the neighbor graph; under the condition that the reverse graph of the neighbor graph is constructed, the predecessor vertex of the expired vertex can be found in the reverse graph, which enables the connection between the expired vertex and its predecessor neighbors to be deleted, thereby saving search efficiency. Specifically, given an expired vertex ev, first obtain its predecessor neighbor vertex set N in (ev) and the set of successor neighbor vertices N out (ev); for each predecessor neighbor vertex pn j ∈N ih , delete the edge on the neighbor graph G <pn j , e v >, delete the edge on the reverse graph G′ <ev,pn j > For each successor neighbor vertex sn k ∈N out , delete the edge <ev,sn on the neighbor graph G k>, delete the edge on the reverse graph G′ <sn k ,ev>; Finally, after deleting the edges between the expired vertex ev and all its predecessor and successor neighbors, we get the neighbor graph G and reverse graph G′ after deleting the expired vertex. ;

[0031] Step 3: Compensate the out-degree of the predecessor neighbor vertices of the expired vertex; The core idea of ​​compensating the out-degree of the predecessor neighbor vertices of the expired vertex is to re-establish connections for all the predecessor neighbor vertices of the expired vertex, that is, to reinsert all the predecessor neighbors of the expired vertex as new vertices. In this way, all the predecessor neighbor vertices of the expired vertex have the opportunity to reselect neighbors to improve their connections, thereby improving the search efficiency. Specifically, first obtain all the predecessor neighbor vertices of the expired vertex in the neighbor graph, and secondly, for each predecessor neighbor vertex of the expired vertex, use a greedy algorithm to obtain the l vertices closest to the predecessor neighbor vertex and their first-order neighbors as the candidate neighbor set, and use the priority queue to sort the l vertices in ascending order according to distance to obtain a priority queue;

[0032] Step 4: Select edges based on the edge selection strategy of maximizing the minimum angle. In the edge selection stage, first use the binary algorithm to select an angle threshold, which ranges from 60° to 180°. Secondly, take the nearest candidate neighbors from the priority queue in turn and calculate the angle between the vertices. If the minimum angle between the vertex selected from the priority queue and the neighbors already in the neighbor graph is greater than the threshold, then add the vertex to the neighbor set. If the set number of neighbor vertices cannot be selected at the angle threshold, this may result in no neighbors in some directions. At this time, the angle threshold should be reduced and the neighbor vertices should be reselected. If the set number of neighbors has been selected at the angle threshold, record the current angle threshold. At this time, the angle threshold should be increased and the neighbor vertices should be reselected. The purpose of increasing the angle threshold is to determine whether the currently selected neighbors are concentrated in the same area because the angle threshold is too small, so that a sufficient number of neighbors can be selected. If the set number of neighbors can still be selected after increasing the angle, it means that the angle threshold is too small. Otherwise, the current angle threshold is the optimal angle threshold. Finally, output the neighbor vertex set generated under the optimal angle threshold.

[0033] Step 5: Compensate the in-degree of the successor neighbor vertices of expired vertices; The core idea of ​​compensating the in-degree of the successor neighbor vertices of expired vertices is: for expired vertices in the neighbor graph, add connections to all of their successor neighbors with in-degree less than a threshold to increase their in-degree and ensure the search accuracy of the neighbor graph. The difficulty of this operation is that it is impossible to directly find new predecessor neighbors for these successor neighbors in the neighbor graph. To this end, the present invention establishes a reverse neighbor graph to complete this operation. The problem of increasing the in-degree of the successor neighbor vertices of expired vertices is converted into the problem of increasing the out-degree of the predecessor neighbor vertices of the expired vertices in the reverse neighbor graph; specifically, all predecessor neighbor vertices of the expired vertices in the reverse graph with out-degree less than a threshold are regarded as new vertices and reinserted into the reverse graph, and the number of neighbors of the new vertex is determined according to the threshold; it should be noted that the in-degree of the neighbor vertices selected by the reverse graph cannot exceed the maximum out-degree limit of the neighbor graph; the purpose of this is to avoid repairing the connections in the neighbor graph based on the connections in the reverse graph, causing the out-degree of some vertices in the neighbor graph to exceed the maximum out-degree limit of the neighbor graph. In this way, the in-degree of the successor neighbors of the expired vertex can be compensated, thereby increasing the probability of the successor neighbors being searched, and thus improving the search accuracy.

[0034] Step 6: Perform secondary refinement on the inserted new vertices. Since the new edges inserted by the HNSW method are connected based on existing vertices, which may not necessarily be the most effective neighbors, the present invention performs secondary refinement on the inserted new vertices. That is, after the number of newly inserted vertices reaches a set number, neighbors are reselected for all newly inserted vertices based on all vertices, further improving the neighborhood graph structure.

[0035] Step 7: Optimize the neighborhood graph structure based on historical queries. First, calculate the recall of the historical query set in the neighborhood graph. If the recall of a query point in the historical query set is below a threshold, it is inserted into the neighborhood graph as a temporary point. Neighbors are selected for these temporary points using an edge selection strategy based on maximizing the minimum angle, and bidirectional edges are established. At the same time, the visit frequency of the temporary point is set to 1. It is important to note that because the distribution of temporary points is closer to that of the query points, they cannot be connected to each other. Otherwise, the greedy search will pass through many temporary points and fail to quickly find the query point's true neighbors, thus losing the guiding role of the temporary points and reducing search efficiency. (The guiding role of temporary points refers to the role of temporary points in providing "guidance" for the search in the neighborhood graph.) Next, re-execute the historical query. When the first-order neighbors of a temporary vertex are visited, the visit frequency of the temporary vertex is increased by 1. Finally, all temporary vertices and their connections with a visit frequency below the set threshold are deleted. This retains temporary points that provide good guidance for the query while removing those that do not, saving memory and improving efficiency.

[0036] In this embodiment, the technical solution of the present invention is compared with the deletion and insertion of the HNSW method in the existing vector database. Figure 2 and Figure 3 As shown. The method of the present invention optimizes deletion and insertion, thereby completing the update of the neighbor graph. Figure 3 As shown in , the method of the present invention aims to reduce the impact of deleting expired nodes on the neighborhood graph structure by ensuring the balance of in- and out-degrees of the expired node neighborhood. Figure 2 As shown in (b), we use the edge selection strategy of maximizing the minimum angle to reduce the length of the search path, thereby improving the search efficiency. Figure 2 As shown in (c), for query vectors whose search time exceeds a threshold, we design a historical query-guided insertion algorithm. By setting temporary edges with frequency weights, we improve the local structure of the neighborhood graph and reduce redundant searches. This update method not only avoids the time overhead of rebuilding the neighborhood graph, but also has little impact on search performance after the neighborhood graph is updated.

[0037] like Figure 3 As shown in (a), the deletion method of the HNSW method does not actually delete the data. As the number of deletion operations increases, it will cause memory problems. Figure 3 As shown in (b), the method of the present invention actually deletes data and ensures the connectivity of the neighbor graph, without causing memory problems. Assuming the search starting point is e, for query c, the search path of HNSW's method is 2, while the search path of this method is 1. This is because each query still calculates the distance to the expired node, resulting in a large number of redundant searches, thereby reducing query efficiency. Figure 2 As shown in (b), when inserting a new node, the insertion method proposed in this invention makes the neighbors more evenly distributed in each area, while the neighbors obtained by the HNSW method are often concentrated in certain areas. When the query point is in the P4 area, the search can only reach P1, P2 and P3 first, and then take a long detour to reach P4. This will cause the search path to be non-monotonic and reduce the search efficiency. Since the neighbor graph overfits the data set, when querying data that does not belong to the data set, the search efficiency is often reduced. Figure 2 As shown in (c), the present invention uses historical queries to optimize the neighbor graph structure. Assuming the search starting point is a circle node, for query q, the HNSW method requires three search paths, while the present invention requires only two, improving search efficiency.

[0038] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some or all of the technical features therein. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope defined by the claims of the present invention.

Claims

1. A method for updating a neighbor graph for approximate nearest neighbor search, characterized by: The following steps are involved: Step 1: Based on the data sequence in the vector database system, construct the neighbor graph G and its reverse graph G ′ ; The vector database system stores image, video or text data; Step 2: Delete expired vertices and their connected edges in the neighbor graph; Step 3: Compensate the out-degree of the predecessor neighbor vertex of the expired vertex; First, all predecessor neighbor vertices of the expired vertex are obtained in the neighbor graph. Second, for each predecessor neighbor vertex of the expired vertex, the l vertices closest to the predecessor neighbor vertex and their first-order neighbors are obtained as the candidate neighbor set through a greedy algorithm. The l vertices are sorted in ascending order according to distance using a priority queue to obtain a priority queue. Step 4: Select edges based on the edge selection strategy of maximizing the minimum angle; In the edge selection phase, a bisection algorithm is first used to select an angle threshold. Then, the nearest candidate neighbors are sequentially taken from the priority queue and the angles between them are calculated. If the minimum angle between a vertex selected from the priority queue and an existing neighbor in the neighbor graph is greater than the threshold, the vertex is added to the neighbor set. If the set number of neighbor vertices cannot be selected at the angle threshold, this may result in no neighbors in some directions. In this case, the angle threshold should be reduced and the neighbor vertices should be reselected. If the set number of neighbors has been selected at the angle threshold, record the current angle threshold. At this point, the angle threshold should be increased and neighbor vertices should be reselected. If the set number of neighbors can still be selected after increasing the angle, it means that the angle threshold is too small. Otherwise, the current angle threshold is the optimal angle threshold. Finally, the set of neighbor vertices generated under the optimal angle threshold is output. Step 5: Compensate the in-degree of the successor neighbor vertex of the expired vertex; The problem of increasing the in-degree of the successor neighbor vertices of an expired vertex is transformed into the problem of increasing the out-degree of the predecessor neighbor vertices of the expired vertex in the reverse neighbor graph. Specifically, all predecessor neighbor vertices of the expired vertex in the reverse graph with out-degree less than a threshold are treated as new vertices and reinserted into the reverse graph. The number of neighbors of the new vertex is determined according to the threshold. The in-degree of the neighbor vertices selected by the reverse graph cannot exceed the maximum out-degree limit of the neighbor graph. Step 6: Perform secondary refinement on the inserted new vertices; The aforementioned secondary refinement of the inserted new vertices, that is, after the number of newly inserted vertices reaches a set number, neighbors are reselected for all newly inserted vertices based on all vertices to further improve the neighborhood graph structure; Step 7: Optimize the neighbor graph structure based on historical queries.

2. The method for updating a neighbor graph for approximate nearest neighbor search according to claim 1, characterized in that: When constructing the neighbor graph, step 1 also constructs its reverse graph to obtain information about the predecessor neighbor vertices of the expired vertices in the neighbor graph, that is, the predecessor neighbor vertex of each vertex in the neighbor graph is equal to the successor neighbor vertex of the corresponding vertex in the reverse graph.

3. The method for updating a neighbor graph for approximate nearest neighbor search according to claim 2, characterized in that: The specific method of step 2 is: Given an expired vertex ev, first obtain its predecessor neighbor vertex set N in (ev) and the set of successor neighbor vertices N out (ev); for each predecessor neighbor vertex pn j ∈N in , delete the edge on the neighbor graph G <pn j ,ev>, delete the edge on the reverse graph G′ <ev,pn j > For each successor neighbor vertex sn k ∈N out , delete the edge on the neighbor graph G <ev,sn k >, delete the edge on the reverse graph G′ <sn k ,ev>;Finally, after deleting the edges between the expired vertex ev and all its predecessor neighbors and successor neighbors, we can obtain the neighbor graph G and reverse graph G′ after deleting the expired vertex.

4. The method for updating a neighbor graph for approximate nearest neighbor search according to claim 3, characterized in that: The specific method of step 7 is: First, the recall rate of the historical query set of the neighbor graph is calculated; if the recall rate of a query point in the historical query set is lower than the threshold, it is inserted into the neighbor graph as a temporary point, and neighbors are selected for these temporary points according to the edge selection strategy based on maximizing the minimum angle, and bidirectional edges are established; at the same time, the access frequency of the temporary point is set to 1; since the distribution of temporary points is closer to the distribution of query points, temporary points cannot be connected to each other; next, the historical query is re-executed; when the first-order neighborhood of the temporary vertex is visited, the access frequency of the temporary vertex is increased by 1; finally, all temporary vertices and their connections whose access frequency is lower than the set threshold are deleted.