Searching device, searching method, and searching program

The search device efficiently addresses the inefficiency of conventional BFS query methods by pre-processing BFS trees within the 2-core of a graph, allowing for reduced query processing time and improved performance in BFS queries.

WO2024176415A1PCT designated stage expired Publication Date: 2024-08-29NIPPON TELEGRAPH & TELEPHONE CORP
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
PCT/JP2023/006592
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Filing Date
2023-02-22
Publication Date
2024-08-29

AI Technical Summary

Technical Problem

Conventional methods for solving the BFS query problem are inefficient as they often require searching the entire graph, leading to decreased performance.

Method used

A search device and method that pre-processes the graph to calculate a BFS tree starting from a vertex within the 2-core, allowing for efficient BFS tree construction by joining pre-computed BFS trees, thereby reducing the need for full graph searches during query processing.

Benefits of technology

This approach significantly reduces query processing time by pre-computing BFS trees for vertices within the 2-core, enabling efficient BFS queries without searching the entire graph, thus improving the efficiency of BFS query solutions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure JP2023006592_29082024_PF_FP_ABST
    Figure JP2023006592_29082024_PF_FP_ABST
Patent Text Reader

Abstract

A searching device (100) according to an embodiment of the present invention comprises: a preprocessing unit (151); and a query processing unit (152). The preprocessing unit (151) obtains a BFS tree in which an apex included in a 2-core of a graph is set as a start point. The query processing unit (152) outputs a BFS tree obtained by joining: a BFS tree obtained through execution of BFS for the inside of the 2-core of the graph from a designated start point; and a portion of the BFS tree obtained by the preprocessing unit (151).
Need to check novelty before this filing date? Find Prior Art

Description

Searching device, searching method and searching program

[0001] The present invention relates to a search device, a search method, and a search program.

[0002] Breadth-first search (BFS) is a well-known method for manipulating graph-structured data. BFS is used in fields such as data mining, route search (car navigation, transit guides), network design, and circuit design.

[0003] Furthermore, when a vertex is given, the problem of finding a BFS tree starting from the vertex is called a BFS query problem. Conventionally, to solve a BFS query problem, a method has been used in which a naive BFS is performed from the starting point to find a BFS tree.

[0004] V. Batagelj and M. Zaversnik, "An O(m) Algorithm for Cores Decomposition of Networks," CoRR, 2003.

[0005] However, the conventional techniques have a problem in that they may not be able to solve the BFS query problem efficiently.

[0006] Conventional techniques may be inefficient because they require searching the entire graph to solve a BFS query problem.

[0007] In order to solve the above-mentioned problems and achieve the object, a search device is characterized by having a first processing unit that obtains a BFS tree starting from a vertex included in the 2-core of a graph, and a second processing unit that outputs a BFS tree obtained by joining a BFS tree obtained by performing BFS from a specified starting point to the inside of the 2-core of the graph and a part of the BFS tree obtained by the first processing unit.

[0008] According to the present invention, the BFS query problem can be solved efficiently.

[0009] FIG. 1 is a diagram showing an example of a graph. FIG. 2 is a diagram showing an example of a BFS tree. FIG. 3 is a diagram showing an example of the configuration of a search device according to a first embodiment. FIG. 4 is a diagram explaining the effect of pre-processing. FIG. 5 is a diagram showing the flow of pre-processing. FIG. 6 is a diagram showing the flow of query processing. FIG. 7 is a flowchart showing the flow of processing of the search device according to the first embodiment. FIG. 8 is a flowchart showing the flow of pre-processing. FIG. 9 is a flowchart showing the flow of query processing. FIG. 10 is a diagram showing an example of a computer that executes a search program.

[0010] DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS Preferred embodiments of a search device, a search method, and a search program according to the present invention will be described in detail below with reference to the accompanying drawings. However, the present invention is not limited to the following embodiments.

[0011] G is a simple undirected graph. V(G) is the set of vertices of graph G. Also, E(G) is the set of edges of graph G.

[0012] [Definition of BFS Tree] First, we will explain the BFS tree. A BFS tree starting from a vertex s of a graph G is a rooted tree that includes all vertices reachable from the vertex s, has a vertex that is a distance i from the vertex s as its parent, and has a vertex that is an adjacent vertex of the parent that is a distance i+1 as its child.

[0013] An example of a graph G is shown in Fig. 1. Each vertex of the graph G is identified by a number (numbers 0 to 11 in the example of Fig. 1).

