A kind of atlas data processing method, device, electronic equipment and storage medium
By identifying and aggregating source and leaf nodes in graph data processing, the problem of excessive nodes in large-scale group relationship data is solved, improving operational efficiency and rendering accuracy.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SHANGHAI SHIZHUANG INFORMATION TECHNOLOGY CO LTD
- Filing Date
- 2023-08-23
- Publication Date
- 2026-07-31
AI Technical Summary
Traditional data analysis methods struggle to handle large-scale group relationship data, resulting in an excessive number of nodes, which increases the operational difficulty for business personnel, the system rendering performance burden, and the user experience.
By acquiring the graph data stream, traversing to determine the source and leaf nodes, and aggregating nodes and edges based on the mapping relationship, the number of rendered nodes is reduced, simplifying the operation.
It simplifies the operation for business personnel, improves operational efficiency and rendering accuracy, and saves performance resources.
Smart Images

Figure CN117112562B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing technology, and more specifically, to a method, apparatus, electronic device, and storage medium for processing spectral data. Background Technology
[0002] With the advent of the big data era, the amount of data in enterprises and organizations is growing exponentially, making traditional data analysis methods insufficient. Knowledge graphs can help data analysts analyze entities in the data and the relationships between them. Business personnel use graph systems to analyze group-based relationship data. As the depth of group relationships and the scale of the groups continue to expand, the number of nodes the system needs to display grows exponentially to tens or hundreds of thousands. The excessive density and concentration of nodes increases the difficulty of graph operations for business personnel. Summary of the Invention
[0003] The purpose of this application is to provide a graph data processing method, apparatus, electronic device, and storage medium. The method involves traversing the graph data to determine the source nodes and leaf nodes, and aggregating the nodes and edges in the graph based on the mapping relationship between the source nodes and leaf nodes. The aggregated graph data is simpler than the original graph data, reduces the number of nodes that need to be rendered, simplifies the operation for business personnel, and thus improves operational efficiency.
[0004] In a first aspect, embodiments of this application provide a graph data processing method, comprising: acquiring a graph data stream; the graph data stream including node data and edge data; traversing and searching the node data and edge data to determine source nodes and leaf nodes from the node data; obtaining a graph mapping relationship between the source nodes and leaf nodes based on the source nodes and leaf nodes; and aggregating the node data and edge data in the graph data stream based on the graph mapping relationship between the source nodes and leaf nodes to obtain aggregated graph data.
[0005] In the above implementation process, the graph data is traversed to determine the source and leaf nodes. Based on the mapping relationship between the source and leaf nodes, the nodes and edges in the graph are aggregated. The aggregated graph data is more concise than the original graph data, reducing the number of nodes that need to be rendered, saving performance resources, and improving the accuracy of the rendered image. This also improves the problem of image stacking that leads to unresponsive user operations, simplifies the operation for business personnel, and improves operational sensitivity and efficiency.
[0006] Optionally, in this embodiment, traversing and searching the node data and edge data to determine the source node and leaf node from the node data includes: traversing and searching the node data and edge data using a recursive function to determine whether the node data has child nodes and obtaining a determination result; if the determination result indicates that the node data has child nodes, then the node type of the node data is determined as the source node; if the determination result indicates that the node data does not have child nodes, then the node type of the node data is determined as the leaf node.
[0007] In the above implementation process, a recursive function is used to traverse and search the node data and edge data to determine whether the node data has child nodes, and based on the judgment result, it is determined whether the node data is a source node or a leaf node.
[0008] Optionally, in this embodiment, a recursive function is used to traverse and search the node data and edge data to determine whether the node data has child nodes and obtain the determination result. This includes: obtaining a starting node determined in advance from the node data; starting from the starting node, using a recursive function to traverse and search the node data and edge data to determine the adjacent nodes adjacent to the starting node; traversing and querying the adjacent nodes to determine whether the adjacent node is connected to only one edge data; if so, the determination result of the adjacent node is that it has child nodes; if not, the determination result of the adjacent node is that it does not have child nodes.
[0009] In the above implementation process, the node data and edge data are traversed and searched to determine the adjacent nodes adjacent to the starting node. By judging whether the adjacent node is connected to only one edge data, the system can quickly determine whether the node data has child nodes, thus improving the efficiency of the judgment.
[0010] Optionally, in this embodiment of the application, after determining the node type of the node data as the source node, the method further includes: traversing and querying all child nodes of the source node until the node type of all node data in the graph data stream is determined, and the traversal query is completed.
[0011] In the above implementation process, the node type of all node data in the graph data stream is determined by traversal querying, providing data support for subsequent graph aggregation.
[0012] Optionally, in this embodiment of the application, the graph mapping relationship between the source node and the leaf node includes: the mapping relationship between each source node and its corresponding leaf node, the mapping relationship between the source node and the edge data, and the mapping relationship between the leaf node and the edge data.
[0013] In the above implementation process, by mining more detailed graph mapping relationships, more accurate data support is provided for graph aggregation and expansion operations, thus improving the accuracy of graph processing.
[0014] Optionally, in this embodiment, based on the graph mapping relationship between the source node and the leaf node, the node data and edge data in the graph data stream are aggregated, including: obtaining the graph aggregation configuration set by the user; the graph aggregation configuration includes a graph processing type; based on the graph processing type, obtaining the aggregation logic corresponding to the pre-set graph processing type and the graph aggregation interface for executing the aggregation logic; calling the graph aggregation interface, based on the graph mapping relationship between the source node and the leaf node, and the aggregation logic, to aggregate the node data and edge data in the graph data stream, and obtain the aggregated graph data.
[0015] In the above implementation process, based on the graph processing type, the corresponding aggregation logic and the graph aggregation interface for executing the aggregation logic are obtained. The graph aggregation interface is called to aggregate the node data and edge data to obtain the aggregated graph data. This reduces the number of nodes in the graph data, improves the problem of stacking in the effect graph, which leads to unresponsive user operation, simplifies the operation difficulty for business personnel, and improves the operation sensitivity and efficiency.
[0016] Optionally, in this embodiment, the graph aggregation interface is invoked to aggregate the node data and edge data in the graph data stream based on the graph mapping relationship between the source node and the leaf node, and the aggregation logic, to obtain aggregated graph data. This includes: if the graph processing type is node aggregation, obtaining a preset target aggregation node; the target aggregation node is the source node that needs to be aggregated; according to the graph mapping relationship between the source node and the leaf node, obtaining the target aggregation leaf node corresponding to the target aggregation node, and obtaining the target aggregation edge data between the target aggregation node and each corresponding target aggregation leaf node; and invoking the graph aggregation interface corresponding to the target node aggregation to aggregate the target aggregation leaf node and the target aggregation edge data to obtain aggregated graph data.
[0017] In the above implementation process, the target aggregation leaf node and target aggregation edge data corresponding to the target aggregation node are obtained. The target aggregation leaf node and target aggregation edge data are then aggregated to obtain aggregated graph data. This enables precise aggregation processing for each target aggregation node, resulting in more concise graph data and improving user operation sensitivity and efficiency.
[0018] Optionally, in this embodiment of the application, after obtaining the aggregated graph data, the method further includes: if the graph processing type is node expansion, then obtaining the target expansion node determined from the target aggregation node; calling the graph expansion interface to expand the target aggregation leaf node and target aggregation edge data corresponding to the target expansion node in the aggregated graph data, and obtaining the expanded graph data.
[0019] In the above implementation process, the graph expansion interface is called to expand the target aggregation leaf nodes and target aggregation edge data corresponding to the target expansion node in the aggregated graph data, thereby improving the user's controllability over the graph data and improving the user's operation efficiency.
[0020] Secondly, embodiments of this application also provide a graph data processing apparatus, comprising: an acquisition module for acquiring a graph data stream; the graph data stream including node data and edge data; a traversal module for traversing and searching the node data and edge data to determine source nodes and leaf nodes from the node data; a mapping relationship module for obtaining a graph mapping relationship between the source node and the leaf node based on the source node and the leaf node; and an aggregation processing module for aggregating the node data and edge data in the graph data stream based on the graph mapping relationship between the source node and the leaf node to obtain aggregated graph data.
[0021] Thirdly, embodiments of this application also provide an electronic device, including: a processor and a memory, the memory storing machine-readable instructions executable by the processor, which, when executed by the processor, perform the method described above.
[0022] Fourthly, embodiments of this application also provide a computer-readable storage medium storing a computer program that, when executed by a processor, performs the methods described above.
[0023] The graph data processing method, apparatus, electronic device, and storage medium provided in this application traverse the graph data to determine the source nodes and leaf nodes. Based on the mapping relationship between the source nodes and leaf nodes, the nodes and edges in the graph are aggregated. The aggregated graph data is more concise than the original graph data, reducing the number of nodes that need to be rendered, saving performance resources, and improving the accuracy of the rendered image. It also improves the problem of image stacking that leads to unresponsive user operations, simplifies the operation for business personnel, and improves operational sensitivity and efficiency. Attached Figure Description
[0024] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments of this application will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0025] Figure 1 A flowchart illustrating a spectral data processing method provided in an embodiment of this application;
[0026] Figure 2 The diagram shown is a schematic representation of the spectral data stream provided in an embodiment of this application.
[0027] Figure 3 The diagram shown illustrates the aggregation of all nodes provided in this embodiment of the application.
[0028] Figure 4 The diagram shown illustrates the specified aggregation points of the expanded portion provided in the embodiments of this application;
[0029] Figure 5 The diagram shown is a schematic representation of a specified aggregation point provided in an embodiment of this application.
[0030] Figure 6 The diagram shown is a schematic of the spectrum processing algorithm module in an embodiment of this application.
[0031] Figure 7 This is a schematic diagram of the structure of the spectral data processing device provided in the embodiments of this application;
[0032] Figure 8 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0033] The embodiments of the technical solution of this application will now be described in detail with reference to the accompanying drawings. These embodiments are only used to more clearly illustrate the technical solution of this application and are therefore merely examples, and should not be used to limit the scope of protection of this application.
[0034] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs; the terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit this application.
[0035] In the description of the embodiments of this application, technical terms such as "first" and "second" are used only to distinguish different objects and should not be construed as indicating or implying relative importance or implicitly specifying the number, specific order, or primary and secondary relationship of the indicated technical features. In the description of the embodiments of this application, "multiple" means two or more, unless otherwise explicitly defined.
[0036] As the relationships within a group deepen and the number of groups expands, the number of nodes the system needs to display will increase exponentially, reaching tens or even hundreds of thousands. The graph data is rendered using the browser's rendering function. Faced with a large number of nodes, the browser's rendering performance is significantly reduced, potentially leading to excessively long rendering times, a poor user experience, and potentially subpar node animation effects. Furthermore, after rendering a large number of nodes, the graph may exhibit stacking, causing sluggishness, misoperations, or lag when users interact with the graph. Additionally, the dense data display makes it difficult for business users to distinguish between nodes, increasing the difficulty of graph operations for them.
[0037] This application provides a graph data processing method, apparatus, electronic device, and storage medium. The method involves traversing the graph data to determine source and leaf nodes, and aggregating nodes and edges in the graph based on the mapping relationship between source and leaf nodes. The aggregated graph data is simpler than the original graph data, reducing the number of nodes to be rendered, saving performance resources, and improving the accuracy of the rendered image. It also addresses the issue of image stacking that leads to unresponsive user operations, simplifies the operation for business personnel, and improves operational sensitivity and efficiency.
[0038] Please see Figure 1 The illustration shows a flowchart of a spectral data processing method provided in an embodiment of this application. The spectral data processing method provided in this application can be applied to an electronic device, which may be equipped with a spectral analysis system. The spectral analysis system can be used to execute the above-described spectral data processing method. The electronic device may include a terminal and a server; the terminal may specifically be a smartphone, tablet computer, computer, personal digital assistant (PDA), etc.; the server may specifically be an application server or a web server. The spectral data processing method may include:
[0039] Step S110: Obtain the graph data stream; the graph data stream includes node data and edge data.
[0040] Step S120: Traverse and search the node data and edge data to determine the source node and leaf node from the node data.
[0041] Step S130: Obtain the graph mapping relationship between the source node and the leaf node based on the source node and the leaf node.
[0042] Step S140: Based on the graph mapping relationship between the source node and the leaf node, aggregate the node data and edge data in the graph data stream to obtain aggregated graph data.
[0043] In step S110, a knowledge graph is a large-scale semantic network, an abstract description of the real world, representing things as "points" and the relationships between things as "edges," thus forming a network. A knowledge graph analysis system is a data analysis system based on knowledge graphs, capable of analyzing and mining large-scale knowledge graphs to discover patterns and value.
[0044] A knowledge graph data stream refers to an ordered sequence of bytes with a start and end point generated during the data flow process within the knowledge graph. This data flow process can include data input, processing, and output. In this embodiment, the graph data stream can be the input data for the knowledge graph system, and it can be acquired through a graph analysis system using a pre-defined data interface.
[0045] The graph data stream includes node data and edge data of the knowledge graph. Node data represents one or more "entities" existing in the real world, and each edge represents a "relationship" between entities. The graph data stream can be in JSON format or other formats, which can be determined by the data input format standard of the graph analysis system.
[0046] In step S120, the source node refers to a node in the node data that has child nodes; the leaf node refers to a node that has no child nodes, and the leaf node can also be called the end node.
[0047] The node and edge data in the obtained graph data stream are traversed and searched. For example, any node in the graph data stream can be used as the starting point for traversal and searching. It is determined whether the current node has child nodes. If the current node has child nodes, it is marked as the source node, and the process continues to determine whether the child nodes of the current node are source nodes and mark them accordingly. If the current node has no child nodes, it is marked as a leaf node. All node data in the graph data is traversed recursively to determine the node type of each node, which includes source nodes and leaf nodes.
[0048] In step S130, after determining the node type of each node in the node data, the graph mapping relationship between the source node and the leaf node can be obtained based on the node type of the node data. The graph mapping relationship can include the graph mapping relationship between the source node, leaf node, and edge data, and can also include the mapping relationship between any two of these three.
[0049] Specific examples of graph mapping relationships include: the mapping relationship between source nodes and leaf nodes (i.e., which leaf nodes each source node corresponds to); the mapping relationship between source nodes and edge data (i.e., which edge data each source node is connected to); and the mapping relationship between leaf nodes and edge data (i.e., which edge data each leaf node is connected to). The graph mapping relationship between these three elements includes the relationship between the source node, the corresponding leaf node, and the edge data between the source node and its corresponding leaf node. The edge data between the source node and its corresponding leaf node can be either unidirectional or bidirectional.
[0050] As one embodiment, the step of obtaining the graph mapping relationship between the source node and the leaf node can be implemented through traversal query. To save computational resources and improve system performance, the traversal search performed in step S130 to obtain the graph mapping relationship and the traversal search performed in step S120 to determine the node type can be analyzed. The traversal logic in both steps can be identified, their commonalities can be determined, and the traversal logic of two or more steps can be simplified and merged. This allows determining the node type and obtaining the graph mapping relationship between the source node and the leaf node through a single traversal search. In other words, the graph mapping relationship between the source node and the leaf node can be obtained based on the traversal result in step S120 without re-performing the traversal.
[0051] In step S140, based on the determined source nodes, leaf nodes, and graph mapping relationships in the graph data, and the preset aggregation logic, the node data and edge data in the graph data stream are aggregated to obtain aggregated graph data. The aggregation logic is used to determine the target aggregation node. For example, the aggregation logic can aggregate all leaf nodes corresponding to a source node that meets the requirements, as well as the edge data between that source node and its leaf nodes. First, the target aggregation node that meets the requirements is determined from the node data; then, based on the graph mapping relationship between the source node and leaf nodes, the leaf nodes corresponding to the source node that meets the requirements, and the edge data between them, are determined; finally, the leaf nodes corresponding to the source node that meets the requirements, and the edge data between them, are aggregated to obtain the aggregated graph data.
[0052] Understandably, the target aggregation node is not aggregated during the aggregation process. This means the target aggregation node will still be displayed in the aggregated graph data. Instead, all leaf nodes corresponding to the target aggregation node can be aggregated into an expandable aggregation point, which is a collection of aggregated leaf nodes and edge data. This aggregation node can also be hidden.
[0053] In the above implementation process, the graph data is traversed to determine the source and leaf nodes. Based on the mapping relationship between the source and leaf nodes, the nodes and edges in the graph are aggregated. The aggregated graph data is more concise than the original graph data, reducing the number of nodes that need to be rendered, saving performance resources, and improving the accuracy of the rendered image. This also improves the problem of image stacking that leads to unresponsive user operations, simplifies the operation for business personnel, and improves operational sensitivity and efficiency.
[0054] In an optional embodiment, before traversing and searching the node and edge data, the method further includes preprocessing the node and edge data in the graph data stream. The preprocessing includes pre-checks and configuration operations. The pre-checks are necessary checks performed before the traversal search to implement the algorithm. For example, the pre-checks may involve checking the node and edge data to determine if they are empty, removing empty node and edge data to avoid the need for subsequent query and aggregation steps.
[0055] The configuration operation is a process where users customize query configurations according to their actual needs. For example, users can configure aggregation requirements for the attributes of aggregated nodes and edges. For instance, for some special business nodes, even if the business node is a target aggregation leaf node, it doesn't need to be aggregated. To achieve this, the attribute conditions for node and edge aggregation can be pre-configured. During subsequent traversal queries, these pre-configured attribute conditions will be added to the aggregation logic to ensure that the aggregated graph data meets the user's requirements.
[0056] In the above implementation process, user customization of the graph aggregation operation is achieved through pre-check and configuration operations, which improves the usability of the graph data aggregation operation and makes the aggregated graph data more accurate.
[0057] Please see Figure 2 The diagram shown is a schematic representation of the spectral data stream provided in an embodiment of this application.
[0058] Optionally, in this embodiment, traversing and searching the node data and edge data to determine the source node and leaf node from the node data includes: traversing and searching the node data and edge data using a recursive function to determine whether the node data has child nodes and obtaining a determination result; if the determination result indicates that the node data has child nodes, then the node type of the node data is determined as the source node; if the determination result indicates that the node data does not have child nodes, then the node type of the node data is determined as the leaf node.
[0059] In the specific implementation process: the starting node is determined from the node data, and recursively processed from the starting node, traversing and searching the node data and edge data until all node data has been traversed. This traversal process can be implemented through a pre-defined source lookup interface.
[0060] like Figure 2 As shown, starting from node N9, the recursion is performed. The nodes connected to N9 include N10, N11, and N12. In other words, N10, N11, and N12 are child nodes of node N9. Therefore, the result is that N9 has child nodes, which means that the node type of N9 is determined to be the source node.
[0061] Continue the recursive processing to determine whether N9's child nodes N10, N11, and N12 have child nodes. N10, N11, and N1 are only connected to their parent node N9 and not to other nodes. Therefore, N10, N11, and N12 do not have child nodes, and their node type is determined to be leaf nodes.
[0062] In the above implementation process, a recursive function is used to traverse and search the node data and edge data to determine whether the node data has child nodes, and based on the judgment result, it is determined whether the node data is a source node or a leaf node.
[0063] Optionally, in this embodiment, a recursive function is used to traverse and search the node data and edge data to determine whether the node data has child nodes and obtain the determination result. This includes: obtaining a starting node determined in advance from the node data; starting from the starting node, using a recursive function to traverse and search the node data and edge data to determine the adjacent nodes adjacent to the starting node; traversing and querying the adjacent nodes to determine whether the adjacent node is connected to only one edge data; if so, the determination result of the adjacent node is that it has child nodes; if not, the determination result of the adjacent node is that it does not have child nodes.
[0064] In the specific implementation process: the starting node can be any node determined in advance from the node data. Starting from the starting node, a recursive function is used to traverse and search the node data and edge data to determine the adjacent nodes adjacent to the starting node. The number of edge data of the adjacent nodes is used to determine whether the adjacent nodes have child nodes.
[0065] Please continue reading Figure 2 Taking N1 as the starting point, the adjacent nodes of N1 are obtained through recursive query: N2, N3, N4, N5, N6, N7, N8 and N9.
[0066] We sequentially determine whether each adjacent node has only one edge data. For example, adjacent nodes N2, N3, N4 and N5 are all connected to only one edge data. Therefore, the result of determining adjacent nodes N2, N3, N4 and N5 is that they do not have child nodes, that is, nodes N2, N3, N4 and N5 are determined to be leaf nodes.
[0067] For adjacent nodes N6, N7, N8, and N9, there is more than one edge data connected to them. The judgment result of adjacent nodes N6, N7, N8, and N9 is that they have child nodes, that is, nodes N6, N7, N8, and N9 are determined to be source nodes.
[0068] In this case, if two nodes are bidirectionally connected, both nodes are considered source nodes. For example, N1 and N6 are bidirectionally connected, meaning there are two connecting lines between them. Although N6 is not connected to any other node besides N1, it is still considered a source node. This can be understood as N1 and N6 being each other's child nodes; that is, both N1 and N6 have child nodes, therefore, both N1 and N6 are source nodes.
[0069] In an optional embodiment, after obtaining the starting node determined in advance from the node data, it is determined whether the starting node has only one edge data. If so, the determination result of the starting node is determined to be that it does not have child nodes, and a new starting node is determined from the node data.
[0070] In the above implementation process, the node data and edge data are traversed and searched to determine the adjacent nodes adjacent to the starting node. By judging whether the adjacent node is connected to only one edge data, the system can quickly determine whether the node data has child nodes, thus improving the efficiency of the judgment.
[0071] Optionally, in this embodiment of the application, after determining the node type of the node data as the source node, the method further includes: traversing and querying all child nodes of the source node until the node type of all node data in the graph data stream is determined, and the traversal query is completed.
[0072] In the specific implementation process: after determining the node type of the node data as the source node, it is necessary to continue to traverse and query the adjacent nodes corresponding to the source node until all nodes have been traversed.
[0073] Please continue to participate. Figure 2 Following the above embodiment, N1 is determined as the source node, and the adjacent nodes connected to N1 include N2, N3, N4, N5, N6, N7, N8, and N9. A traversal query is performed on all adjacent nodes of N1 to determine that N2, N3, N4, and N5 are leaf nodes; and N6, N7, N8, and N9 are source nodes.
[0074] Continue traversing and querying the source nodes N6, N7, N8, and N9 in the adjacent nodes to determine the node type of the adjacent nodes of N6, N7, N8, and N9. Continue traversing and querying the adjacent nodes whose node type is the source node until the node type of all node data in the graph data stream is determined, and the traversal query is completed.
[0075] In the above implementation process, the node type of all node data in the graph data stream is determined by traversal querying, providing data support for subsequent graph aggregation.
[0076] Optionally, in this embodiment of the application, the graph mapping relationship between the source node and the leaf node includes: the mapping relationship between each source node and its corresponding leaf node, the mapping relationship between the source node and the edge data, and the mapping relationship between the leaf node and the edge data.
[0077] In the specific implementation process: after determining the node type of the node data, the graph mapping relationship between source nodes and leaf nodes is determined. Specifically, the mapping relationship between each source node and its corresponding leaf node can be the leaf nodes connected to the source node. The mapping relationship between source nodes and edge data can be the edge data connected to each source node. The mapping relationship between leaf nodes and edge data can be the edge data connected to each leaf node.
[0078] As one implementation method, to uncover more graph mapping relationships, source nodes, leaf nodes, and edge data can be used as query subjects, and traversal queries can be performed along these three dimensions to obtain the graph mapping relationships. For example, using edge data as the query subject, traversal queries along the edge data dimension can be performed to obtain graph mapping relationships that can be the nodes connected to each edge data.
[0079] In the above implementation process, by mining more detailed graph mapping relationships, more accurate data support is provided for graph aggregation and expansion operations, thus improving the accuracy of graph processing.
[0080] Optionally, in this embodiment, based on the graph mapping relationship between the source node and the leaf node, the node data and edge data in the graph data stream are aggregated, including: obtaining the graph aggregation configuration set by the user; the graph aggregation configuration includes a graph processing type; based on the graph processing type, obtaining the aggregation logic corresponding to the pre-set graph processing type and the graph aggregation interface for executing the aggregation logic; calling the graph aggregation interface, based on the graph mapping relationship between the source node and the leaf node, and the aggregation logic, to aggregate the node data and edge data in the graph data stream, and obtain the aggregated graph data.
[0081] In the specific implementation process: the graph aggregation configuration refers to the attributes or parameters of the graph processing configured by the user. The graph aggregation configuration includes the graph processing type, such as aggregating all source nodes or aggregating a subset of source nodes. If the graph processing type is aggregating a subset of source nodes, the graph aggregation configuration may also include the attribute requirements for determining the target aggregation node.
[0082] Each graph processing type has corresponding aggregation logic and a graph aggregation interface for executing that logic. These graph aggregation interfaces are predefined; calling the graph aggregation interface will implement its functionality.
[0083] The graph aggregation interface is invoked to aggregate node and edge data in the graph data stream based on the graph mapping relationship between source nodes and leaf nodes, and the aggregation logic. For example, based on the mapping relationship between source nodes and leaf nodes, all or some of the leaf nodes corresponding to the source nodes and their corresponding edge data can be aggregated. Without special configuration, the aggregated graph data only contains the source nodes and the edge data between each source node; leaf nodes and the edge data between source nodes and leaf nodes will not be displayed.
[0084] The following describes the steps of aggregating the leaf nodes and edge data corresponding to the source node through an optional embodiment. For example, an aggregation point can be generated based on the leaf nodes of the source node, and the leaf nodes and their corresponding edge data are removed during the aggregation process. This removal can be achieved by adding an aggregation identifier to the leaf nodes and their corresponding edge data for logical deletion, but the leaf nodes and their corresponding edge data are still stored in the graph analysis system.
[0085] In other words, each target aggregation source node corresponds to a target aggregation point. This target aggregation point stores the leaf nodes and edge data corresponding to the target aggregation source node that are being aggregated. The aggregated leaf nodes and edge data can be expanded through this target aggregation point. Different target aggregation source nodes can be represented by different colors, and the number of nodes aggregated can be displayed through the aggregation point.
[0086] In the above implementation process, based on the graph processing type, the corresponding aggregation logic and the graph aggregation interface for executing the aggregation logic are obtained. The graph aggregation interface is called to aggregate the node data and edge data to obtain the aggregated graph data. This reduces the number of nodes in the graph data, improves the problem of stacking in the effect graph, which leads to unresponsive user operation, simplifies the operation difficulty for business personnel, and improves the operation sensitivity and efficiency.
[0087] Please see Figure 3 The diagram shown illustrates the aggregation of all nodes provided in this embodiment of the application.
[0088] Optionally, in this embodiment, the graph aggregation interface is invoked to aggregate the node data and edge data in the graph data stream based on the graph mapping relationship between the source node and the leaf node, and the aggregation logic, to obtain aggregated graph data. This includes: if the graph processing type is node aggregation, obtaining a preset target aggregation node; the target aggregation node is the source node that needs to be aggregated; according to the graph mapping relationship between the source node and the leaf node, obtaining the target aggregation leaf node corresponding to the target aggregation node, and obtaining the target aggregation edge data between the target aggregation node and each corresponding target aggregation leaf node; and invoking the graph aggregation interface corresponding to the target node aggregation to aggregate the target aggregation leaf node and the target aggregation edge data to obtain aggregated graph data.
[0089] In the specific implementation process: the graph processing type includes node aggregation, obtaining the preset target aggregation node. The preset target aggregation node can be all the source nodes, some of the pre-selected source nodes, or the source nodes that meet the preset conditions after querying the source nodes.
[0090] It should be noted that the target aggregation node is the source node that needs to be aggregated; however, aggregation refers to aggregating the leaf nodes corresponding to the source node and the edge data between them, not aggregating the source node itself. The aggregated leaf nodes and edge data do not need to be rendered and will not be displayed to the user.
[0091] Based on the graph mapping relationship between the source node and the leaf node, the target aggregation leaf node corresponding to the target aggregation node is obtained, as well as the target aggregation edge data between the target aggregation node and each corresponding target aggregation leaf node.
[0092] Please continue reading Figure 2 and Figure 3 The target aggregation nodes are obtained as N1, N7, and N9. Through graph mapping, the target aggregation leaf nodes corresponding to N1 are obtained as N2, N3, N4, and N5; and the target aggregation edge data between N1 and the above target aggregation leaf nodes are E2, E3, E4, and E5, respectively. It should be noted that N6, N7, N8, and N9, the adjacent nodes of N1, are source nodes; that is, N6, N7, N8, and N9 are not the target aggregation leaf nodes corresponding to N1 and will not undergo aggregation processing.
[0093] The target aggregation leaf nodes corresponding to N7 are N13, N14, and N15; and the target aggregation edge data between N7 and the above target aggregation leaf nodes are E13, E14, and E15, respectively.
[0094] The target aggregation leaf nodes corresponding to N9 are N10, N11, and N12; and the target aggregation edge data between N7 and the above target aggregation leaf nodes are E10, E11, and E12, respectively.
[0095] After determining the target aggregation leaf nodes and target aggregation edge data, the corresponding graph aggregation interface for the target node aggregation is called to aggregate the target aggregation leaf nodes and target aggregation edge data. Taking target aggregation node N1 as an example, aggregation markers are added to the target aggregation leaf nodes N2, N3, N4, and N5 corresponding to N1; and the target aggregation edge data E2, E3, E4, and E5 between N1 and the corresponding target aggregation leaf nodes. Adding aggregation markers allows for logical deletion or hiding of aggregation data. Node data and edge data with aggregation markers will not be displayed in the aggregated graph data. The same aggregation is performed on the target aggregation leaf nodes and target aggregation edge data of the other two target aggregation nodes N7 and N9, resulting in aggregated graph data as follows: Figure 3 As shown.
[0096] In the above implementation process, the target aggregation leaf node and target aggregation edge data corresponding to the target aggregation node are obtained. The target aggregation leaf node and target aggregation edge data are then aggregated to obtain aggregated graph data. This enables precise aggregation processing for each target aggregation node, resulting in more concise graph data and improving user operation sensitivity and efficiency.
[0097] Please see Figure 4 The diagram shown illustrates the specified aggregation points in the expanded portion provided in the embodiments of this application.
[0098] Optionally, in this embodiment of the application, after obtaining the aggregated graph data, the method further includes: if the graph processing type is node expansion, then obtaining the target expansion node determined from the target aggregation node; calling the graph expansion interface to expand the target aggregation leaf node and target aggregation edge data corresponding to the target expansion node in the aggregated graph data, and obtaining the expanded graph data.
[0099] In the specific implementation process: node expansion involves expanding the leaf nodes and edge data corresponding to the already aggregated source nodes. If node expansion is performed on the aggregated graph data, the operation is invalid, and the graph system can prompt the user that the operation is invalid.
[0100] If the graph processing type is node expansion, then the target expansion nodes determined from the target aggregation nodes are obtained. The target expansion nodes can be all the target aggregation nodes in the aggregated graph data, a pre-specified portion of the target aggregation nodes, or target aggregation nodes that meet the requirements after filtering.
[0101] The graph unfolding interface is invoked to unfold the target aggregated leaf nodes and target aggregated edge data corresponding to the target unfolded node in the aggregated graph data. This includes: determining the target unfolded leaf node from the target aggregated leaf nodes corresponding to the target unfolded node, and determining the target unfolded edge data from the target aggregated edge data; the graph unfolding interface is then invoked to unfold the target unfolded leaf nodes and target unfolded edge data to obtain the unfolded graph data. The target unfolded leaf nodes can be some or all of the target aggregated leaf nodes; the target unfolded edge data can be some or all of the target aggregated edge data. The target aggregated leaf nodes and target aggregated edge data can be set according to actual needs.
[0102] The following describes the node expansion through an example: Please refer to... Figure 3 ,from Figure 3 The target expansion node is determined as N1 from the target aggregation nodes N1, N7, and N9; the target expansion leaf node is determined as N4 from the target aggregation leaf nodes N2, N3, N4, and N5 of the target expansion node N1; and the target expansion edge data E4 is determined from the target aggregation edge data E2, E3, E4, and E5. The graph expansion interface is called to expand the target expansion leaf node N4 and the target expansion edge data E4, obtaining the expanded graph data as follows: Figure 4 As shown.
[0103] Please see Figure 5 The diagram shown illustrates the specified aggregation point provided in the embodiments of this application.
[0104] The above embodiment expands only a portion of the leaf nodes of the target expanded node. The following embodiment describes the process of expanding all leaf nodes of the target expanded node. (Determine) Figure 3 In this context, N1 is the target expansion node; all target aggregation leaf nodes N2, N3, N4, and N5 of the target expansion node N1 are also used as target expansion leaf nodes; and all target aggregation edge data E2, E3, E4, and E5 of the target expansion node N1 are also used as target expansion edge data; the target expansion leaf nodes N2, N3, N4, and N5 and the target expansion edge data E2, E3, E4, and E5 are expanded to obtain the expanded graph data as follows: Figure 5 As shown.
[0105] As an optional embodiment, the method for expanding the target expanded leaf nodes and target expanded edge data can be to restore the graph data to its state before aggregation by deleting the target expanded leaf nodes and target expanded edge data aggregation identifiers.
[0106] Please continue reading Figure 3 If Figure 3N1, N7, and N9 are all used as target aggregation nodes, and all target aggregation leaf nodes of N1, N7, and N9 are used as target expansion leaf nodes. All target aggregation edge data are used as target expansion edge data. By performing node expansion operations, all node and edge data of the aggregation can be expanded with one click. The expanded graph data is as follows: Figure 2 As shown.
[0107] In the above implementation process, the graph expansion interface is called to expand the target aggregation leaf nodes and target aggregation edge data corresponding to the target expansion node in the aggregated graph data, thereby improving the user's controllability over the graph data and improving the user's operation efficiency.
[0108] In one optional embodiment, four types of interfaces can be predefined, including two graph aggregation interfaces and two graph expansion interfaces. The graph aggregation interface is used to handle tasks of node aggregation, and the graph expansion interface is used to handle tasks of node expansion.
[0109] There are two types of graph aggregation interfaces: the "aggregate all leaf nodes" interface and the "aggregate a specified leaf node" interface. The "aggregate all leaf nodes" interface aggregates all leaf nodes from all source nodes. The aggregated graph data contains only the source nodes and the edge data between them. For example... Figure 3 As shown.
[0110] The specified leaf node aggregation interface is used to aggregate the leaf nodes of a specified source node. In the aggregated graph data, the specified leaf nodes of the specified source node and their corresponding edge data are aggregated. However, the leaf nodes and their corresponding edge data of the specified source node that were not specified, as well as the source nodes and their leaf nodes and edge data that were not specified, are fully displayed.
[0111] Node expansion also includes two graph aggregation interfaces: the "Expand All Leaf Nodes" interface and the "Expand Specified Leaf Nodes" interface. The "Expand All Leaf Nodes" interface expands all leaf nodes (edge data) of all source nodes; the "Expand Specified Leaf Nodes" interface expands a specified leaf node and its corresponding edge data of a specified source node.
[0112] Please see Figure 6 The diagram shown is a schematic diagram of the spectrum processing algorithm module in an embodiment of this application.
[0113] The graph data stream can be obtained in JSON format. The initialization module is used to configure algorithm parameters, specifically the necessary attributes before algorithm execution or attributes dynamically set by the user, intermediate calculation results stored during execution, and the final results and state data stored after execution. Variables or parameters are essentially in-memory media used to store data.
[0114] Then, graph aggregation and graph expansion interfaces are predefined to implement the graph aggregation and expansion functions. The initialization module is used to configure the corresponding algorithm logic for each interface; the graph aggregation interface corresponds to the aggregation logic, and the graph expansion interface corresponds to the expansion logic. These two steps can be understood as a pre-processing procedure for graph processing.
[0115] The necessary checks module performs preliminary checks on the algorithm logic, such as checking whether the node and edge data passed by the interface are empty. After the checks, the source lookup module traverses and searches the node and edge data to determine the source node and leaf node, as well as the graph mapping relationship between the source node and the leaf node.
[0116] Using the node aggregation processing module and the edge aggregation processing module, the node aggregation algorithm and the edge aggregation algorithm are implemented respectively based on the graph mapping relationship between the source node and the leaf node.
[0117] In an optional embodiment, nodes in the aggregated or expanded graph data can also be hidden. Both source nodes and leaf nodes can be hidden. After adding a hidden marker to the nodes to be hidden, the nodes will not be displayed. It is understood that if the source node is hidden, the corresponding leaf nodes will also be hidden.
[0118] Please see Figure 7 The diagram shown is a schematic representation of the structure of a spectral data processing device provided in an embodiment of this application. This application provides a spectral data processing device 200, comprising:
[0119] The acquisition module 210 is used to acquire the graph data stream; the graph data stream includes node data and edge data;
[0120] Traversal module 220 is used to traverse and search the node data and edge data to determine the source node and leaf node from the node data;
[0121] The mapping module 230 is used to obtain the graph mapping relationship between the source node and the leaf node based on the source node and the leaf node;
[0122] The aggregation processing module 240 is used to aggregate node data and edge data in the graph data stream based on the graph mapping relationship between the source node and the leaf node to obtain aggregated graph data.
[0123] Optionally, in this embodiment of the application, the graph data processing device, the traversal module, is specifically used to traverse and search the node data and edge data through a recursive function, determine whether the node data has child nodes, and obtain a determination result; if the determination result indicates that the node data has child nodes, then the node type of the node data is determined as a source node; if the determination result indicates that the node data does not have child nodes, then the node type of the node data is determined as a leaf node.
[0124] Optionally, in this embodiment of the application, the graph data processing device and the traversal module are further configured to obtain a starting node pre-determined from the node data; starting from the starting node, traverse and search the node data and edge data through a recursive function to determine the adjacent nodes adjacent to the starting node; traverse and query the adjacent nodes to determine whether the adjacent node is connected to only one edge data; if so, the determination result of the adjacent node is that it has child nodes; if not, the determination result of the adjacent node is that it does not have child nodes.
[0125] Optionally, in this embodiment of the application, the graph data processing device further includes a traversal confirmation module, which is used to traverse and query all child nodes of the source node until the node type of all node data in the graph data stream is determined, and the traversal query is completed.
[0126] Optionally, in the embodiments of this application, the graph data processing apparatus includes a graph mapping relationship between source nodes and leaf nodes, which includes: a mapping relationship between each source node and its corresponding leaf node, a mapping relationship between source nodes and edge data, and a mapping relationship between leaf nodes and edge data.
[0127] Optionally, in this embodiment of the application, the graph data processing device includes an aggregation processing module, which is used to obtain a graph aggregation configuration set by the user; the graph aggregation configuration includes a graph processing type; based on the graph processing type, it obtains the aggregation logic corresponding to the pre-set graph processing type and the graph aggregation interface for executing the aggregation logic; it calls the graph aggregation interface to perform aggregation processing on the node data and edge data in the graph data stream based on the graph mapping relationship between the source node and the leaf node, and the aggregation logic, to obtain the aggregated graph data.
[0128] Optionally, in this embodiment of the application, the graph data processing device and the aggregation processing module are further configured to, if the graph processing type is node aggregation, obtain a preset target aggregation node; the target aggregation node is the source node that needs to be aggregated; according to the graph mapping relationship between the source node and the leaf node, obtain the target aggregation leaf node corresponding to the target aggregation node, and obtain the target aggregation edge data between the target aggregation node and each corresponding target aggregation leaf node; call the graph aggregation interface corresponding to the target node aggregation to aggregate the target aggregation leaf node and the target aggregation edge data to obtain the aggregated graph data.
[0129] Optionally, in this embodiment of the application, the graph data processing device includes an expansion processing module, which is used to obtain the target expansion node determined from the target aggregation node if the graph processing type is node expansion; call the graph expansion interface to expand the target aggregation leaf node and target aggregation edge data corresponding to the target expansion node in the aggregated graph data to obtain the expanded graph data.
[0130] It should be understood that this device corresponds to the above-described map data processing method embodiment and is capable of performing the various steps involved in the above method embodiment. The specific functions of this device can be found in the description above, and detailed descriptions are omitted here to avoid repetition. The device includes at least one software functional module that can be stored in memory or embedded in the device's operating system (OS) in the form of software or firmware.
[0131] Please see Figure 8 The diagram shows a structural schematic of an electronic device provided in an embodiment of this application. An electronic device 300 provided in this application includes a processor 310 and a memory 320. The memory 320 stores machine-readable instructions executable by the processor 310. When the machine-readable instructions are executed by the processor 310, the method described above is performed.
[0132] This application also provides a storage medium storing a computer program, which is executed by a processor to perform the above-described method.
[0133] The storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as Static Random Access Memory (SRAM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Erasable Programmable Read Only Memory (EPROM), Programmable Red-Only Memory (PROM), Read-Only Memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk.
[0134] It should be understood that the disclosed apparatus and methods can also be implemented in other ways, given the several embodiments provided in this application. The apparatus embodiments described above are merely illustrative. For example, the flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code, which contains one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than those marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, or they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram and / or flowchart, and combinations of blocks in block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.
[0135] In addition, the functional modules in the various embodiments of this application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.
[0136] The above description is only an optional implementation of the embodiments of this application, but the protection scope of the embodiments of this application is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the embodiments of this application should be covered within the protection scope of the embodiments of this application.
Claims
1. A method of processing atlas data, characterized by, include: Obtain the graph data stream; the graph data stream includes node data and edge data; The node data and edge data are traversed and searched to determine the source node and leaf node from the node data; Based on the source node and the leaf node, obtain the graph mapping relationship between the source node and the leaf node; Based on the graph mapping relationship between the source node and the leaf node, the node data and the edge data in the graph data stream are aggregated to obtain aggregated graph data. The graph mapping relationship between the source node and the leaf node includes: the mapping relationship between each source node and the corresponding leaf node, the mapping relationship between the source node and the edge data, and the mapping relationship between the leaf node and the edge data; The aggregation processing of node data and edge data in the graph data stream based on the graph mapping relationship between the source node and the leaf node includes: Obtain the user-defined graph aggregation configuration; the graph aggregation configuration includes the graph processing type. Based on the graph processing type, obtain the pre-set aggregation logic corresponding to the graph processing type and the graph aggregation interface for executing the aggregation logic; The graph aggregation interface is invoked to aggregate the node data and edge data in the graph data stream based on the graph mapping relationship between the source node and the leaf node, and the aggregation logic, to obtain aggregated graph data. In the process of rendering and displaying nodes based on the aggregated graph data, the aggregated leaf nodes and edge data do not need to be rendered and displayed.
2. The method of claim 1, wherein, The step of traversing and searching the node data and edge data to determine the source node and leaf node from the node data includes: The node data and edge data are traversed and searched through a recursive function to determine whether the node data has child nodes and obtain the determination result. If the determination result indicates that the node data has child nodes, then the node type of the node data is determined as the source node; if the determination result indicates that the node data does not have child nodes, then the node type of the node data is determined as the leaf node.
3. The method of claim 2, wherein, The step of traversing and searching the node data and edge data using a recursive function to determine whether the node data has child nodes and obtaining the determination result includes: Obtain the starting node that has been pre-determined from the node data; Starting from the starting node, the node data and edge data are traversed and searched through a recursive function to determine the adjacent nodes that are adjacent to the starting node. The adjacent nodes are traversed and queried to determine whether each adjacent node is connected to only one edge data. If so, the determination result of the adjacent node is that it has child nodes; If not, the result of the judgment of the adjacent node is that it does not have child nodes.
4. The method of claim 2, wherein, After determining the node type of the node data as the source node, the method further includes: The process involves traversing and querying all child nodes of the source node until the node type of all node data in the graph data stream is determined, thus completing the traversal and query.
5. The method of claim 1, wherein, The graph aggregation interface is invoked to aggregate the node data and edge data in the graph data stream based on the graph mapping relationship between the source node and the leaf node, and the aggregation logic, to obtain aggregated graph data, including: If the graph processing type is node aggregation, then a preset target aggregation node is obtained; the target aggregation node is the source node that needs to be aggregated. Based on the graph mapping relationship between the source node and the leaf node, the target aggregation leaf node corresponding to the target aggregation node is obtained, and the target aggregation edge data between the target aggregation node and each corresponding target aggregation leaf node is obtained; The graph aggregation interface corresponding to the target node aggregation is called to aggregate the target aggregation leaf node and the target aggregation edge data to obtain the aggregated graph data.
6. The method of claim 5, wherein, After obtaining the aggregated spectral data, the method further includes: If the graph processing type is node expansion, then the target expansion node determined from the target aggregated node is obtained; The graph expansion interface is called to expand the target aggregated leaf node and the target aggregated edge data corresponding to the target expansion node in the aggregated graph data, thereby obtaining the expanded graph data.
7. A map data processing device, characterized by comprising: include: The acquisition module is used to acquire the graph data stream; the graph data stream includes node data and edge data; The traversal module is used to traverse and search the node data and the edge data to determine the source node and leaf node from the node data; The mapping module is used to obtain the graph mapping relationship between the source node and the leaf node based on the source node and the leaf node; An aggregation processing module is used to aggregate the node data and edge data in the graph data stream based on the graph mapping relationship between the source node and the leaf node, so as to obtain aggregated graph data. The graph mapping relationship between the source node and the leaf node includes: the mapping relationship between each source node and the corresponding leaf node, the mapping relationship between the source node and the edge data, and the mapping relationship between the leaf node and the edge data; The aggregation processing module is used to obtain the graph aggregation configuration set by the user; the graph aggregation configuration includes a graph processing type; based on the graph processing type, obtain the pre-set aggregation logic corresponding to the graph processing type and the graph aggregation interface for executing the aggregation logic; call the graph aggregation interface, and based on the graph mapping relationship between the source node and the leaf node, and the aggregation logic, perform aggregation processing on the node data and the edge data in the graph data stream to obtain the aggregated graph data; The device is also used so that, during the rendering and display of nodes based on the aggregated graph data, the aggregated leaf nodes and edge data do not need to be rendered and displayed.
8. An electronic device, comprising: include: A processor and a memory, the memory storing machine-readable instructions executable by the processor, which, when executed by the processor, perform the method as described in any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, performs the method as described in any one of claims 1 to 6.