A method and device for processing graph data
By constructing graph data of M-layer layout and determining the coordinates of entity points in the polar coordinate system, the problem of disorder in graph data display is solved, orderly graphic layout is achieved, and user experience is improved.
Patent Information
- Application Number
- CN202111307179.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-05
- Publication Date
- 2025-08-19
- Estimated Expiration
- 2041-11-05
AI Technical Summary
In the prior art, the physical points are disordered when displaying the graph data, resulting in troubles in the user's process of viewing the graph.
By obtaining the entity points and relationships in the original graph data, the graph data of the M-layer layout is constructed according to the preset number of layers and filtering conditions, the coordinates of each entity point are determined using the polar coordinate system, and the data visualization chart library display is used.
It solves the problem of disordered entity points in the graph data display, realizes an orderly graphic layout, and improves user experience.
Smart Images

Figure CN114003778B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the financial field or other technical fields, and particularly to a method and device for processing graph data. Background Art
[0002] Popular graph data visualization technologies currently include, but are not limited to, D3, Canvas, Vis.js, and Echarts. D3 is flexible and easy to use, but relatively niche; Canvas requires less front-end development effort, but has a higher development threshold; and Echarts is flexible and universal. In addition, there are also some vendor-developed components, encompassing a wide range of applications.
[0003] At present, each front-end layout framework defaults to rendering and displaying according to the display order of points in the graph data. However, this method of rendering and displaying according to the display order of points in the original graph data sometimes results in disordered entity points in the displayed graph (such as Figure 1 ). Summary of the Invention
[0004] In response to the problems in the prior art, embodiments of the present invention provide a method and apparatus for processing graph data, which can at least partially solve the problems in the prior art.
[0005] On the one hand, the present invention proposes a method for processing graph data, including: obtaining entity points and entity relationships in original graph data with K-layer relationships; filtering entity points of each preset number of layers among the entity points according to a preset number of layers, entity point filtering conditions of each layer in the preset number of layers, and the entity relationships; constructing graph data with an M-layer layout based on the filtered entity points of each layer, wherein K and M are positive integers respectively.
[0006] Optionally, the entity point filtering conditions for each layer include at least one of the following: the type of entity point, the filtering priority of each type of entity point, the layer number of the entity point in the original graph data, the filtering priority of entity points in different layers in the original graph data, and the number of entity points.
[0007] Optionally, constructing graph data with an M-layer layout based on the filtered entity points of each layer includes: determining the coordinates of each entity point in the polar coordinate system based on the number of filtered entity points in each layer and the number of layers where each entity point is located; and constructing graph data with an M-layer layout based on the coordinates of each entity point in the polar coordinate system.
[0008] Optionally, determining the coordinates of each entity point in the polar coordinate system based on the number of entity points filtered out in each layer and the number of layers where each entity point is located includes: determining the polar angle of each entity point in each layer in the polar coordinate system based on the number of entity points filtered out in each layer in the preset number of layers; determining the proportion of the polar axis length of the entity point in the polar coordinate system according to the number of layers where each entity point is filtered out; and determining the coordinates of the entity point in the polar coordinate system based on the polar angle and the proportion of the polar axis length of the entity point in the polar coordinate system.
[0009] Optionally, determining the coordinates of each entity point in the polar coordinate system based on the number of entity points in each layer screened out and the number of layers where each entity point is located includes: if the total number of entity points screened out is less than the number of entity points in the first layer in the screening conditions, determining the polar angle of each entity point in the polar coordinate system based on the total number of entity points screened out; taking the polar length ratio of the entity points in the first layer in the preset number of layers as the polar length ratio of each entity point screened out in the polar coordinate system; and determining the coordinates of each entity point in the polar coordinate system based on the polar angle and polar length ratio of each entity point screened out in the polar coordinate system.
[0010] Optionally, the method further includes: using a data visualization chart library to graphically display the graph data with the M-layer layout.
[0011] On the other hand, the present invention proposes a graph data processing device, including: an acquisition module for acquiring entity points and entity relationships in original graph data with K-layer relationships; a screening module for screening entity points of each preset number of layers among the entity points according to the preset number of layers, entity point screening conditions of each layer in the preset number of layers, and the entity relationships; a construction module for constructing graph data with an M-layer layout based on the screened entity points of each layer, wherein K and M are positive integers respectively.
[0012] Optionally, the entity point filtering conditions for each layer include at least one of the following: the type of entity point, the filtering priority of each type of entity point, the layer number of the entity point in the original graph data, the filtering priority of entity points in different layers in the original graph data, and the number of entity points.
[0013] Optionally, the construction module is specifically used to: determine the coordinates of each entity point in the polar coordinate system based on the number of filtered entity points in each layer and the number of layers where each entity point is located; and construct graph data with an M-layer layout based on the coordinates of each entity point in the polar coordinate system.
[0014] Optionally, the construction module determines the coordinates of each entity point in the polar coordinate system based on the number of entity points filtered out in each layer and the number of layers where each entity point is located, including: determining the polar angle of each entity point in each layer in the polar coordinate system based on the number of entity points filtered out in each layer in the preset number of layers; determining the proportion of the polar axis length of the entity point in the polar coordinate system according to the number of layers where each entity point is filtered out; and determining the coordinates of the entity point in the polar coordinate system based on the polar angle and the proportion of the polar axis length of the entity point in the polar coordinate system.
[0015] Optionally, the construction module determines the coordinates of each entity point in the polar coordinate system based on the number of entity points in each layer screened out and the number of layers where each entity point is located, including: if the total number of entity points screened out is less than the number of entity points in the first layer in the screening conditions, then determining the polar angle of each entity point in the polar coordinate system based on the total number of entity points screened out; taking the polar length ratio of the entity points in the first layer in the preset number of layers as the polar length ratio of each entity point screened out in the polar coordinate system; and determining the coordinates of each entity point in the polar coordinate system based on the polar angle and polar length ratio of each entity point screened out in the polar coordinate system.
[0016] Optionally, the device further includes: a display module, configured to display the graph data having the M-layer layout in a graphical manner using a data visualization chart library.
[0017] On the other hand, the present invention provides an electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the method for processing image data described in any of the above embodiments when executing the program.
[0018] On the other hand, the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the method for processing graph data described in any of the above embodiments.
[0019] The graph data processing method and device provided by the embodiment of the present invention obtains entity points and entity relationships in original graph data with K layers of relationships; filters entity points in each preset number of layers from the entity points according to the preset number of layers, entity point filtering conditions in each preset number of layers, and the entity relationships; and constructs graph data with an M-layer layout based on the filtered entity points in each layer, where K and M are positive integers. In this way, the original graph data with K layers of relationships is processed into graph data with an M-layer layout. When the processed graph data is displayed on the front end, the entity points are arranged according to the layers, which solves the problem of disordered entity points in the graph when displaying graph data in the prior art, thereby resolving the user's confusion when viewing the graph. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative work. In the drawings:
[0021] Figure 1 It is a graph presented in the prior art by displaying the points in the graph data in the order in which they are displayed.
[0022] Figure 2 4 is a flowchart of a method for processing graph data provided according to an embodiment of the present invention.
[0023] Figure 3 It is a partial flow chart of a method for processing graph data provided according to an embodiment of the present invention.
[0024] Figure 4 It is a partial flow chart of a method for processing graph data provided according to an embodiment of the present invention.
[0025] Figure 5 FIG. 1 is a schematic diagram showing an overview of a layout algorithm provided by an embodiment of the present invention.
[0026] Figure 6 This is a schematic diagram of a point-edge judgment process provided by an embodiment of the present invention.
[0027] Figure 7 This is a schematic diagram of a single-point data storage process provided by an embodiment of the present invention.
[0028] Figure 8 1 is a flow chart of a method for processing the M1 layer after rearrangement provided by an embodiment of the present invention.
[0029] Figure 9 1 is a flow chart of a method for processing the M2 layer after rearrangement provided by an embodiment of the present invention.
[0030] Figure 10 It is a schematic diagram of a layout calculation flow provided by an embodiment of the present invention.
[0031] Figure 11 This is a graph presented after applying the graph data visualization layout algorithm provided by an embodiment of the present invention.
[0032] Figure 12 It is a structural diagram of a graph data processing device provided by one embodiment of the present invention.
[0033] Figure 13 It is a structural diagram of a graph data processing device provided by another embodiment of the present invention.
[0034] Figure 14 It is a schematic diagram of the physical structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0035] To make the purpose, technical solutions and advantages of the embodiments of the present invention more clear, the embodiments of the present invention are further described in detail below with reference to the accompanying drawings. Here, the illustrative embodiments of the present invention and their descriptions are used to explain the present invention, but are not intended to limit the present invention. It should be noted that, unless there is a conflict, the embodiments and features in the embodiments of this application can be combined with each other in any manner.
[0036] The execution subject of the graph data processing method provided by the embodiment of the present invention includes but is not limited to a computer.
[0037] Figure 2 FIG. 1 is a flow chart of a method for processing graph data provided by an embodiment of the present invention. Figure 2 As shown, the method for processing graph data provided by the embodiment of the present invention includes:
[0038] S101, obtaining entity points and entity relationships in original graph data with K-level relationships;
[0039] In this step, before obtaining the entity points (nodes) and entity relationships (edges) in the original graph data with K-layer relationships, parameter settings can be performed in the background: extract the relevant original data in the graph database that expands outward from the initiating node to K layers, which can be a positive integer; for example, K=2, that is, the relevant original data that expands outward from the initiating node to 2 layers, where the initiating node is one of the entity points in the original graph data.
[0040] After setting parameters in the background, the original graph data extending outward from the initiating node to K layers is obtained from the graph database based on the parameter K set in the background. Entity points and entity relationships are extracted from the original graph data with K layers of relationships. The original graph data can be regarded as the storage data of the knowledge graph based on the graph database. The original graph data can be retrieved from the graph database through the data interface. The original graph data includes entity points (nodes) and entity relationships (edges), and the entity points and entity relationships can each have attributes.
[0041] Specifically, you can refer to List <map>Receive the data information of entity points and entity relationships in the K-layer original graph data, where the entity point information may include the identification ID and basic information of the entity, and the entity relationship information may include the source number, flow number, and description.
[0042] Taking the banking scenario as an example, the process of establishing the original graph data can be as follows: expand outward one layer through a certain individual customer to deeply mine the personal and corporate information with data associated with him; then expand outward one layer through these associated individuals and companies to deeply mine the personal and corporate information with data associated with them; the total number of expansion layers in this example is 2 layers, that is, there are 2 layers of relationships.
[0043] The attribute information of individual customers mined in depth may include: customer number, private banking customer number, contract signing date, name, age, five-ring logo, assets at a certain point in time, customer manager number, customer manager name, wealth advisor number A, wealth advisor number B, customer manager affiliation, customer affiliation, customer source, recommendation time, etc.
[0044] The attribute information package of corporate customers mined in depth may include: enterprise number, account opening date, name, enterprise type, enterprise size, social credit code, business scope, registration place, status, establishment time, registered capital, registered capital currency, account manager number, account manager name, account manager affiliation, customer affiliation, customer source, etc.
[0045] S102, screening entity points of each layer in the preset number of layers from the entity points according to the preset number of layers, the entity point screening conditions of each layer in the preset number of layers, and the entity relationship;
[0046] In this step, the preset number of layers and the entity point screening conditions for each layer within the preset number of layers can be set in advance in the background. The preset number of layers refers to the number of layers after the entity points in the original graph data are rearranged. For example, a preset number of layers of 2 indicates a 2-layer expansion after rearrangement. The preset number of layers can be equal to K, or greater than K, or less than K, and can be set according to specific needs.
[0047] The entity point screening conditions for each layer in the preset number of layers may include at least one of the following: the type of entity point, the screening priority of each type of entity point, the layer number of the entity point in the original graph data, the screening priority of entity points in different layers in the original graph data, and the number of entity points. For example,
[0048] Taking the banking scenario as an example: the types of physical points may include: in-bank enterprises, non-bank enterprises, in-bank private banking customers (individuals), in-bank potential customers (individuals), and non-bank customers (individuals).
[0049] The screening priority of each layer of entity points is:
[0050] M1=K1 internal enterprises + K2 internal enterprises + K1 external enterprises + K2 external enterprises
[0051] M2 = K1 private banking customers within the bank + K2 private banking customers within the bank + K1 potential customers within the bank + K2 potential customers within the bank + K1 non-bank customers + K2 non-bank customers
[0052] Among them, M1 represents the first layer in the preset number of layers, M2 represents the second layer in the preset number of layers, K1 represents the first layer in the original image data, and K2 represents the second layer in the original image data.
[0053] The screening priority of the M1 layer entity points above indicates that the screening priority of enterprises within the K1 industry, enterprises within the K2 industry, enterprises outside the K1 industry, and enterprises outside the K2 industry decreases in sequence.
[0054] The screening priority of the above-mentioned M2 layer entity points indicates that the screening priority of K1 internal private banking customers, K2 internal private banking customers, K1 internal potential customers, K2 internal potential customers, K1 external customers, and K2 external customers decreases in order.
[0055] The number of entity points in the entity point filter condition for each layer refers to the maximum number of entity points displayed on each layer after the re-layout; for example:
[0056] The number of M1 entity points = 12, that is, the first layer after the rearrangement will display a maximum of 12 entity points. The display priority is displayed in the order of the formula set in the previous step, that is, K1 in-line enterprise - K2 in-line enterprise - K1 non-line enterprise - K2 non-line enterprise, with the first 12 entity points being given priority.
[0057] The number of M2 entity points = 30, that is, the second layer after the rearrangement displays a maximum of 30 entity points. The display priority is displayed according to the arrangement order of the formula set in the previous step, that is, K1 in-bank private banking customers - K2 in-bank private banking customers - K1 in-bank potential customers - K2 in-bank potential customers - K1 non-bank customers - K2 non-bank customers, with the first 30 entity points being given priority.
[0058] If the total number of entity points in the K1 layer is less than the set value of the number of entity points in the M1 layer, the total number of entity points in the K1 layer will be used as the actual value of the entity points in the M1 layer, and the same applies to the K2 layer. If the sum of the total number of entity points in each layer of the original graph data with K-layer relationships is less than the set value of the number of entity points in the M1 layer, then the selected entity points will be arranged in the same layer, that is, the M1 layer.
[0059] When the filtering condition involves the layer number of the entity point in the original graph data, the layer number of each entity point in the original graph data needs to be determined based on the acquired entity relationship.
[0060] S103. Construct graph data with an M-layer layout based on the filtered entity points of each layer, where K and M are positive integers respectively.
[0061] In this step, after filtering out the entity points of each layer of the preset number of layers, graph data with an M-layer layout is constructed according to the entity points of each layer. M can be equal to or less than the preset number of layers. For example, when K=2, and the preset number of layers is equal to 2, if the sum of the total number of entity points in each layer of the original graph data with K-layer relationships is less than the set value of the number of entity points in the M1 layer, then the filtered entity points are arranged in the same layer, i.e., the M1 layer, to construct graph data with a one-layer layout. In other cases, graph data with the preset number of layers can be constructed according to the entity points of each layer in the preset number of layers.
[0062] The graph data processing method provided by the embodiment of the present invention obtains entity points and entity relationships in original graph data with K layers of relationships; filters entity points in each preset number of layers from the entity points according to the preset number of layers, entity point filtering conditions in each preset number of layers, and the entity relationships; and constructs graph data with an M-layer layout based on the filtered entity points in each layer, where K and M are positive integers. In this way, the original graph data with K layers of relationships is processed into graph data with an M-layer layout. When the processed graph data is displayed on the front end, the entity points are arranged according to the layers, which solves the problem of disordered entity points in the graph when displaying graph data in the prior art, thereby solving the problem of users' troubles in viewing the graph.
[0063] like Figure 3 As shown, optionally, constructing graph data with an M-layer layout based on the filtered entity points of each layer includes:
[0064] S1031. Determine the coordinates of each entity point in the polar coordinate system based on the number of entity points in each layer that have been screened and the number of layers where each entity point is located.
[0065] In this step, the entity points screened out at any layer can be distributed around the initiating node according to a certain rule, for example, they can be evenly distributed around the initiating node. At this time, the position of each entity point relative to the initiating node can be expressed in polar coordinates, where the initiating node is located at the origin in the polar coordinate system.
[0066] S1032. Construct graph data with an M-layer layout according to the coordinates of each entity point in the polar coordinate system.
[0067] In this step, after determining the coordinates of each entity point in the preset number of layers in the polar coordinate system, the positional relationship between each entity point in each layer and the initiating node can be determined, that is, graph data with an M-layer layout is constructed.
[0068] like Figure 4 As shown, optionally, in the above embodiment, determining the coordinates of each entity point in the polar coordinate system according to the number of entity points in each layer screened out and the number of layers where each entity point is located includes:
[0069] S10311. Determine the polar angle of each entity point in each layer in the polar coordinate system according to the number of entity points screened out in each layer of the preset number of layers;
[0070] In this step, the entity points of each layer can be evenly distributed around the initiating node. In this case, for the i-th (0≤i≤M1.size-1) entity point in layer M1, the polar angle θ of this entity point in the polar coordinate system is (360° / M1.size)×i, where M1.size represents the number of entity points in layer M1. Similarly, the polar angle of each entity point in other layers can be obtained. In addition, the entity points of each layer can be sorted according to the screening priority. For example, the first entity point of the first layer filtered according to the screening rules is recorded as i=0, and the second entity point is recorded as i=1. Alternatively, the entity points of each layer can be sorted randomly.
[0071] S10312. Determine the polar axis length ratio of each entity point in the polar coordinate system according to the number of layers of each entity point selected.
[0072] In this step, the distance between each layer of entity points and the initiating node can be different to distinguish the entity points of each layer. For example, the larger the number of layers, the farther the entity points of the layer are from the initiating node; for entity points on the same layer, the distance between each entity point and the initiating node can be the same. At this time, for the entity points of the jth layer, the polar axis length ratio of each entity point in the polar coordinate system is r=j / floors, where floor represents the total number of layers. In this example, the polar axis length ratio is used instead of the polar axis length to represent the coordinates of the entity point. In this way, when the page graphically displays the graph data with an M-layer layout, the total polar axis length will be matched according to the adaptive rule by default, but a fixed length can also be customized.
[0073] S10313. Determine the coordinates of the entity point in the polar coordinate system according to the polar angle and the polar axis length ratio of the entity point in the polar coordinate system.
[0074] In this step, the coordinates of each entity point in the polar coordinate system can be expressed as a ratio of polar axis length and a polar angle.
[0075] Optionally, in the above embodiment, determining the coordinates of each entity point in the polar coordinate system based on the number of entity points in each layer screened out and the number of layers where each entity point is located may further include:
[0076] If the total number of the screened entity points is less than the number of the first layer entity points in the screening condition, then determining the polar angle of each of the entity points in the polar coordinate system according to the total number of the screened entity points;
[0077] The polar axis length ratio of the entity points in the first layer of the preset number of layers is used as the polar axis length ratio of each of the selected entity points in the polar coordinate system;
[0078] The coordinates of each of the filtered entity points in the polar coordinate system are determined according to the polar angle and polar axis length ratio of each of the filtered entity points in the polar coordinate system.
[0079] In this embodiment, if the total number of filtered entity points is less than the number of first-layer entity points in the filtering conditions, the filtered entity points are arranged in the first layer, i.e., the M1 layer, to construct graph data with a one-layer layout; at this time, each entity point can be evenly distributed around the initiating node, and the distance between each entity point and the initiating node can be equal to the distance between the entity point of the first layer and the initiating node. The polar angle of the i-th (0≤i≤sum-1) entity point among the entity points can be expressed as θ=(360° / sum)×i, where sum represents the total number of entity points; the polar axis length ratio of each entity point among the entity points can be equal to the polar axis length ratio of the entity points of the first layer, r=1 / floors, where floor represents the total number of layers, corresponding to the total polar axis length in the polar coordinates. It can be understood that in this specific example, floors=1.
[0080] Optionally, the method may further include: using a data visualization chart library to graphically display the graph data having the M-layer layout.
[0081] In this embodiment, after obtaining the graph data with an M-layer layout, the graph data with an M-layer layout can be transmitted to the front end, so that the front end can use a data visualization chart library to graphically display the graph data with an M-layer layout. For example, the front end uses Echarts (Enterprise Charts commercial product chart library) for display, mainly using basic charts such as relationship graphs and polar coordinate charts. Basic charts can be used in combination with each other, such as using a combination of a relationship graph and a polar coordinate chart. The displayed content has strong compatibility.
[0082] For a better understanding of the present invention, the method for processing graph data provided by the present invention is described below through a specific embodiment.
[0083] Take the banking scenario as an example: expand outward one layer from a certain individual customer to deeply mine the personal and corporate information associated with the individual customer's data; then expand outward one more layer from these associated individuals and companies to deeply mine the personal and corporate information associated with the individual customer's data; the total number of expansion layers in this example is 2.
[0084] The personal customer information deeply mined includes: customer number, private banking customer number, contract signing date, name, age, five-ring logo, assets at the time, customer manager number, customer manager name, wealth advisor number A, wealth advisor number B, customer manager affiliation, customer affiliation, customer source, recommendation time, etc.
[0085] The corporate customer information mined in depth includes: enterprise number, account opening date, name, enterprise type, enterprise size, social credit code, business scope, registration place, status, establishment time, registered capital, registered capital currency, account manager number, account manager name, account manager affiliation, customer affiliation, customer source, etc.
[0086] The specific implementation operations for the above graph data are as follows:
[0087] 1. Background parameter settings
[0088] 1) Extract the number of layers of K-layer expansion in the graph database; for example, K=2, which means that all relevant original data of 2 layers are expanded outward from the initiating node.
[0089] 2) The number of layers after rearrangement; for example, M=2.
[0090] 3) Entities that appear in each layer after rearrangement (filtering conditions for entities in each layer); example
[0091] Initialization entities: in-bank enterprises, non-bank enterprises, in-bank private banking customers (individuals), in-bank potential customers (individuals), and non-bank customers (individuals).
[0092] Each layer after rearrangement is displayed:
[0093] M1=K1 internal enterprises + K2 internal enterprises + K1 external enterprises + K2 external enterprises
[0094] M2 = K1 private banking customers within the bank + K2 private banking customers within the bank + K1 potential customers within the bank + K2 potential customers within the bank + K1 non-bank customers + K2 non-bank customers
[0095] Set the maximum number of nodes (entities) displayed on each layer after re-layout; for example
[0096] The number of M1 nodes = 12, that is, the first layer after the rearrangement displays a maximum of 12 nodes, and the display priority is displayed in the order of the formula set in the previous step, that is, K1 in-line enterprises - K2 in-line enterprises - K1 outside-line enterprises - K2 outside-line enterprises, with the first 12 nodes being given priority.
[0097] The number of M2 nodes = 30, that is, the second layer after the rearrangement displays a maximum of 30 nodes, and the display priority is displayed in the order of the formula set in the previous step, that is, K1 in-bank private banking customers - K2 in-bank private banking customers - K1 in-bank potential customers - K2 in-bank potential customers - K1 non-bank customers - K2 non-bank customers, with the first 30 nodes being given priority.
[0098] If the total number of nodes in the K1 layer is less than the set value in the M1 layer, the total number of nodes in the K1 layer will be used as the set value. The same applies to the K2 layer.
[0099] If the sum of the total number of nodes in each layer of K is less than the number of nodes in the M1 layer, then the M layers are arranged in the same layer, namely the M1 layer.
[0100] 2. Background running algorithm
[0101] Based on the parameter settings in the previous step, the background will run the following algorithm. See the flowchart and attached explanation for details.
[0102] Run the vertex-edge relationship judgment algorithm;
[0103] Run single-point data storage algorithms;
[0104] Run the M1 layer re-layout algorithm;
[0105] Run the M2 layer re-layout algorithm;
[0106] Run the overall layout algorithm.
[0107] Figure 5 This is a general overview of the layout algorithm. It uses pre-set parameters in the backend, applies the relevant parameter processing methods and layout algorithms, and then passes them to the frontend for display using Echarts (Enterprise Charts commercial product chart library). It primarily uses basic charts such as relationship graphs and polar coordinate charts. These basic charts can be combined with each other. For example, this method uses a combination of a relationship graph and a polar coordinate chart. The displayed content has strong compatibility.
[0108] Figure 6 This is a schematic diagram of point-edge judgment, based on List <map>Receive the data information of the points and edges in the original K layer, where the point information includes the identification ID and basic customer information (individual customer), and the edge information includes the source number, flow number, and description.
[0109] Figure 7 It is a single point data storage, that is, initialize three Set <string>To receive the M-layer data after rearrangement, they are defined as setOne (first layer), setTwo (second layer), and setTemp (temporary layer). Here, setOne (first layer) is used to store points that meet the M1 layer entity point filtering conditions and the edges related to the points. SetTwo (second layer) is used to store points that meet the M2 layer entity point filtering conditions and the edges related to the points. SetTemp (temporary layer) is used to store the data information of the points and edges in the original K layer. The use of set is to facilitate the removal of duplicate data (set has the characteristics of being unordered and non-repetitive).
[0110] Figure 8 This is the processing method of the M1 layer after re-layout, including the following
[0111] Confirm M1 entity data (setOne), steps:
[0112] a) Remove the center point (originating node) from the points (nodesData);
[0113] b) Traverse the points (nodesData) and determine whether the point attribute (category) is an enterprise. If so, execute step c below. Otherwise, execute step c below to confirm the individual customer related to the center point in the M2 entity data (setTwo).
[0114] c) Under the premise of satisfying the requirements of corporate customers, determine whether the number of points in setOne exceeds 12. If so, exit the loop and confirm the M2 entity data (setTwo). If not, execute step d.
[0115] d) Traverse the edges (edgesObj) and determine whether the source number and flow direction number correspond to the point ID and center point ID; if so, add the point to setOne and jump out of this loop. If not, repeat the judgment until the end of this loop.
[0116] Figure 9 This is the processing method of the M2 layer after re-layout, including the following
[0117] M2 entity data (setTwo) confirmation, steps:
[0118] (1) Individual customers related to the center point
[0119] a) Remove the center point in nodesData;
[0120] b) Traverse the nodes (nodesData) and determine whether the node attribute (category) is a personal customer; if so, execute step c below; otherwise, execute step c in the M1 entity data (setOne) confirmation;
[0121] c) Under the premise of satisfying the individual customer requirement, determine whether the setTwo number at this time has exceeded the limit of 30; if so, exit the loop and proceed to the individual customer confirmation related to the K1 layer entity point; if not, execute step d below;
[0122] d) Traverse the edges (edgesData) and determine whether the source number and flow direction number correspond to the vertex ID and center ID; if so, add the vertex to setTwo and exit the loop. If not, repeat the loop until the end.
[0123] (2) Individual customers related to K1-level entities
[0124] a) Convert setTemp and setOne to String type, setTempStr and setOneStr respectively; (to use the indexOf function to reduce loops and facilitate judgment);
[0125] b) Traverse the edges (edgesData) and determine whether the source number and flow direction number of the edge contained in setTempStr.indexOf and setOneStr.indexOf are related to the K1 layer entity point (the order is not important here, that is, setTempStr can match the source number and flow direction number). If so, execute step c; if not, jump out of this loop directly;
[0126] c) Traverse setTemp (temporary layer), traverse oneSet (first layer);
[0127] d) Check whether setTwo exceeds 30. If not, execute (e); if it exceeds, exit the loop;
[0128] e) Determine whether the source number and flow direction number of the edge correspond to the point in setTemp and the point in setOne respectively; if so, add the point to setTwo and jump out of this loop. If not, repeat the judgment until the end of this loop.
[0129] Figure 10 This is a schematic diagram of the layout calculation process, as follows:
[0130] int sum=min{M1,12}+min{M2,30}; M1,M2∈Ν+
[0131] int floors=sum≤12?1:[M1=0?1:2];
[0132] θ(i)=sum≤12? (360 / sum)*i:[i <min{M1,12}:(360 / min{M1,12})*i:(360 / min{M2,30})*(i-min{M1,12})];i=0,1,2...
[0133] Φ(i)=floors / (M1>0&i <M1?1:[M1=0?1:2]);i=0,1,2...
[0134] P(i)=(Φ(i),θ(i)); i=0,1,2...
[0135] Where M1 and M2 represent the number of points in the first and second layers respectively, and i represents the i-th node in the current layer;
[0136] floors indicates the total number of floors;
[0137] θ(i) represents the polar angle of the i-th node in the current layer;
[0138] Φ(i) represents the polar length ratio of the i-th node in the current layer;
[0139] P(i) represents the polar coordinates of the i-th node in the current layer.
[0140] Combining the above results, by substituting the setOne and setTwo nodes into the above formula, we can derive the relevant θ(i), Φ(i), and P(i). (When rendering the page, the default polar axis length will be matched according to the adaptive rule, but a custom fixed length can also be set.)
[0141] The following results can be obtained through calculation:
[0142] (In which the indexing is based on the plane 360°)
[0143] a) The total number of nodes in M1+M2 is less than or equal to 12. Divide 360° into 12 equal parts, so the gap between each node is 30°.
[0144] b) The total number of nodes in M1+M2 is greater than 12 and does not exceed 42. At the same time, M1 does not exceed 12, and M2 does not exceed 30. The gap between M1 points is: 360 / M1 points; the gap between M2 points is: 360 / M2 points;
[0145] c) If the number of M1 points exceeds 12 and the number of M2 points exceeds 30, the calculation is performed using 12 M1 points and 30 M2 points. That is, the gap at M1 is 30° and the gap at M2 is 12°.
[0146] Figure 11 This is the graph generated by applying the graph data visualization layout algorithm in this embodiment. The initiating node is an ICBC private banking customer. The first layer after the layout consists of three ICBC corporate customers and one non-ICBC corporate customer. The second layer consists of one ICBC private banking customer and 13 potential ICBC customers. The relationships between these entities are clearly marked on the edges.
[0147] Figure 12 FIG. 1 is a schematic diagram of the structure of a graph data processing device provided by an embodiment of the present invention. Figure 12 As shown, the graph data processing device provided by the embodiment of the present invention includes: an acquisition module 21, used to obtain entity points and entity relationships in the original graph data with K-layer relationships; a screening module 22, used to screen entity points of each preset number of layers among the entity points according to the preset number of layers, entity point screening conditions of each layer in the preset number of layers, and the entity relationships; a construction module 23, used to construct graph data with an M-layer layout based on the screened entity points of each layer, wherein K and M are positive integers respectively.
[0148] The graph data processing method and device provided by the embodiment of the present invention obtains entity points and entity relationships in original graph data with K layers of relationships; filters entity points in each preset number of layers from the entity points according to the preset number of layers, entity point filtering conditions in each preset number of layers, and the entity relationships; and constructs graph data with an M-layer layout based on the filtered entity points in each layer, where K and M are positive integers. In this way, the original graph data with K layers of relationships is processed into graph data with an M-layer layout. When the processed graph data is displayed on the front end, the entity points are arranged according to the layers, which solves the problem of disordered entity points in the graph when displaying graph data in the prior art, thereby resolving the user's confusion when viewing the graph.
[0149] Optionally, the entity point filtering conditions for each layer include at least one of the following: the type of entity point, the filtering priority of each type of entity point, the layer number of the entity point in the original graph data, the filtering priority of entity points in different layers in the original graph data, and the number of entity points.
[0150] Optionally, the construction module is specifically used to: determine the coordinates of each entity point in the polar coordinate system based on the number of filtered entity points in each layer and the number of layers where each entity point is located; and construct graph data with an M-layer layout based on the coordinates of each entity point in the polar coordinate system.
[0151] Optionally, the construction module determines the coordinates of each entity point in the polar coordinate system based on the number of entity points filtered out in each layer and the number of layers where each entity point is located, including: determining the polar angle of each entity point in each layer in the polar coordinate system based on the number of entity points filtered out in each layer in the preset number of layers; determining the proportion of the polar axis length of the entity point in the polar coordinate system according to the number of layers where each entity point is filtered out; and determining the coordinates of the entity point in the polar coordinate system based on the polar angle and the proportion of the polar axis length of the entity point in the polar coordinate system.
[0152] Optionally, the construction module determines the coordinates of each entity point in the polar coordinate system based on the number of entity points in each layer screened out and the number of layers where each entity point is located, including: if the total number of entity points screened out is less than the number of entity points in the first layer in the screening conditions, then determining the polar angle of each entity point in the polar coordinate system based on the total number of entity points screened out; taking the polar length ratio of the entity points in the first layer in the preset number of layers as the polar length ratio of each entity point screened out in the polar coordinate system; and determining the coordinates of each entity point in the polar coordinate system based on the polar angle and polar length ratio of each entity point screened out in the polar coordinate system.
[0153] like Figure 13 As shown, optionally, the device further includes: a display module 24, which is used to display the graph data with the M-layer layout in a graphical manner using a data visualization chart library.
[0154] The embodiments of the apparatus provided in the embodiments of the present invention can be specifically used to execute the processing flow of the above-mentioned method embodiments. Its functions are not described in detail here, and reference can be made to the detailed description of the above-mentioned method embodiments.
[0155] It should be noted that the graph data processing method and device provided in the embodiments of the present invention can be used in the financial field, and can also be used in any technical field other than the financial field. The embodiments of the present invention do not limit the application field of the graph data processing method and device.
[0156] Figure 14 A schematic diagram of the physical structure of an electronic device provided by an embodiment of the present invention is shown in FIG. Figure 14 As shown, the electronic device may include: a processor 301, a communication interface 302, a memory 303, and a communication bus 304, wherein the processor 301, the communication interface 302, and the memory 303 communicate with each other via the communication bus 304. The processor 301 may call the logic instructions in the memory 303 to execute the following method: obtaining entity points and entity relationships in original graph data having K layers of relationships; filtering entity points in each layer of the preset number of layers according to the preset number of layers, the entity point filtering conditions of each layer of the preset number of layers, and the entity relationships; constructing graph data with an M-layer layout based on the filtered entity points of each layer, wherein K and M are positive integers.
[0157] In addition, the logic instructions in the above-mentioned memory 303 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when sold or used as an independent product. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0158] This embodiment discloses a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer, the computer can execute the methods provided by the above-mentioned method embodiments, for example, including: obtaining entity points and entity relationships in original graph data with K-layer relationships; filtering entity points in each preset number of layers among the entity points according to the preset number of layers, entity point filtering conditions for each layer in the preset number of layers, and the entity relationships; constructing graph data with an M-layer layout based on the filtered entity points in each layer, where K and M are positive integers respectively.
[0159] This embodiment provides a computer-readable storage medium, which stores a computer program. The computer program enables the computer to execute the methods provided by the above-mentioned method embodiments, for example, including: obtaining entity points and entity relationships in original graph data with K-layer relationships; filtering entity points in each preset number of layers among the entity points according to the preset number of layers, entity point filtering conditions for each layer in the preset number of layers, and the entity relationships; constructing graph data with an M-layer layout based on the filtered entity points in each layer, where K and M are positive integers respectively.
[0160] It will be understood by those skilled in the art that embodiments of the present invention may be provided as methods, systems, or computer program products. Thus, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0161] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowcharts and / or block diagrams, as well as combinations of processes and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowcharts and / or block diagrams. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0162] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.
[0163] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0164] Throughout this specification, reference to terms such as "one embodiment," "a specific embodiment," "some embodiments," "for example," "example," "specific example," or "some examples" means that the specific features, structures, materials, or characteristics described in conjunction with that embodiment or example are included in at least one embodiment or example of the present invention. In this specification, schematic representations of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
[0165] The specific embodiments described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.< / string> < / map> < / map>
Claims
1. A method for processing graph data, characterized in that: include: Obtain entity points and entity relationships in the original graph data with K-level relationships; Filtering entity points of each layer in the preset number of layers from the entity points according to the preset number of layers, the entity point screening conditions of each layer in the preset number of layers, and the entity relationship; Based on the filtered entity points of each layer, a graph data with an M-layer layout is constructed, including: Determining the coordinates of each entity point in the polar coordinate system based on the number of entity points in each layer screened out and the number of layers where each entity point is located, including: determining the polar angle of each entity point in each layer in the polar coordinate system based on the number of entity points screened out in each layer in a preset number of layers; determining the proportion of the polar axis length of each entity point in the polar coordinate system based on the number of layers where each entity point is screened out; and determining the coordinates of each entity point in the polar coordinate system based on the polar angle and the proportion of the polar axis length of each entity point in the polar coordinate system. According to the coordinates of each entity point in the polar coordinate system, construct graph data with an M-layer layout, where K and M are positive integers respectively; The graph data having the M-layer layout is displayed in a graphical manner using a data visualization chart library.
2. The method according to claim 1, characterized in that The entity point screening conditions of each layer include at least one of the following: the type of entity point, the screening priority of each type of entity point, the layer number of the entity point in the original graph data, the screening priority of entity points in different layers in the original graph data, and the number of entity points.
3. The method according to claim 1, characterized in that Determining the coordinates of each entity point in the polar coordinate system according to the number of entity points in each layer screened out and the number of layers where each entity point is located includes: If the total number of the screened entity points is less than the number of the first layer entity points in the screening condition, then determining the polar angle of each of the entity points in the polar coordinate system according to the total number of the screened entity points; The polar axis length ratio of the entity points in the first layer of the preset number of layers is used as the polar axis length ratio of each of the selected entity points in the polar coordinate system; The coordinates of each of the filtered entity points in the polar coordinate system are determined according to the polar angle and polar axis length ratio of each of the filtered entity points in the polar coordinate system.
4. A graph data processing device, characterized in that: include: The acquisition module is used to obtain entity points and entity relationships in the original graph data with K-level relationships; A screening module, configured to screen entity points in each of the preset number of layers from the entity points according to the preset number of layers, the entity point screening conditions in each of the preset number of layers, and the entity relationships; The construction module is used to construct graph data with an M-layer layout based on the filtered entity points of each layer, including: Determining the coordinates of each entity point in the polar coordinate system based on the number of entity points in each layer screened out and the number of layers where each entity point is located, including: determining the polar angle of each entity point in each layer in the polar coordinate system based on the number of entity points screened out in each layer in a preset number of layers; determining the proportion of the polar axis length of each entity point in the polar coordinate system based on the number of layers where each entity point is screened out; and determining the coordinates of each entity point in the polar coordinate system based on the polar angle and the proportion of the polar axis length of each entity point in the polar coordinate system. According to the coordinates of each entity point in the polar coordinate system, construct graph data with an M-layer layout, where K and M are positive integers respectively; The display module is used to display the graph data with the M-layer layout in a graphical manner using a data visualization chart library.
5. The device according to claim 4, characterized in that The entity point screening conditions of each layer include at least one of the following: the type of entity point, the screening priority of each type of entity point, the layer number of the entity point in the original graph data, the screening priority of entity points in different layers in the original graph data, and the number of entity points.
6. The device according to claim 4, characterized in that The construction module determines the coordinates of each entity point in the polar coordinate system according to the number of entity points in each layer screened out and the number of layers where each entity point is located, including: If the total number of the screened entity points is less than the number of the first layer entity points in the screening condition, then determining the polar angle of each of the entity points in the polar coordinate system according to the total number of the screened entity points; The polar axis length ratio of the entity points in the first layer of the preset number of layers is used as the polar axis length ratio of each of the selected entity points in the polar coordinate system; The coordinates of each of the filtered entity points in the polar coordinate system are determined according to the polar angle and polar axis length ratio of each of the filtered entity points in the polar coordinate system.
7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 3 are implemented.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 3 are implemented.
Citation Information
Patent Citations
Data visualization method and apparatus for layered graph structure
CN101470711A
Data visualization method and device and storage medium
CN112632196A