[0014] 2 is a diagram showing an example of a BFS tree. Fig. 2 shows a BFS tree constructed starting from vertex 0 of graph G. Arrows in the BFS tree point from parents to children.

[0015] [Definition of Parent Array] A BFS tree is expressed by a parent array, which is an array that stores the parent of each vertex. The parent array p of the BFS tree starting from vertex s is s is an array such as: 1. p s (s) = s 2. For a vertex u that is reachable from vertex s and is not vertex s, p s(u) is the parent of u. 3. For a vertex u that is unreachable from vertex s, p s (u)=-1.

[0016] For example, let p be the parent sequence corresponding to the BFS tree in FIG. 0 Then, p 0 (0) = 0, p 0 (1) = 0, p 0 (2) = 1. Hereinafter, the BFS tree and the parent array are regarded as the same thing. In other words, obtaining a BFS tree is synonymous with obtaining a parent array.

[0017] [Definition of the BFS Query Problem] When a vertex s is given, the problem of finding a BFS tree starting from vertex s is called a BFS query problem. One objective of this embodiment is to efficiently solve the BFS query problem.

[0018] The configuration of the search device 100 will be described using Fig. 3. Fig. 3 is a diagram showing an example of the configuration of the search device according to the first embodiment. As shown in Fig. 3, the search device 100 includes a communication unit 110, an input unit 120, an output unit 130, a storage unit 140, and a control unit 150.

[0019] The communication unit 110 performs data communication with other devices. For example, the communication unit 110 is an interface such as a network interface card (NIC).

[0020] The input unit 120 receives input of data. For example, the input unit 120 is an interface connected to input devices such as a mouse and a keyboard.

[0021] The output unit 130 outputs data. The output unit 130 is an interface connected to an output device such as a display and a speaker.

[0022] The storage unit 140 is a storage device such as a hard disk drive (HDD), a solid state drive (SSD), an optical disk, etc. The storage unit 140 may also be a data-rewritable semiconductor memory such as a random access memory (RAM), a flash memory, or a non-volatile static random access memory (NVSRAM). The storage unit 140 stores the OS and various programs executed by the searching device 100.

[0023] The storage unit 140 stores graph information 141. The graph information 141 includes, for example, a graph G.

[0024] The control unit 150 controls the entire searching device 100. The control unit 150 is, for example, an electronic circuit such as a CPU (Central Processing Unit), MPU (Micro Processing Unit), or GPU (Graphics Processing Unit), or an integrated circuit such as an ASIC (Application Specific Integrated Circuit) or FPGA (Field Programmable Gate Array). The control unit 150 also has an internal memory for storing programs that define various processing procedures and control data, and executes each process using the internal memory.

[0025] The control unit 150 also functions as various processing units when various programs are executed. For example, the control unit 150 includes a pre-processing unit 151 and a query processing unit 152.

[0026] The pre-processing unit 151 performs pre-processing for executing a BFS query based on the target graph, and outputs a parent array.

[0027] The query processing unit 152 performs query processing. That is, the query processing unit 152 executes a BFS query based on the graph, the parent array output by the preprocessing unit 151, and the specified starting point, and outputs the parent array.

[0028] The preprocessing unit 151 predetermines a parent array when an appropriately selected vertex is used as the starting point. When executing a BFS query, the query processing unit 152 calculates the difference between the parent array for the specified starting point and the parent array obtained in the preprocessing.

[0029] This allows the query processing unit 152 to efficiently obtain a BFS tree without searching the entire graph when executing a BFS query.

[0030] The effect of pre-processing will be explained using FIG. 4. FIG. 4 is a diagram for explaining the effect of pre-processing. FIG. 4 shows a BFS tree starting from vertex 5 based on graph G. The parents of the vertices represented by dotted lines in FIG. 4 (vertices 3, 6, 8, 10, and 11) are the same as the parents of each vertex in the BFS tree starting from vertex 0 shown in FIG. 2.

[0031] Therefore, if the BFS tree in Fig. 2 is obtained in pre-processing, the vertices indicated by dotted lines in Fig. 4 (vertices 3, 6, 8, 10, and 11) are omitted in query processing, which results in a reduction in query processing time.

[0032] The pre-processing and query processing of this embodiment will now be described in detail. As described above, the pre-processing improves the efficiency of BFS query execution in the subsequent query processing.

[0033] It is assumed that the graph G is connected. The preprocessing unit 151 selects vertices of the graph G whose parents may change, that is, vertices that need to be searched during query processing, from among the vertices of the graph G, and then selects the vertices G, which is the 2-core of the graph G. c The pre-processing unit 151 can find the 2-core by using the algorithm described in Non-Patent Document 1.

