Network analysis method and device
By fusing multiple networks into a directed graph and performing group code analysis, the problem of inability to reflect data dependencies between networks in the existing technology is solved, and the acceleration of data analysis and the correct scheduling of computing tasks are achieved, which is suitable for material demand planning. , production cost accounting and budget control and other fields.
Patent Information
- Application Number
- CN202211188726.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-27
- Publication Date
- 2024-09-27
- Estimated Expiration
- 2042-09-27
AI Technical Summary
Existing technologies cannot effectively reflect the data dependencies between different networks in areas such as material demand planning, production cost accounting, and budget control, resulting in low efficiency of data analysis.
A network analysis method is used to fuse multiple networks into a directed graph, traverse each vertex through the root vertex to obtain the group code, and conduct data analysis on vertices with the same group code in parallel to achieve distributed processing, thus accelerating data analysis and ensuring calculation Scheduling dependencies between tasks.
By superimposing multiple complex networks into directed graphs, the analysis of dependencies and equivalence relationships between different data is realized, avoiding repeated calculations of closed-loop paths, improving data analysis efficiency, and supporting distributed processing and Scaling of resilient systems.
Smart Images

Figure CN116739470B
Abstract
Description
Technical Field
[0001] The present application relates to the field of data analysis, and in particular to a network analysis method and device. Background Art
[0002] Currently, when conducting data analysis in areas such as material requirement planning (MRP), production cost accounting, and budget control, only a single network can be disassembled and data analysis can be performed separately. This fails to reflect the data dependency between different networks and is not conducive to accelerating data analysis. Summary of the invention
[0003] The embodiments of the present application provide a network analysis method and device for accelerating data analysis.
[0004] To achieve the above objectives, the embodiments of the present application adopt the following technical solutions:
[0005] In a first aspect, a network analysis method is provided, comprising: fusing multiple networks to obtain a directed graph, wherein the multiple networks respectively include association relationships between different first data and association relationships between first data and second data; each vertex in the directed graph is used to indicate an association relationship between a first data and a second data, and an edge from a parent vertex to a child vertex in the directed graph is used to indicate an association relationship between different first data; obtaining a grouping code for each vertex according to a path length from a root vertex to each vertex in the directed graph; and performing data analysis in parallel on vertices with the same grouping code.
[0006] The network analysis method and device provided in the embodiment of the present application can superimpose multiple complex networks into a directed graph, each vertex of the directed graph includes two data with a mapping relationship, and the directed edges of the directed graph indicate the association relationship between the same data. The grouping code of each vertex is obtained by traversing each vertex from the root vertex of the directed graph, and the vertices with the same grouping code are analyzed in parallel. That is, the directed graph superimposed with multiple networks is disassembled according to different grouping codes and then analyzed, which can be used to implement distributed processing, thereby accelerating data analysis and ensuring the correctness of scheduling dependencies between different computing tasks.
[0007] In a possible implementation, the method further includes: searching for parent vertices from the target vertex along the longest path in sequence until the target vertex is found again, thereby determining a closed-loop path, wherein the target vertex has no grouping code or the grouping code is greater than a threshold.
[0008] This implementation can prompt the user that there is a closed-loop path so as to check whether the original data is incorrect.
[0009] In a possible implementation, the method further includes: when calculating the path length of a parent vertex, determining whether to calculate the path length of a child vertex of a parent vertex: if a parent vertex satisfies a preset condition, calculating the path length of a child vertex of a parent vertex, and adding a parent vertex to a queue; otherwise, not calculating the path length of a child vertex of a parent vertex; satisfying the preset conditions includes: a parent vertex is not added to the queue, and a parent vertex path length is greater than the path length of its parent vertex.
[0010] This implementation can avoid repeatedly traversing the child vertices of a certain parent vertex (ie, repeatedly calculating the path length of the child vertices of a certain parent vertex).
[0011] In one possible implementation, before obtaining the grouping code of each vertex based on the path length from the root vertex to each vertex in the directed graph, the method also includes: adding a root vertex so that the root vertex points to a vertex with an in-degree of 0 in the directed graph through a directed edge, and a vertex with an in-degree of 0 refers to a vertex that has no other directed edges pointing to it before the root vertex is created.
[0012] This implementation facilitates traversing all vertices through one root vertex.
[0013] In a possible implementation, the path length of the child vertex is equal to the path length of the parent vertex plus 1, and the grouping code is the maximum path length from the root vertex to each vertex.
[0014] Since a vertex may have multiple parent vertices, there may also be multiple paths and corresponding multiple path lengths. For shorter paths, the data analysis of the vertex is only an intermediate result, not the final result. Therefore, selecting the maximum path length can avoid the situation where the intermediate result of the node is output instead of the final result.
[0015] In a possible implementation, if multiple networks respectively include a dependency relationship of first data A depending on first data B, a mapping relationship of first data A to second data a, and a mapping relationship of first data B to second data b; then the directed graph includes a first vertex, a second vertex, and a first directed edge pointing from the first vertex to the second vertex, the first vertex includes first data A and second data a, the second vertex includes first data B and second data b, and the first directed edge is used to indicate: the first data A in the first vertex depends on the first data B in the second vertex.
[0016] This implementation enables the present application to support dependencies between different first data.
[0017] In a possible implementation, if multiple networks also include an equivalence relationship in which the first data B is equivalent to the first data C and a mapping relationship in which the first data C is mapped to the second data c, the directed graph also includes a third vertex and a second directed edge pointing from the first vertex to the third vertex, the third vertex includes the first data C and the second data c, and the second directed edge is used to indicate that the first data A in the first vertex depends on the first data C in the third vertex.
[0018] This embodiment enables the present application to support data analysis on a network including mutually replacing data.
[0019] In a possible implementation, if the multiple networks also include a dependency relationship in which the second data d depends on the second data b, and the second data d is mapped to the first data D, then the directed graph also includes a fourth vertex and a third directed edge pointing from the fourth vertex to the second vertex, the fourth vertex includes the first data D and the second data d, and the third directed edge is used to indicate that the second data d in the fourth vertex depends on the second data b in the second vertex.
[0020] This implementation enables the present application to support not only the dependency relationship between different first data, but also the dependency relationship between different second data.
[0021] In a second aspect, a network analysis device is provided, comprising a processor and a memory, wherein instructions are stored in the memory, and when the processor executes the instructions, the method described in the first aspect and any embodiment thereof is executed.
[0022] According to a third aspect, a computer-readable storage medium is provided, comprising instructions, which, when executed on a network analysis device, cause the network analysis device to execute the method according to the first aspect and any one of its embodiments.
[0023] In a fourth aspect, a computer program product comprising instructions is provided. When the instructions are executed on the above-mentioned network analysis device, the network analysis device executes the method as described in the first aspect and any embodiment thereof.
[0024] In a fifth aspect, a chip system is provided, the chip system including a processor for supporting a network analysis device to implement the functions involved in the first aspect. In a possible design, the device also includes an interface circuit, which can be used to receive signals from other devices (such as a memory) or send signals to other devices (such as a communication interface). The chip system may include a chip and may also include other discrete devices.
[0025] The technical effects of the second to fifth aspects refer to the technical effects of the first aspect and any of its embodiments, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] Figure 1 A schematic diagram of a directed graph provided in an embodiment of the present application;
[0027] Figure 2 A schematic diagram of a forward adjacency list corresponding to a directed graph provided in an embodiment of the present application;
[0028] Figure 3 A schematic diagram of a reverse adjacency list corresponding to a directed graph provided in an embodiment of the present application;
[0029] Figure 4 A schematic diagram of the in-degree and out-degree corresponding to a directed graph provided in an embodiment of the present application;
[0030] Figure 5 A schematic diagram of the structure of a network analysis device provided in an embodiment of the present application;
[0031] Figure 6 A flowchart of a network analysis method provided in an embodiment of the present application;
[0032] Figure 7 A schematic diagram of a first directed graph provided in an embodiment of the present application;
[0033] Figure 8 A schematic diagram of a second directed graph provided in an embodiment of the present application;
[0034] Fig. 9 A schematic diagram of a third directed graph provided in an embodiment of the present application;
[0035] Fig.10 A schematic diagram of a fourth directed graph provided in an embodiment of the present application;
[0036] Fig.11 A schematic diagram of a fifth directed graph provided in an embodiment of the present application;
[0037] Fig.12 A schematic diagram of the path length of the parent vertex of the longest path provided in an embodiment of the present application;
[0038] Fig.13 A schematic diagram of a sixth directed graph and group code provided in an embodiment of the present application;
[0039] Fig.14 A schematic diagram of a closed-loop path provided in an embodiment of the present application;
[0040] Fig.15 A schematic diagram of another closed-loop path provided in an embodiment of the present application;
[0041] Fig.16 A schematic diagram of the structure of a chip system provided in an embodiment of the present application. DETAILED DESCRIPTION
[0042] First, some concepts involved in this application are described.
[0043] The terms "first", "second", etc. involved in the embodiments of the present application are only used to distinguish features of the same type and cannot be understood as indicating relative importance, quantity, order, etc.
[0044] The terms "exemplary" or "for example" and the like in the embodiments of the present application are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of the terms "exemplary" or "for example" is intended to present the related concepts in a specific way.
[0045] First, the concepts involved in this application are described:
[0046] Directed graph: A directed graph consists of multiple vertices (e.g. Figure 1 A / B / C / D / E / F / G / H) and directed edges connecting two vertices (for example, Figure 1 In L1-L8), directed edges refer to edges that have a direction, for example, Figure 1 There is a directed edge L1 from vertex A to vertex B. Vertex A is the parent vertex (or predecessor vertex) of vertex B, and vertex B is the child vertex (or successor vertex) of vertex A.
[0047] Forward adjacency list: The forward adjacency list includes a set of adjacent vertices directly pointed to by the current vertex. The forward adjacency list in this application is used to forward traverse each vertex in a directed graph. Figure 1 The forward adjacency table corresponding to the directed graph shown is shown in Figure 2 For example, vertex B points to vertex C / D / F through directed edges L2 / L3 / L4, so vertex B corresponds to vertex C / D / F in the forward adjacency list.
[0048] Reverse adjacency list: The reverse adjacency list includes a set of adjacent vertices that directly point to the current vertex. The reverse adjacency list in this application is used to reversely search for closed-loop paths. Figure 1 The reverse adjacency table corresponding to the directed graph shown is shown in Figure 3 For example, the adjacent vertices directly pointing to vertex F are vertices B / E / H, so in the reverse adjacency list vertex F corresponds to vertex B / E / H.
[0049] Indegree and outdegree: Indegree refers to how many directed edges point to the current vertex, and outdegree refers to how many directed edges the current vertex points to. Figure 1 The in-degree and out-degree corresponding to the directed graph shown are shown in Figure 4For example, there is 1 directed edge pointing to vertex B, and vertex B points out 3 directed edges, so the in-degree of vertex B is 1 and the out-degree is 3.
[0050] Figure 5 A possible structure of the network analysis device provided by the present application is shown, and the network analysis device 100 may include at least one processor 101, a communication line 102, a memory 103, and at least one communication interface 104. The communication line 102 may include a path to transmit information between the above components. The communication interface 104 uses any transceiver-like device for communicating with other devices.
[0051] The memory 103 involved in the embodiment of the present application may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), and direct RAM (DR RAM). It should be noted that the memory of the systems and methods described herein is intended to include, but is not limited to, these and any other suitable types of memory.
[0052] The processor 101 involved in the embodiment of the present application may be a chip. For example, it may be a field programmable gate array (FPGA), an application specific integrated circuit (ASIC), a system on chip (SoC), a central processor unit (CPU), a network processor (NP), a digital signal processor (DSP), a micro controller unit (MCU), a programmable logic device (PLD), or other integrated chips.
[0053] Instructions may be stored in the memory 103. When the processor 101 executes the above instructions, the network analysis method provided in the embodiment of the present application may be executed.
[0054] As mentioned above, in the prior art, when performing data analysis in the fields of MRP, production cost accounting, budget control, etc., only a single network can be disassembled and data analysis can be performed separately, which cannot reflect the data dependency relationship between different networks and is not conducive to accelerating data analysis.
[0055] The network analysis method provided in the embodiment of the present application can superimpose multiple complex networks into a directed graph, each vertex of the directed graph includes two types of data with a mapping relationship, and the directed edges of the directed graph indicate the association relationship between the same data. The grouping code of each vertex is obtained by traversing each vertex from the root vertex of the directed graph, and the vertices with the same grouping code are analyzed in parallel. That is, after disassembling the directed graph superimposed with multiple networks according to different grouping codes, data analysis can be performed, which can be used to implement distributed processing, thereby accelerating data analysis and ensuring the correctness of scheduling dependencies between different computing tasks. The network analysis method also supports data analysis of networks including equivalent (interchangeable) data. The network analysis method can also identify closed-loop paths (i.e., dead loops) in directed graphs. In addition, by performing data analysis in parallel, a batch data computing system that is vertically expanded (ScaleUp) can be transformed into a flexible system that is horizontally expanded (ScaleOut), and resources can be scaled according to the computing scale.
[0056] The network analysis method provided in the embodiment of the present application can be applied to the following scenarios: when performing data analysis on MRP, the supply chain network (such as customer-factory-Honor-central warehouse-supplier) and the product bill of material (BOM) network (such as mobile phone-bare metal-motherboard-raw materials) are superimposed; when performing data analysis on production cost accounting, the group organization tree and the product BOM network are superimposed; when performing data analysis on budget control, the group organization tree and the subject system tree are superimposed, and so on.
[0057] Specifically, Figure 6 As shown, the network analysis method includes:
[0058] S101, merging multiple networks to obtain a directed graph.
[0059] Among them, each network is used to store the association relationship (such as dependency, mapping, equivalence, etc.) between two data (which can be of the same type or different types). The network can be in the form of a table, tree or other data organization form. The present application does not limit the relationship between the data organization form and the network. As long as it can represent the association relationship between two data, it can be called a network, and each network is not limited to belonging to only one table or one tree. For example, in Table 1 involved later, there is an association relationship between the material parent and the material child, which is one network, and there is another association relationship between the material child and the supply chain, which is another network, although the two networks are maintained in the same table.
[0060] The multiple networks respectively include association relationships between different first data and association relationships between first data and second data. Each vertex in the directed graph is used to indicate an association relationship between a first data and a second data, and the edge from the parent vertex to the child vertex in the directed graph is used to indicate the association relationship between different first data.
[0061] Unless otherwise specified, this application uses the first data as a material and the second data as a supply chain as an example for explanation. At this time, the association relationship between different first data refers to the dependency relationship or equivalence relationship between different materials. For example, in the BOM network, the circuit board includes materials such as capacitors and resistors, and the circuit board and the capacitors and resistors are dependent on each other (the circuit board depends on the capacitors and resistors); for another example, in the BOM network, the circuit board includes equivalent (interchangeable) resistors 1 and 2, and the resistor 1 and the resistor 2 are equivalent. The relationship between the first data and the second data refers to the mapping relationship between the material and the supply chain. For example, the material needs to be supplied by the supply chain, so there is a mapping relationship between the material and the supply chain. In some scenarios, there may also be a dependency relationship between different second data. For example, in the supply chain network, there is a dependency relationship between the downstream supply chain and the upstream supply chain (the downstream supply chain depends on the upstream supply chain).
[0062] For example, Table 1 shows a BOM network, where for materials, since the material parent item is composed of material sub-items, the material parent item depends on the material sub-items, but whether a material belongs to the material parent item or the material sub-item is not fixed, but is determined by the inclusion relationship between the material and other materials. For example, a circuit board includes materials such as capacitors and resistors. The circuit board is the material parent item, and capacitors, resistors, etc. are material sub-items. A mobile phone includes materials such as circuit boards and shells. In this case, the mobile phone is the material parent item, and circuit boards, shells, etc. are material sub-items. The supply chain refers to the supply location of material sub-items.
[0063] Table 2 shows the BOM replacement material network, where the replaceable material sub-items can be used to replace the material sub-items in the material parent item, and the supply chain refers to the supply location of the replaceable material sub-items.
[0064] Table 3 shows the supply chain network, in which material sub-items flow from the upstream of the supply chain to the downstream of the supply chain, so the downstream of the supply chain depends on the upstream of the supply chain.
[0065] Table 1
[0066] Material Parent Material sub-item Supply Chain Material A Material x1 Manufacturer 1 Material A Material x1 Central warehouse Material B Materials x2 Central warehouse Material B Materials x3 Central warehouse Material M Material B Central warehouse
[0067] Table 2
[0068] Material Parent Material sub-item Replaceable material sub-item Supply Chain Material A Material x1 Materials x2 Central warehouse
[0069] Table 3
[0070] Material sub-item Upstream supply chain Downstream supply chain Material x1 Central warehouse Manufacturer 1
[0071] If multiple networks respectively include a dependency relationship of first data A on first data B, a mapping relationship of first data A to second data a, and a mapping relationship of first data B to second data b; then the directed graph includes a first vertex, a second vertex, and a first directed edge pointing from the first vertex to the second vertex, the first vertex includes first data A and second data a, the second vertex includes first data B and second data b, and the first directed edge is used to indicate that the first data A in the first vertex depends on the first data B in the second vertex, for example, a material parent item depends on a material child item. The second data a and the second data b can be the same or different.
[0072] For example, Figure 7As shown, a directed graph is established for Table 1. Taking the row of material M in Table 1 as an example, both material M (first data A) and material B (first data B) are mapped to the central warehouse (that is, the second data a and the second data b are the same, both are central warehouses), so the first vertex (material M [central warehouse]) and the second vertex (material B [central warehouse]) are established, and the first directed edge from the first vertex to the second vertex is established. The first directed edge is used to indicate that the material M in the first vertex depends on the material B in the second vertex. The derivation method of other vertices is similar and will not be repeated here.
[0073] If the multiple networks also include an equivalence relationship that the first data B is equivalent to the first data C, and a mapping relationship that the first data C is mapped to the second data c, since the first data A depends on the first data B, the first data A also depends on the first data C. Therefore, the directed graph also includes a third vertex and a second directed edge pointing from the first vertex (including the first data A) to the third vertex, the third vertex includes the first data C and the second data c, and the second directed edge is used to indicate that the first data A in the first vertex depends on the first data C in the third vertex, for example, the parent item of a material depends on the child item of a replaceable material. The second data b and the second data c can be the same or different.
[0074] For example, Figure 8 As shown, in Figure 7 Based on the directed graph shown, further vertices or directed edges are added for Table 2. At this time, the first vertex is material A [central warehouse], and the second vertex is material X1 [central warehouse]. Since material X1 (first data B) is equivalent to material X2 (first data C), a second directed edge is added. The second directed edge is used to indicate that material A in the first vertex depends on material X2 in the second vertex.
[0075] Based on the same principle, Fig. 9 As shown in the figure, since material X1 and material X2 are interchangeable, and since material B depends on material X2, material B can also depend on material X1. At this time, the first vertex is material B [central warehouse], the second vertex is material X2 [central warehouse], and a second directed edge is added. The second directed edge is used to indicate that material B in the first vertex depends on material X1 in the second vertex.
[0076] If the plurality of networks also include a dependency relationship in which the second data d depends on the second data b, and the second data d is mapped to the first data d, then the directed graph also includes a fourth vertex and a third directed edge pointing from the fourth vertex to the second vertex, the fourth vertex includes the first data D and the second data d, and the third directed edge is used to indicate that the second data d in the fourth vertex depends on the second data b in the second vertex. The first data D and the first data B may be the same or different.
[0077] Alternatively, if the plurality of networks further include a dependency relationship in which the second data d depends on the second data a, and the second data d is mapped to the first data d, then the directed graph further includes a fourth vertex and a third directed edge pointing from the fourth vertex to the first vertex, the fourth vertex includes the first data D and the second data d, and the third directed edge is used to indicate that the second data d in the fourth vertex depends on the second data a in the first vertex. The first data D and the first data A may be the same or different.
[0078] For example, Fig.10 As shown, in Fig. 9 Based on the directed graph shown, further vertices or directed edges are added for Table 3. Since the downstream of the supply chain depends on the upstream of the supply chain, at this time, the first vertex is material A [central warehouse], the second vertex is material X1 [central warehouse], and the fourth vertex is material X1 [manufacturer 1]. The third directed edge is added to indicate that manufacturer 1 in the fourth vertex depends on the material central warehouse in the second vertex.
[0079] In order to facilitate traversal of all vertices in a directed graph, a root vertex can be added (the root vertex does not include the first and second parameters). The root vertex points to the vertices with an in-degree of 0 in the directed graph through multiple directed edges. The vertex with an in-degree of 0 refers to the vertex that has no other directed edges pointing to it before the root vertex is created. Fig.11 As shown, the vertices with in-degree 0 include material M[central warehouse], material A[central warehouse], and material A[manufacturer 1].
[0080] In addition, vertices with direct results (for example, discontinued materials and corresponding supply chains) can be used as child vertices of the root vertex (that is, the root vertex points to the vertex through a directed edge) to reduce the traversal depth of the vertex and improve computing performance.
[0081] S102. Obtain a grouping code for each vertex according to the path length from the root vertex to each vertex in the directed graph.
[0082] Specifically, we can traverse each vertex from the root vertex according to the breadth first search principle based on the forward adjacency list to obtain the path length from the root vertex to each vertex. The path length of the child vertex is equal to the path length of the parent vertex plus 1. The maximum path length from the root vertex to each vertex is taken as the grouping code (also called low level code (LLC)) of each vertex. Since a vertex may have multiple parent vertices, there may also be multiple paths and corresponding multiple path lengths. For a shorter path, the data analysis of the vertex is only an intermediate result, not the final result. Therefore, selecting the maximum path length can avoid the situation where the intermediate result of the node is output instead of the final result.
[0083] In order to avoid repeatedly traversing the child vertices of a parent vertex (i.e., repeatedly calculating the path length of the child vertices of a parent vertex), when calculating the path length of a parent vertex, it is determined whether to calculate the path length of the child vertices of a parent vertex: if a parent vertex meets the preset conditions, the path length of the child vertices of a parent vertex is calculated, and the parent vertex is added to the queue, otherwise the path length of the child vertices of a parent vertex is not calculated, wherein satisfying the preset conditions includes: the parent vertex is not added to the queue, the path length of the parent vertex is greater than the path length of its parent vertex (e.g., the parent vertex of the longest path) (exemplarily, Fig.12 The path length of the parent vertex of the longest path of each vertex is shown). Then, in the same way, it is determined in turn whether the child vertices of the parent vertex meet the preset conditions. If the child vertices of the parent vertex also meet the preset conditions, the child vertex is also added to the queue, and so on.
[0084] It should be noted that since a vertex may have multiple parent vertices, there can be multiple paths. Suppose a vertex is traversed to through the first path for the first time and the vertex is added to the queue. When the vertex is traversed to through the second path for the second time, although the child vertices of the vertex will not be traversed again, the path length of the vertex will still be calculated according to the second path.
[0085] For example, Fig.13 As shown, the grouping code of the root vertex is 0, and the classification codes of material M[central warehouse], material A[central warehouse], and material A[manufacturer 1] are 1, and so on. When material X1[central warehouse] traverses the first path (root vertex->material A[central warehouse]->material X1[central warehouse]), the path length obtained is 2, and when material X1[central warehouse] traverses the second path (root vertex->material A[manufacturer 1]->material X1[manufacturer 1]->material X1[central warehouse]), the path length obtained is 3 (i.e., grouping code = 3). Then the grouping code of material X1[central warehouse] takes the maximum value of the path length as 3.
[0086] S103 , performing data analysis on vertices with the same grouping code in parallel.
[0087] Vertices with the same grouping code have no dependency on each other. When performing data analysis, the analysis results do not affect each other, so data analysis can be performed in parallel. For example, the grouping codes of the vertices of material X1 [central warehouse], material X2 [central warehouse], and material X3 [central warehouse] are the same (all 3), and there is no dependency between them, so data analysis can be performed on these vertices in parallel.
[0088] In addition, if the target vertex has no grouping code or the grouping code is greater than the threshold, the parent vertex is searched forward from the target vertex along the path in accordance with the depth first search principle until the target vertex is found again, so that the closed loop path can be determined, and the user can be prompted that there is a closed loop path to check whether the original data is correct. When searching for the parent vertex from the target vertex along the path, the search can be performed according to the reverse adjacency list, or, further, in order to reduce the computational workload, only the reverse adjacency list of the longest path can be recorded (for example Fig.12 As shown), search for the parent vertex from the target vertex along the longest path.
[0089] For example, Fig.14 As shown in the figure, if vertex C and vertex D (or more vertices can form a closed loop path) are each other's parent and child vertices, and the in-degree of these two vertices is not 0, the root vertex will not point to any of the two vertices. Then, when traversing each vertex from the root vertex, these two vertices will not be traversed. Therefore, these two vertices will not have grouping codes. Therefore, the parent vertex D can be found from vertex C, and then the parent vertex C can be found from vertex D, so that it can be determined that the two vertices form a closed loop path.
[0090] For example, Fig.15 As shown, when traversing from the root vertex to vertex B and vertex C, vertex B and vertex C will be traversed in a loop, so that the grouping codes of vertex B and vertex C increase infinitely, and finally the hierarchical code is greater than the threshold (for example, 20). Therefore, the parent vertex C can be found from vertex B, and then the parent vertex B can be found from vertex C, so that it can be determined that the two vertices form a closed loop path.
[0091] The network analysis method and device provided in the embodiment of the present application can superimpose multiple complex networks into a directed graph, each vertex of the directed graph includes two data with a mapping relationship, and the directed edges of the directed graph indicate the association relationship between the same data. The grouping code of each vertex is obtained by traversing each vertex from the root vertex of the directed graph, and the vertices with the same grouping code are analyzed in parallel. That is, the directed graph superimposed with multiple networks is disassembled according to different grouping codes and then analyzed, which can be used to implement distributed processing, thereby accelerating data analysis and ensuring the correctness of scheduling dependencies between different computing tasks.
[0092] like Fig.16 As shown, the embodiment of the present application also provides a chip system. The chip system 60 includes at least one processor 601 and at least one interface circuit 602. The at least one processor 601 and the at least one interface circuit 602 can be interconnected through a line. The processor 601 is used to support the network analysis device to implement each step in the above method embodiment, such as Figure 6In the method shown, at least one interface circuit 602 may be used to receive signals from other devices (eg, memory) or to send signals to other devices (eg, communication interface). The chip system may include a chip and may also include other discrete devices.
[0093] The present application also provides a computer-readable storage medium, which includes instructions. When the instructions are executed on the network analysis device, the network analysis device executes each step in the method embodiment, such as executing Figure 6 The method shown.
[0094] The present application also provides a computer program product including instructions. When the instructions are executed on the network analysis device, the network analysis device executes each step in the method embodiment, such as executing Figure 6 The method shown.
[0095] Regarding the technical effects of the chip system, computer-readable storage medium, and computer program product, refer to the technical effects of the previous method embodiments.
[0096] It should be understood that in the various embodiments of the present application, the size of the serial numbers of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0097] Those of ordinary skill in the art will appreciate that the modules and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0098] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and modules described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0099] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the modules is only a logical function division. There may be other division methods in actual implementation, such as multiple modules or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or modules, which can be electrical, mechanical or other forms.
[0100] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical modules, that is, they may be located in one device or distributed on multiple devices. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present embodiment.
[0101] In addition, each functional module in each embodiment of the present application may be integrated into one device, or each module may exist physically separately, or two or more modules may be integrated into one device.
[0102] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using a software program, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (digital subscriber line, DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium may be any available medium that a computer can access or may contain one or more servers, data centers and other data storage devices that can be integrated with the medium. The available medium may be a magnetic medium (eg, a floppy disk, a hard disk, a magnetic tape), an optical medium (eg, a DVD), or a semiconductor medium (eg, a solid state disk (SSD)).
[0103] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A network analysis method, characterized in that: include: A directed graph is obtained by fusing multiple networks, wherein the multiple networks respectively include association relationships between different first data and association relationships between the first data and second data; each vertex in the directed graph is used to indicate an association relationship between one first data and one second data, and an edge from a parent vertex to a child vertex in the directed graph is used to indicate an association relationship between different first data; the multiple networks include a supply chain network and a product bill of materials network involved in data analysis of material demand planning, or a group organization tree and a product bill of materials network involved in data analysis of production cost accounting, or a group organization tree and a subject system tree involved in data analysis of budget control; According to the path length from the root vertex to each vertex in the directed graph, the grouping code of each vertex is obtained; wherein, when calculating the path length of a parent vertex, it is determined whether to calculate the path length of the child vertex of the parent vertex: if the parent vertex satisfies a preset condition, the path length of the child vertex of the parent vertex is calculated, and the parent vertex is added to a queue; otherwise, the path length of the child vertex of the parent vertex is not calculated, and the preset condition is satisfied including: the parent vertex is not added to the queue, and the path length of the parent vertex is greater than the path length of its parent vertex; Data analysis is performed in parallel on vertices with the same grouping code.
2. The method according to claim 1, characterized in that The method further comprises: The parent vertices are searched forward in sequence from the target vertex along the longest path until the target vertex is found again, thereby determining a closed-loop path, wherein the target vertex has no grouping code or the grouping code is greater than a threshold.
3. The method according to claim 1 or 2, characterized in that: Before obtaining the grouping code of each vertex according to the path length from the root vertex to each vertex in the directed graph, the method further includes: The root vertex is added so that the root vertex points to a vertex with an in-degree of 0 in the directed graph through a directed edge, and the vertex with an in-degree of 0 refers to a vertex to which no other directed edges point before the root vertex is created.
4. The method according to claim 1 or 2, characterized in that: The path length of the child vertex is equal to the path length of the parent vertex plus 1, and the group code is the maximum path length from the root vertex to each vertex.
5. The method according to claim 1 or 2, characterized in that: If the multiple networks respectively include a dependency relationship of the first data A depending on the first data B, a mapping relationship of the first data A to the second data a, and a mapping relationship of the first data B to the second data b; then the directed graph includes a first vertex, a second vertex, and a first directed edge pointing from the first vertex to the second vertex, the first vertex includes the first data A and the second data a, the second vertex includes the first data B and the second data b, and the first directed edge is used to indicate: the first data A in the first vertex depends on the first data B in the second vertex.
6. The method according to claim 5, characterized in that If the multiple networks also include an equivalence relationship that the first data B is equivalent to the first data C and a mapping relationship that the first data C is mapped to the second data c, then the directed graph also includes a third vertex and a second directed edge pointing from the first vertex to the third vertex, the third vertex includes the first data C and the second data c, and the second directed edge is used to indicate: the first data A in the first vertex depends on the first data C in the third vertex.
7. The method according to claim 5, characterized in that If the multiple networks also include a dependency relationship in which the second data d depends on the second data b, and the second data d is mapped to the first data D, then the directed graph also includes a fourth vertex and a third directed edge pointing from the fourth vertex to the second vertex, the fourth vertex includes the first data D and the second data d, and the third directed edge is used to indicate that the second data d in the fourth vertex depends on the second data b in the second vertex.
8. A network analysis device, characterized in that: The method comprises a processor and a memory, wherein the memory stores instructions, and when the processor executes the instructions, the method according to any one of claims 1 to 7 is executed.
9. A computer-readable storage medium, characterized in that: The method comprises instructions, which, when executed on a network analysis device, cause the network analysis device to execute the method according to any one of claims 1 to 7.