[0034] As shown in Figure 1, by the definition of 2-core, graph G to G c Graph G after removing f is a set of multiple trees T i Here, T i is G c It can be thought of as a rooted tree with the vertex connected to i T except that contains the starting pointi It itself always forms part of the BFS tree, and the structure of that part does not change.

[0035] Therefore, when executing a BFS query, the query processing unit 152 f By skipping the visit to G c The parent sequence can be obtained by searching only T. i If the query processing unit 152 determines whether the starting point is included in G c After reversing the parent-child relationship on the path leading to T i From the vertex connected to G c The parent sequence can be obtained by performing BFS within the

[0036] Specific procedures for pre-processing and query processing will be described using the graph G shown in FIG. 1 as an example. First, the pre-processing unit 151 processes the graph G, which is a 2-core of the graph G. c Graph G f is graph G to graph G c The part excluding the forest is the forest. 0 , T 1 , T 2 are G f It is a tree included in.

[0037] The BFS tree starting from vertex 5 (FIG. 4) differs from the BFS tree starting from vertex 0 (FIG. 2) in the following points (1) and (2). c The parent-child relationships of the vertices (vertices 5, 4, and 2) on the path leading to G are reversed. c Inside is T 0 is replaced by a BFS tree starting from the point of contact (vertex 1) with

[0038] The pre-processing unit 151 f Among them, T 0 It is specified that there is no need to search trees other than

[0000] . As a result, the query processing unit 152 can execute the BFS query efficiently.

[0039] Here, we have described the case where graph G is connected. If graph G is not connected, the preprocessing unit 151 needs to perform preprocessing for each connected component. However, it is known that many real-world graphs contain extremely large connected components (GCCs).

[0040] Because connected components other than GCC are relatively small, even if pre-processing is not performed, the query processing unit 152 can execute a BFS query for connected components other than GCC in a short time. For this reason, in this embodiment, pre-processing is performed only on GCC.

[0041] Fig. 5 shows pseudo code for the pre-processing. Fig. 5 is a diagram showing the flow of the pre-processing. Fig. 6 shows pseudo code for the query processing. Fig. 6 is a diagram showing the flow of the query processing.

[0042] The process flow of the searching device 100 will be explained using pseudocode and a flowchart. Specific calculation examples will also be shown as appropriate using graph G in FIG.

[0043] 7 is a flowchart showing the flow of processing by the search device according to the first embodiment. As shown in FIG. 7, the pre-processing unit 151 executes pre-processing (step S100). Thereafter, the query processing unit 152 executes query processing based on the results of the pre-processing (step S200).

[0044] 8 is a flowchart showing the flow of the pre-processing (step S100 in FIG. 7). As shown in FIG. 8, the pre-processing unit 151 performs the pre-processing of the graph G g (Step S101) (first line of FIG. 5). In the example of FIG. 1, g =G.

[0045] Next, the pre-processing unit 151 g G, which is a 2-core c is calculated (step S102) (second line in FIG. 5).

[0046] Next, the pre-processing unit 151 calculates V(G c) (step S103) (line 3 of FIG. 5). c ) are vertices 0, 1, 7, and 9.

[0047] Then, the preprocessing unit 151 performs BFS on G from the vertex r, and r is calculated (step S104) (fourth line in FIG. 5).

[0048] For example, when the preprocessing unit 151 selects the vertex 0 as the vertex r, the preprocessing unit 151 creates the following parent array p r That is, p r (0) = 0, p r (1) = 0, p r (2) = 1, p r (3) = 2, p r (4) = 2, p r (5) = 4, p r (6) = 4, p r (7) = 0, p r (8) = 7, p r (9) = 0, p r (10) = 9, p r (11) = 10.

[0049] 9 is a flowchart showing the flow of the query process (step S200 in FIG. 7). First, in the query process, a vertex s is specified. As shown in FIG. 9, first, the query processing unit 152 checks whether the vertex s is in G g It is checked whether the vertex is a vertex of (step S201) (first line in FIG. 6).

[0050] Vertex s is G g If the vertex is a vertex of (Yes at step S201), the query processing unit 152 proceeds to step S203.

[0051] Vertex s is G g If it is not a vertex of (step S201, No), BFS is performed on G from vertex s, the parent array is output, and the process ends (step S202) (lines 2 and 3 in FIG. 6).

[0052] The specified vertex s is assumed to be vertex 5. Vertex 5 is G g Since the vertex of , the query processing unit 152 proceeds to Yes in step 201 .

[0053] Next, the query processing unit 152 r Copy of p s (step S203) (lines 4 and 5 in FIG. 6). At this time, in accordance with the definition of the parent array, the query processing unit 152 sets p s Substitute s for (s).

[0054] The query processing unit 152 determines whether the vertex s is in G c (No in step S204), the query processing unit 152 executes step S205 (line 6 in FIG. 6). c If the vertex is included in the vertices of (Yes in step S204), the process proceeds to step S206.

[0055] In step S205, the query processing unit 152 s Reverse the parent-child relationship and change s to G c (lines 7 and 8 in Figure 6).

[0056] Here, every time step S205 is executed, the query processing unit 152 executes the p s (p r (s)) to p s (4) = 5, p s (2) = 4, p s (1)=2. Furthermore, the query processing unit 152 changes s to 5, 4, 2, and 1 by the process on the eighth line of FIG. 6. Note that vertex 1 is V(G c ), when s=1, the query processing unit 152 exits the loop defined by the while statement on the sixth line in FIG.

[0057] Then, the query processing unit 152 performs BFS on G from the vertex s, and creates an array p s (step S206) (line 9 in FIG. 6). s (0) = 1, p s (7) = 1, p s (9) = 7. In the definition of the parent array, p s (9) may be 0.

[0058] The query processing unit 152 overwrites the array p s (step S207) (line 10 in FIG. 6). For example, the array that is output is the parent array when vertex 5 is the starting point.

[0059] In BFS, according to the definition of the parent sequence, p s However, in the BFS in step S206 (line 9 in FIG. 6), the query processing unit 152 substitutes p s This is because the query processing unit 152 substitutes the correct parent in step S205 (lines 6, 7, and 8 in FIG. 6).

[0060] As explained above, the preprocessing unit 151 (an example of a first processing unit) obtains a BFS tree starting from a vertex included in the 2-core of the graph. For example, in the case of G, which is the 2-core of the graph G in FIG. c A BFS tree is obtained starting from vertex 0 included in the above.

[0061] Then, the query processing unit 152 (an example of a second processing unit) outputs a BFS tree obtained by joining a BFS tree obtained by performing BFS on the inside of the 2-core of the graph from the specified starting point with a part of the BFS tree obtained by the pre-processing unit 151. This is because, for example, in step S209 of FIG. 9, the query processing unit 152 outputs a BFS tree obtained by joining a part of the BFS tree obtained by the pre-processing unit 151 with the BFS tree obtained by performing BFS on the inside of the 2-core of the graph from the specified starting point. c This is realized by overwriting the parent array determined by the pre-processing unit 151 for the vertices of .

[0062] In other words, the query processing unit 152 obtains a BFS tree from the specified starting point for the inside of the 2-core of the graph and for a rooted tree that includes the specified starting point among multiple rooted trees connected to the 2-core of the graph.The query processing unit 152 then outputs a BFS tree obtained by joining to the obtained BFS tree a portion of the BFS tree obtained by the pre-processing unit 151 that corresponds to a rooted tree that does not include the specified starting point among the multiple rooted trees.

[0063] For example, the query processing unit 152 is a G c , T, a rooted tree containing the starting point 0On the other hand, the query processing unit 152 performs BFS on T 1 , T 2 The processing result of the pre-processing unit 151 is used without performing BFS on

[0064] In this way, the pre-processing unit 151 can reduce resources required for executing a BFS query, thereby enabling the BFS query problem to be solved efficiently.

[0065] [System Configuration, etc.] The components of each device shown in the figure are conceptual functional units and do not necessarily have to be physically configured as shown. In other words, the specific form of distribution and integration of each device is not limited to that shown in the figure, and all or part of the devices can be functionally or physically distributed or integrated in any unit depending on various loads, usage conditions, etc. Furthermore, all or any part of the processing functions performed by each device can be realized by a CPU (Central Processing Unit) and a program analyzed and executed by the CPU, or can be realized as hardware using wired logic. The program may be executed not only by the CPU but also by other processors such as a GPU.

[0066] Furthermore, among the processes described in this embodiment, all or part of the processes described as being performed automatically can be performed manually, or all or part of the processes described as being performed manually can be performed automatically using a known method.In addition, the information including the processing procedures, control procedures, specific names, various data and parameters shown in the above documents and drawings can be changed as desired unless otherwise specified.

[0067] [Program] In one embodiment, the search device 100 can be implemented by installing a search program that executes the above-described search process as package software or online software on a desired computer. For example, by having an information processing device execute the above-described search program, the information processing device can function as the search device 100. The information processing device referred to here includes desktop and notebook personal computers. In addition, the information processing device also includes mobile communication terminals such as smartphones, mobile phones, and PHS (Personal Handyphone Systems), as well as slate terminals such as PDAs (Personal Digital Assistants).

[0068] The search device 100 can also be implemented as a search server device that provides services related to the above search processing to a client terminal device used by a user. For example, the search server device is implemented as a server device that provides a search service that takes a graph as input and outputs a BFS tree. In this case, the search server device may be implemented as a web server, or may be implemented as a cloud that provides services related to the above search processing through outsourcing.

[0069] 10 is a diagram showing an example of a computer that executes a search program. The computer 1000 includes, for example, a memory 1010 and a CPU 1020. The computer 1000 also includes a hard disk drive interface 1030, a disk drive interface 1040, a serial port interface 1050, a video adapter 1060, and a network interface 1070. These components are connected by a bus 1080.

[0070] The memory 1010 includes a read-only memory (ROM) 1011 and a random access memory (RAM) 1012. The ROM 1011 stores a boot program such as a basic input / output system (BIOS). The hard disk drive interface 1030 is connected to a hard disk drive 1090. The disk drive interface 1040 is connected to a disk drive 1100. A removable storage medium such as a magnetic disk or optical disk is inserted into the disk drive 1100. The serial port interface 1050 is connected to a mouse 1110 and a keyboard 1120, for example. The video adapter 1060 is connected to a display 1130, for example.

[0071] The hard disk drive 1090 stores, for example, an OS 1091, an application program 1092, a program module 1093, and program data 1094. That is, the program that defines each process of the search device 100 is implemented as a program module 1093 in which computer-executable code is written. The program module 1093 is stored, for example, in the hard disk drive 1090. For example, a program module 1093 for executing processes similar to those of the functional configuration of the search device 100 is stored in the hard disk drive 1090. Note that the hard disk drive 1090 may be replaced by an SSD (Solid State Drive).

[0072] Furthermore, setting data used in the processing of the above-described embodiment is stored as program data 1094, for example, in the memory 1010 or the hard disk drive 1090. Then, the CPU 1020 reads the program module 1093 or the program data 1094 stored in the memory 1010 or the hard disk drive 1090 into the RAM 1012 as necessary, and executes the processing of the above-described embodiment.

[0073] The program module 1093 and program data 1094 may not necessarily be stored in the hard disk drive 1090, but may also be stored in a removable storage medium and read by the CPU 1020 via the disk drive 1100 or the like. Alternatively, the program module 1093 and program data 1094 may be stored in another computer connected via a network (such as a local area network (LAN) or a wide area network (WAN)). The program module 1093 and program data 1094 may then be read by the CPU 1020 from the other computer via the network interface 1070.

[0074] REFERENCE SIGNS LIST 100 Search device 110 Communication unit 120 Input unit 130 Output unit 140 Storage unit 141 Graph information 150 Control unit 151 Pre-processing unit 152 Query processing unit

Claims

1. A search device comprising: a first processing unit that obtains a BFS tree starting from a vertex included in the 2-core of a graph; and a second processing unit that outputs a BFS tree obtained by joining a BFS tree obtained by performing BFS on the inside of the 2-core of the graph from a specified starting point to a part of the BFS tree obtained by the first processing unit.

2. The search device described in claim 1, characterized in that the second processing unit obtains a BFS tree from the specified starting point for the inside of the 2-core of the graph and for a rooted tree that includes the specified starting point among a plurality of rooted trees connected to the 2-core of the graph, and outputs a BFS tree obtained by joining to the obtained BFS tree a portion of the BFS tree obtained by the first processing unit, which portion corresponds to a rooted tree that does not include the specified starting point among the plurality of rooted trees.

3. A search method executed by a search device, comprising: a first processing step of obtaining a BFS tree starting from a vertex included in the 2-core of a graph; and a second processing step of outputting a BFS tree obtained by joining a BFS tree obtained by performing BFS from a specified starting point to the inside of the 2-core of the graph and a part of the BFS tree obtained by the first processing step.

4. A search program that causes a computer to execute the following steps: a first processing step of obtaining a BFS tree starting from a vertex included in the 2-core of a graph; and a second processing step of outputting a BFS tree obtained by joining a BFS tree obtained by performing BFS from the specified starting point to the inside of the 2-core of the graph and a part of the BFS tree obtained by the first processing step.

Citation Information

Patent Citations

  • Method, device, server and storage medium for searching groups based on social networks

    JP2019513245A