Large-scale knowledge graph visualization method and system

By employing modularity discovery algorithms, tree diagram space filling, and force-oriented layout optimization algorithms, the semantic clustering and hierarchical organization problems of large-scale knowledge graphs are solved, achieving efficient and clear visualization.

CN120832941AInactive Publication Date: 2025-10-24WUHAN UNIV OF TECH +1

Patent Information

Application Number
CN202511332955.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-09-18
Publication Date
2025-10-24
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

Traditional visualization methods are unable to accurately present the semantic clustering and hierarchical organization in large-scale knowledge graphs, resulting in a significant reduction in the clarity of structural expression and affecting the user interaction experience.

Method used

The knowledge graph data is clustered using a modularity-based discovery algorithm, representative nodes are selected, and the visualization results are dynamically layered by combining tree graph space filling technology and force-directed layout with the Barnes-Hut algorithm and random vertex sampling algorithm.

Benefits of technology

It achieves clear structural representation of large-scale knowledge graphs, comprehensively improves semantic aggregation and interactive response, ensures global layout stability and drawing efficiency, and enhances the visualization effect of knowledge graphs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120832941A_ABST
    Figure CN120832941A_ABST
Patent Text Reader

Abstract

The invention provides a large-scale knowledge graph visualization method and system, and relates to the field of knowledge graph visualization. The method comprises the following steps: acquiring knowledge graph data, and clustering the knowledge graph data through a modularity-based discovery algorithm; obtaining each sub-graph corresponding to the clustered knowledge graph data, and for each sub-graph, selecting a representative node based on a PageRank algorithm or a Leader Rank algorithm; carrying out force-oriented layout on the clustered knowledge graph data through a tree diagram space filling technology; and for the knowledge graph data subjected to the force-oriented layout, distributing priorities and use times of a Barnes-Hut algorithm and a random vertex sampling algorithm according to a preset mode, and dynamically displaying a visualization result in a layered manner through an affine transformation technology. According to the method and the device, the problem that the structural expression clarity of the drawn knowledge graph is greatly reduced due to the fact that semantic clusters and hierarchical organizations in the graph are difficult to accurately present in a traditional visualization method is solved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of knowledge graph visualization, and in particular to a large-scale knowledge graph visualization method and system. BACKGROUND

[0002] The current development of visualized knowledge graphs presents a multi-element trend of integrating intelligent algorithms, emphasizing interactive experience and improving scalability. Early knowledge graph visualization mainly relies on static graph structure display, often using a node-edge model for overall drawing, which is suitable for small-scale graphs but difficult to handle entity-intensive and semantically complex large-scale data.

[0003] When displaying large-scale knowledge graph data, traditional visualization methods that lack structure layering and semantic abstraction mechanisms cannot effectively compress the size of the graph, resulting in information overload in the graph, making it difficult to accurately present semantic clustering and hierarchical organization in the graph, and ultimately leading to a significant reduction in the clarity of the structure expression of the completed knowledge graph, severely affecting the interactive experience of users in the visualization display.

[0004] Therefore, there is an urgent need for a large-scale knowledge graph visualization method and system. SUMMARY

[0005] The present application provides a large-scale knowledge graph visualization method and system, which solves the problem that traditional visualization methods cannot accurately present semantic clustering and hierarchical organization in the graph, and ultimately lead to a significant reduction in the clarity of the structure expression of the completed knowledge graph.

[0006] In a first aspect of the present application, a large-scale knowledge graph visualization method is provided, the method comprising: obtaining knowledge graph data and clustering the knowledge graph data based on a modularity-based discovery algorithm; obtaining each subgraph corresponding to the clustered knowledge graph data, and for each subgraph, selecting a representative node based on a PageRank algorithm or a LeaderRank algorithm; performing force-directed layout on the clustered knowledge graph data using a tree graph space filling technique; for the force-directed layout knowledge graph data, assigning the priority and usage frequency of the Barnes-Hut algorithm and the random vertex sampling algorithm in a predetermined manner, and dynamically layering the visualization results using affine transformation technology.

[0007] Optionally, the knowledge graph data is clustered by a modularity-based discovery algorithm, specifically including: S11, for each node in the knowledge graph data, obtaining a target node, and traversing all neighbor nodes corresponding to the target node, the target node being any node in each node; S12, calculating the modularity benefit brought by adding the target node to each neighbor node corresponding to the target node; S13, adding the target node to the target community based on the modularity benefit, the target community being the community in which the neighbor node corresponding to the maximum modularity benefit is located; S14, repeating steps S11 to S13 until the community attribution of each node in the knowledge graph data no longer changes.

[0008] Optionally, before selecting a representative node for each subgraph based on the PageRank algorithm or the LeaderRank algorithm, the method further includes: dividing the knowledge graph data into a plurality of subgraphs by the Louvain algorithm; obtaining a target subgraph in the plurality of subgraphs, the target subgraph being any subgraph in the plurality of subgraphs; determining whether a data size value corresponding to the target subgraph is greater than an expected value; if the data size value is greater than the expected value, performing subgraph iteration on the data size value corresponding to the target subgraph until the data size value is less than or equal to the expected value.

[0009] Optionally, for each subgraph, a representative node is selected based on the LeaderRank algorithm, specifically including: setting the community in the knowledge graph data as a community node by using a virtual node with only community information; calculating the LeaderRank value of each community node in the corresponding community, and taking the community node corresponding to the maximum LeaderRank value as the representative node.

[0010] Optionally, for the knowledge graph data after clustering, force-directed layout is performed by tree graph space filling technology, specifically including: based on the hierarchical architecture formed between the representative nodes, obtaining the subordinate relationship in the knowledge graph data; and in an iterative manner, the subordinate relationship is displayed in the form of a nested rectangle.

[0011] Optionally, for the knowledge graph data after force-directed layout, the priority and usage frequency of the Barnes-Hut algorithm and the random vertex sampling algorithm are allocated in a preset manner, and the visualization result is dynamically layered displayed by the affine transformation technology, specifically including: using the shuffling algorithm and the random vertex sampling algorithm to optimize the repulsion force algorithm in the visualization framework; completing fast rendering by the random vertex sampling algorithm, and introducing the Barnes-Hut algorithm to improve the layout quality of the force-directed layout; based on the optimized repulsion force algorithm and the affine transformation technology, the visualization result is dynamically layered displayed.

[0012] Optionally, the hierarchical display of the visualization result includes a display of the force-directed graph, and the method further includes: binding an event for each node in the force-directed graph, and performing a first operation, the first operation including displaying or hiding adjacent nodes and displaying node details; binding a mouse zoom event for the force-directed graph, and performing a second operation, the second operation including a zoom-in operation and a zoom-out operation; the zoom-in operation is to zoom in on the knowledge graph data to display node data and edge data in the knowledge graph data; and the zoom-out operation is to zoom out on the knowledge graph data to hide the node data and the edge data in the knowledge graph data.

[0013] Optionally, the hierarchical display of the visualization result is dynamically performed through the affine transformation technique, and specifically includes: optimizing data update through d3 data binding, and using d3.select or d3.selectAll in combination with d3.attr to hide node data and edge data in the process of force-directed layout; and optimizing node display through the affine transformation technique, and hiding node data and edge data that are not in the view.

[0014] In a second aspect of the present application, a large-scale knowledge graph visualization system is provided, and the system includes an acquisition module and a processing module, wherein, The acquisition module is configured to acquire knowledge graph data, and perform clustering on the knowledge graph data through a modularity-based discovery algorithm; acquire each subgraph corresponding to the clustered knowledge graph data, and select a representative node for each subgraph based on a PageRank algorithm or a LeaderRank algorithm.

[0015] The processing module is configured to perform force-directed layout on the clustered knowledge graph data through a tree graph space filling technique; assign priority and usage frequency of a Barnes-Hut algorithm and a random vertex sampling algorithm to the knowledge graph data after the force-directed layout in a preset manner, and dynamically perform hierarchical display of the visualization result through the affine transformation technique.

[0016] In a third aspect of the present application, an electronic device is provided, including a processor, a memory, a user interface, and a network interface, the memory is configured to store instructions, the user interface and the network interface are configured to communicate with other devices, and the processor is configured to execute the instructions stored in the memory to enable the electronic device to perform the method of any one of the above aspects.

[0017] In a fourth aspect of the present application, a computer-readable storage medium is provided, and the computer-readable storage medium stores a computer program, and the computer program is executed by a processor to perform the method of any one of the above aspects.

[0018] The one or more technical solutions provided in the embodiments of the present application have at least the following technical effects or advantages: 1. Obtain knowledge graph data, and cluster the knowledge graph data by a modularity-based discovery algorithm; obtain each subgraph corresponding to the clustered knowledge graph data, and for each subgraph, select a representative node based on a PageRank algorithm or a LeaderRank algorithm; perform force-directed layout on the clustered knowledge graph data by tree map space filling technology; for the knowledge graph data after force-directed layout, assign priority and usage frequency of Barnes-Hut algorithm and random vertex sampling algorithm according to a preset manner, and dynamically display the visualization result by affine transformation technology, so as to effectively improve the comprehensive performance of large-scale knowledge graph in structure expression, semantic aggregation and interactive response under the premise of ensuring global layout stability and drawing efficiency, and realize high-performance knowledge graph visualization display with clear structure level, controllable local details and adaptive view complexity.

[0019] 2. Perform force-directed layout by tree map space filling technology, specifically including: obtaining the subordinate relationship in the knowledge graph data based on the hierarchical architecture formed between the representative nodes; and presenting the subordinate relationship in the form of nested rectangles in an iterative manner according to different levels, so as to construct a top-down hierarchical visual structure without destroying the original topological relationship between nodes, significantly improve the spatial recognition of semantic levels and the readability of node attribution in the knowledge graph, and enable the large-scale graph to have clear hierarchical organization logic and clustering display effect while maintaining global consistency, thereby enhancing the structure expression capability of the visualization system and the cognitive efficiency of the user.

[0020] 3. Optimize the repulsion force algorithm in the visualization framework using a shuffle algorithm and a random vertex sampling algorithm; complete fast rendering by the random vertex sampling algorithm, and introduce Barnes-Hut algorithm to improve the layout quality of force-directed layout; dynamically display the visualization result based on the optimized repulsion force algorithm and affine transformation technology, so as to realize approximate solution and dynamic controllable rendering of the repulsion relationship between nodes in the large-scale knowledge graph while maintaining interactive real-time and system response speed, significantly reduce the complexity of force-directed calculation, improve the balance of node distribution and the operability of local view, and ensure that the visualization system has multiple technical advantages of flexible hierarchical expansion, rich local details and clear overall structure. BRIEF DESCRIPTION OF DRAWINGS

[0021] Figure 1 is a flowchart of a large-scale knowledge graph visualization method and system provided by an embodiment of the present application; Figure 2 is a Louvain community partition result diagram provided by an embodiment of the present application; Figure 3A Louvain and LeaderRank fusion-based representative node selection process schematic diagram provided by an embodiment of the present application; Figure 4 A topology simplification-based layout quality optimization schematic diagram provided by an embodiment of the present application; Figure 5 A knowledge graph node visualization processing flow schematic diagram provided by an embodiment of the present application; Figure 6 A module schematic diagram of a large-scale knowledge graph visualization system provided by an embodiment of the present application; Figure 7 A structure schematic diagram of an electronic device provided by an embodiment of the present application.

[0022] Label explanation: 61, acquisition module; 62, processing module; 701, processor; 702, communication bus; 703, user interface; 704, network interface; 705, memory. DETAILED DESCRIPTION

[0023] In order for those skilled in the art to better understand the technical solutions in the specification, the technical solutions in the specification will be clearly and completely described below in conjunction with the drawings in the embodiments of the specification. Obviously, the described embodiments are only some of the embodiments of the present application, not all.

[0024] The terms used in the following embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to be limiting to the present application. As used in the specification of the present application, the singular expression "one", "a", "said", "the above", "the" and "this" are intended to also include the plural expression, unless there is clear indication to the contrary in the context. It should also be understood that the term "and / or" used in the present application means any or all possible combinations of one or more listed items.

[0025] Hereinafter, the terms "first", "second" are only for the purpose of description, and cannot be understood as implying or implying relative importance or implicitly indicating the number of indicated technical features. Therefore, the features defined with "first", "second" can explicitly or implicitly include one or more of the features, and in the description of the embodiments of the present application, unless otherwise specified, the meaning of "multiple" is two or more.

[0026] In order for those skilled in the art to better understand the technical solutions of the present application, the present application will be further described in conjunction with the drawings.

[0027] Please refer to Figure 1Fig. 1 shows a flowchart of a large-scale knowledge graph visualization method according to an embodiment of the present application, which mainly includes the following steps: S101-S104.

[0028] In step S101, knowledge graph data is obtained, and a modularity-based discovery algorithm is used to cluster the knowledge graph data.

[0029] Specifically, the force-directed algorithm is one of the most widely used algorithms in graph layout algorithms. It can be traced back to the graph layout algorithm based on the centroid model proposed by Trutte in 1961, and was formally proposed by Eades in 1984. In the force-directed layout algorithm based on the spring model, nodes are regarded as steel rings, and edges representing relationships are regarded as springs. Each node is subject to the attractive force of the spring and the repulsive force of other unconnected nodes. In the embodiments of the present application, the "knowledge graph data" refers to a data set composed of multiple entity nodes and semantic relationship edges between them. Each piece of data is usually represented in the form of a triple, including a subject node, a predicate relationship, and an object node. This data structure essentially constitutes a heterogeneous graph, in which nodes can represent specific entities or concepts, and edges represent different types of relationships, with sparsity and diversity characteristics. Structured processing of this type of data is the basis for visual expression and interactive analysis. "Clustering" refers to the process of grouping nodes that are structurally or semantically closely related into the same group to form several node collections that have high correlation in internal structure and are relatively loose in external connection. This processing not only reduces the complexity of the original graph, but also provides a basic abstraction unit for constructing higher-level expression structures. Through clustering, fine-grained nodes in the original knowledge graph can be assigned to several larger-grained communities, so that they can be compressed, replaced, or uniformly represented in subsequent visualization. "Modularity" is an important indicator for measuring the rationality of the structure of the clustering result, which essentially measures whether the connection between nodes within the same cluster is significantly higher than that in the random connection case. The higher the modularity, the more boundary and independence the clustered structure has in the overall graph, which is suitable for expressing subgraphs with consistent semantics or clear structural attribution. The use of this indicator helps to ensure the representativeness of the representative nodes and the interpretability of the global structure.

[0030] Step S101 is the starting point of the construction of the subsequent visualization system. By clustering and dividing the original knowledge graph data, a community system with clear boundaries and structural levels is constructed, providing a basic semantic unit and structural framework for the extraction of representative nodes, the construction of hierarchical relationships, and the tree-shaped graph nested layout. It is the core prerequisite processing step for realizing clear and visual expression of the structural levels of the knowledge graph.

[0031] In a possible implementation, step S101 further includes the following steps, S11 to S14.

[0032] Step S11: For each node in the knowledge graph data, obtain the target node and traverse all neighbor nodes corresponding to the target node. The target node is any node in each of the nodes.

[0033] Specifically, community detection algorithms are primarily used to discover community structures in networks. These include traditional clustering methods centered around graph segmentation and clustering, spectral methods, modularity-based methods, and dynamic algorithms based on random walks. In research on force-directed algorithms for multi-scale layout, Walshaw used a coarsened vertex matching algorithm for partitioning, David Harel simplified the layout by merging adjacent nodes, Martin divided the graph into modules corresponding to clusters for node clustering, Zhao et al. performed hierarchical layout based on graph matching, and Tang et al. used hierarchical visual abstraction based on topology and betweenness centrality to complete graph clustering. The clustering algorithms used in these studies either had high clustering time complexity or sacrificed accuracy due to the high time complexity of force-directed layout. Considering both algorithm time efficiency and clustering accuracy, this application selected the Louvain algorithm to cluster the data.

[0034] In step S11, the Louvain algorithm is a community discovery algorithm based on modularity. Its optimization goal is to maximize the modularity of the entire data. The calculation of modularity is shown in the following formula:

[0035] in, is the modularity value, is the total number of edges in the community graph, Indicates all The sum of the edge weights of the target nodes, Indicates all The sum of the edge weights of the target nodes, Indicates the The first and The edge weights between target nodes, To judge the The first and Whether the target nodes are in the same community, the value is 1 or 0.

[0036] The simplified calculation is shown below:

[0037] in, Indicates the The sum of the edges in the target communities, Indicates the The sum of the number of nodes in the target communities.

[0038] Step S12: Calculate the modularity benefit brought by adding the target node to the community where each of its corresponding neighbor nodes is located.

[0039] Specifically, through the algorithm in step S11, each target node is set as an independent community, and the edge weight within the community is set to 0 as initialization. For each target node in the knowledge graph data, all neighboring nodes of the target node are traversed, and the target node is added to the community where its neighboring nodes are located. The modularity benefits before and after the addition are measured. The calculation formula is shown below:

[0040] in, is the modularity benefit value, that is, the modularity benefit brought by the target node before and after joining its neighbor nodes.

[0041] S13: Add the target node to a target community based on the modularity gain, where the target community is the community where the neighbor node corresponding to the maximum modularity gain is located.

[0042] The simplified formula is as follows:

[0043] in, It is The target node and The sum of the number of connections between nodes in the target community is calculated, and the neighbor node with the maximum benefit is selected to join its community.

[0044] S14, repeating steps S11 to S13 until the community affiliation corresponding to each node in the knowledge graph data no longer changes.

[0045] Step S102: Obtain each subgraph corresponding to the knowledge graph data after clustering, and select a representative node for each subgraph based on the PageRank algorithm or the LeaderRank algorithm.

[0046] Specifically, the process of treating communities as nodes can use virtual nodes that only carry community information, or use PageRank or LeaderRank algorithms to rank the importance of community nodes and select core nodes to represent the community.

[0047] In a possible implementation, step S102 further includes: dividing the knowledge graph data into a plurality of subgraphs by using a Louvain algorithm; obtaining a target subgraph in the plurality of subgraphs, the target subgraph being any subgraph in the plurality of subgraphs; determining whether a data size value corresponding to the target subgraph is greater than an expected value; and if the data size value is greater than the expected value, performing subgraph iteration on the data size value corresponding to the target subgraph until the data size value is less than or equal to the expected value.

[0048] For the graph , it is divided into a series of smaller graphs by using a Louvain algorithm, that is, the knowledge graph data is divided into a plurality of subgraphs , K is the total number of subgraphs. If any target subgraph size exceeds the expectation, that is, the data size value is greater than the expected value, the data size value corresponding to the target subgraph is iterated by using a subgraph until the data size value is less than or equal to the expected value. The division result is shown in Figure 2 , Figure 2 is a Louvain community division result diagram provided by an embodiment of the present application.

[0049] In a possible implementation, the step further includes: setting a community in the knowledge graph data as a community node by using a virtual node with only community information; calculating a LeaderRank value of each community node in the corresponding community, and taking the community node corresponding to the maximum LeaderRank value as the representative node.

[0050] Specifically, refer to Figure 3 , which shows a representative node selection process diagram based on the fusion of Louvain and LeaderRank provided by an embodiment of the present application. In the diagram, a representative node is selected based on a PageRank algorithm or a LeaderRank algorithm, and after hierarchical clustering is completed, the graph is simplified to , in which is composed of representative nodes of each subgraph , the relationship between these nodes is . When a user enters a visualization interface, only the data of the highest level needs to be displayed, and the overview and detail information of the graph are dynamically displayed through zooming and panning interaction.

[0051] The force-directed algorithm is used to draw the graph Since the time complexity of collision detection for repulsive force calculation in traditional force-directed algorithm is too high, the force-directed algorithm based on BH approximation provided by d3 is used for collision detection. The implementation module of spring stress in d3 is d3.forceLink (connection force), and the implementation formula is as follows:

[0052] Among them, represents the connection force, represents the actual distance between nodes, represents the length of the configured edge, and are constants, respectively representing the strength of the connection force and the "cooling" parameter, is set to 1. When maintaining a certain distance, the connection force is 0, when exceeding the set length, the connection force will pull the nodes inward, and vice versa, the nodes will be repelled like spring compression. represents the coordinate difference of the node in the x direction, represents the coordinate difference of the node in the y direction.

[0053] The implementation module of Coulomb force calculation in d3 is d3.forceManyBody (N-body force), and the implementation formula is as follows:

[0054]

[0055] Among them, is the x direction component of the repulsive force between nodes, is the y direction component of the repulsive force between nodes, represents the charge repulsion strength of the vertex . In addition to the connection force and N-body force, the following mechanical modules are used for force-directed layout: collision force (Collision), which is used to set a circular collision area for each node to avoid node overlap; direction force (Positioning), some force-directed systems use centering force (Centering) here, which makes the node layout always around a certain center, which will produce a certain tearing feeling in the folding and unfolding interaction of the node. Using direction force can limit the action of force to one dimension, which has a better performance effect. All the above forces will be added to the d3.forceSimulation force simulation, and the simulation.tick() function is controlled to constantly update the control of nodes and edges.

[0056] In step S103, the knowledge graph data after clustering is subjected to force-directed layout through tree map space filling technology.

[0057] Specifically, for the drawing of FIG. In order to maximize the use of the visualization area, the tree map space filling technique is used to complete the overall layout due to the low utilization of the force-directed layout space.

[0058] In a possible implementation, the step S103 further includes: obtaining the subordinate relationship in the knowledge graph data based on the hierarchical architecture formed between the representative nodes; and displaying the subordinate relationship in the form of nested rectangles in an iterative manner according to different levels.

[0059] Specifically, in the treemap, the hierarchical architecture displays the subordinate relationship in the form of nested rectangles in an iterative manner according to different levels, so as to achieve the best space use efficiency, which can effectively utilize the display area and implicitly provide the structural information, and provide the overall view of the entire hierarchical structure, allowing the user to more quickly navigate to any position in the space. The pseudo code is shown in Table 1.

[0060] [Table 1]

[0061] The overall flow is shown in FIG. 1. Figure 4 which shows a layout quality optimization diagram based on topology simplification provided by the embodiment.

[0062] In step S104, the priority and the number of uses of the Barnes-Hut algorithm and the random vertex sampling algorithm are allocated in a preset manner for the knowledge graph data after the force-directed layout, and the visualization result is dynamically layered and displayed through the affine transformation technology.

[0063] Specifically, on the premise of ensuring the layout quality, the rendering efficiency of the drawing of the knowledge graph data in the front end is also an important part of the user interaction experience. Based on this, step S104 proposes further improvements through the analysis of two existing efficiency optimization algorithms, and performs related optimization on the page display of the force-directed layout through the related knowledge of web page rendering. Since the visualization framework used in this paper is d3.js, the implementation of the force-directed algorithm is based on the quadtree Barnes-Hut approximation algorithm, and the optimization target proposed in this application is also proposed for this algorithm.

[0064] To cope with the complex collision detection and repulsion force calculation load generated by large-scale node data in the force-directed layout process, step S104 introduces two types of strategies in the iterative update process of node position: one is the random vertex sampling algorithm, and the other is the Barnes-Hut approximation algorithm. Among them, the random vertex sampling is used to quickly obtain the approximate repulsion force value in the early iteration stage, and by calculating only a part of representative samples in each iteration, the single round calculation amount is significantly reduced, thereby quickly generating an initial layout sketch of the graph; and the Barnes-Hut algorithm is used as a global optimization means of approximate repulsion, and a quadtree structure is introduced to group and aggregate nodes in space, and a merged quality factor is used to approximate the repulsive effect between nodes in areas with high node density, so as to complete the late position convergence refinement with the complexity of O(n log n). The cooperative use of the two through the preset round threshold and repulsion error index is dynamically distributed, the sampling priority strategy is used in the early stage to accelerate the graph expansion, the Barnes-Hut algorithm is introduced in the later stage to strengthen the local stability and structural clarity, and finally the generated force-directed graph has both efficiency and structural readability.

[0065] Secondly, in the page end presentation, combined with the graph rendering mechanism of d3.js, step S104 further introduces affine transformation technology and hierarchical view management strategy to realize dynamic hierarchical display and local rendering optimization of the force-directed graph. In specific implementation, based on the hierarchical abstract structure composed of representative nodes, different granularity community division levels are indexed and mapped, the display scale, position translation and rotation direction of each layer are controlled through affine transformation, and interactive operations such as focus zooming, level switching and clustering display of large-scale data graph are realized. When the page zoom scale is in the global view mode, only the representative nodes and the abstract relationship between them are presented to reduce the rendering load; when the user focuses on a community or node area, the reverse affine transformation is used to expand the included sub-nodes, and the local sub-graph is dynamically reconstructed to ensure the dynamic unity of browsing efficiency and structural expression.

[0066] In summary, step S104 realizes the high-performance, interactive and multi-level visualization layout of large-scale knowledge graph by fine division and dynamic calling of force-directed calculation performance optimization strategies, combined with the coordinate transformation and hierarchical loading capability of the visualization framework, and on the basis of ensuring clear expression of structural levels. This method is particularly suitable for Web front-end visual systems built based on d3.js.

[0067] In a possible implementation, step S104 further includes: presetting a manner of optimizing the repulsion force algorithm in the visualization framework using a shuffle algorithm and the random vertex sampling algorithm; completing fast rendering through the random vertex sampling algorithm, and introducing the Barnes-Hut algorithm to improve layout quality of the force-directed layout; and dynamically layering and displaying the visualization result based on the optimized repulsion force algorithm and the affine transformation technique.

[0068] Specifically, the manner is preset to optimize the repulsion force algorithm in the visualization framework using a shuffle algorithm and the random vertex sampling algorithm; fast rendering is completed through the random vertex sampling algorithm, and the Barnes-Hut algorithm is introduced to improve layout quality of the force-directed layout; and the visualization result is dynamically layered and displayed based on the optimized repulsion force algorithm and the affine transformation technique.

[0069] Specifically, in the present application, random selection of vertices adopts a shuffle algorithm (Fisher-Yates Shuffle) with a time complexity of , which randomly selects integers from an array with a length of , and the pseudo code is shown in Table 2.

[0070] [Table 2]

[0071] For each node u ∈ U that needs to update position information, a node set is selected using the shuffle algorithm to calculate repulsion force, and the algorithm pseudo code is shown in Table 3.

[0072] [Table 3]

[0073] Since RVS alone is not enough to generate a good enough quality layout, Robert introduces a constant size "neighbor" vertex list for each node to help the algorithm to expand the graph components from the initial position at the beginning, and to make the layout of the entire graph more compact at the end of the layout, and the pseudo code is shown in Table 4.

[0074] [Table 4]

[0075] In the above algorithm, the function updateVelocity(u, n) represents that the node u updates its position using the repulsion force generated by the node r, and the update formula is as follows:

[0076]

[0077]

[0078]

[0079]

[0080]

[0081] wherein, is a parameter for compensating the repulsive force calculated only on a small number of vertices, is a current velocity component in x of a node is a current velocity component in y of a node is a current velocity component in x of a node is a current velocity component in y of a node is a target node position coordinate, is a source node position coordinate.

[0082] Compared with the traditional force-directed algorithm, the random vertex sampling algorithm has greatly improved the layout efficiency, but the layout quality is slightly decreased. Using BH approximation can guarantee the layout quality of the graph atlas, and based on the two algorithms, the present application studies the iteration number distribution scheme to make the layout time and quality of the graph atlas achieve the best comprehensive performance.

[0083] In a possible implementation, the step S104 further includes: binding an event for each node in the force-directed graph, performing a first operation, the first operation including displaying or hiding adjacent nodes and displaying node details; performing a second operation for a mouse zoom event in the force-directed graph, the second operation including a zoom-in operation and a zoom-out operation; the zoom-in operation is to zoom in the knowledge graph data to display node data and edge data in the knowledge graph data; the zoom-out operation is to zoom out the knowledge graph data to hide the node data and the edge data in the knowledge graph data.

[0084] Specifically, on the basis that the visualization layout has been completed, an event listener is bound for each node in the force-directed graph to realize the first operation when the node is interacted. The operation includes two aspects: one is that when a user clicks on a node, the adjacent nodes of the node are dynamically displayed or hidden, and the other is that the detailed attribute information of the clicked node is synchronously displayed. The core role of the mechanism is to avoid the overload of initial view information, load only the local structure related to the specific semantic point when the user focuses on the specific semantic point, and thus support the local expansion of the graph in a structured and controllable manner. In the embodiment of the present application, the on-demand display and hiding mechanism combines an event binding function (such as d3.select().on()) and an adjacency table retrieval based on the current node index, and the explicit state adjustment of the node can be realized by incremental update rendering set to ensure that the local visibility is enhanced while maintaining the stability of the overall graph layout.

[0085] Further, to improve the switchable control of the user over the global and local structures, a mouse zooming event of the view is also monitored and responded, and a second operation is correspondingly performed. The zoom-in operation refers to that when the user zooms in the current graph view, the lower nodes and edges compressed by the original abstract representative nodes are displayed according to the graph density and community hierarchical structure of the current view focus area, and the structure is expanded in a fine-grained manner. In the present application, the scaling ratio of the force-directed layout in d3.js is controlled through affine transformation, and the hierarchical conditional loading is realized in combination with the community label of Louvain clustering and the LeaderRank representative node index, so as to ensure that each zoom-in operation is directed to a subgraph with a clear semantic boundary. In contrast, the zoom-out operation refers to that when the user zooms out the graph view to a level or above, the lower sub-nodes and edge connections contained in the representative nodes are actively hidden to retain a simple abstract view and avoid the rendering performance degradation and cognitive interference caused by the over-dense structure. The zooming dynamic display and hiding mechanism essentially constitutes a real-time reversible projection on the "structure hierarchical mapping" based on the representative nodes.

[0086] In a possible implementation, the step S104 further includes: optimizing data update through d3 data binding, and using d3.select or d3.selectAll in combination with d3.attr to hide the node data and the edge data in the process of the force-directed layout; and optimizing node display through the affine transformation technique, and hiding the node data and the edge data not in the view.

[0087] Specifically, the page rendering time is different from the running time of the force-directed algorithm. For the d3-based visualization drawing, it mainly depends on the rendering and redrawing of the SVG element, and if the nodes and edges are appropriately hidden using d3.select or d3.selectAll in combination with d3.attr in the layout process, the drawing efficiency can be improved to a certain extent.

[0088] In the process of user scaling, dragging and panning the events bound to each node in the force-directed graph, the positions of some nodes and edges will be out of the visible range of the visualization interface. The rendering and redrawing of these SVG elements will consume some resources, and need to be hidden. The SVG element positions calculated by the force-directed algorithm used in this application cannot be directly used to determine whether they need to be hidden. The relative coordinates of the SVG elements relative to the visualization area need to be obtained through a simple affine transformation. Let the node coordinates calculated according to the force-directed algorithm be , the scaling factor be , the affine transformation coordinates set by d3 itself for the svg canvas tag (event.transform.x and event.transform.y in the code) be rx, ry , and the starting offset of the svg.viewbox (viewbox) be , the relative coordinates of the SVG elements relative to the visualization area be x, y .

[0089] When x, y is out of the display range, the nodes are hidden using CSS properties. In addition, if the layout data is saved in the server, the display of the nodes is performed through the creation and destruction of DOM nodes.

[0090] Finally, please refer to Figure 5 , which shows a knowledge graph node visualization processing flowchart provided by an embodiment of the application. The chart shows the complete process of knowledge graph data from loading, d3.js parameter configuration, Fisher-Yates sampling optimization, to node edge layout calculation, visualization rendering and node interaction listening, emphasizing the technical path of efficient visualization through random vertex sampling and node / edge dynamic display control.

[0091] Please refer to Figure 6 , which shows a module diagram of a large-scale knowledge graph visualization system provided by an embodiment of the application. The system includes an acquisition module 61 and a processing module 62, wherein The acquisition module 61 is configured to acquire knowledge graph data, and perform clustering on the knowledge graph data based on a modularity-based discovery algorithm; acquire each subgraph corresponding to the knowledge graph data after clustering, and select a representative node for each subgraph based on a PageRank algorithm or a LeaderRank algorithm.

[0092] The processing module 62 is configured to perform force-directed layout on the clustered knowledge graph data by using a tree graph space filling technique; and perform dynamic hierarchical display of a visualization result by using an affine transformation technique, in which the priority and the number of uses of the Barnes-Hut algorithm and the random vertex sampling algorithm are allocated to the knowledge graph data subjected to the force-directed layout in a preset manner.

[0093] In a possible implementation, the acquisition module 61 is configured to divide the knowledge graph data into a plurality of subgraphs by using the Louvain algorithm before selecting the representative nodes based on the PageRank algorithm or the LeaderRank algorithm, and to acquire a target subgraph from the plurality of subgraphs, the target subgraph being any subgraph in the plurality of subgraphs; and to determine whether a data size value corresponding to the target subgraph is greater than an expected value; and to perform subgraph iteration on the data size value corresponding to the target subgraph until the data size value is less than or equal to the expected value, if the data size value is greater than the expected value.

[0094] In a possible implementation, the acquisition module 61 is configured to cluster the knowledge graph data by using a modularity-based discovery algorithm, specifically including: S11, acquiring a target node from each node in the knowledge graph data, and traversing all neighbor nodes corresponding to the target node, the target node being any node in each node; S12, calculating a modularity benefit brought by adding the target node to a community in which each neighbor node is located; S13, adding the target node to a target community based on the modularity benefit, the target community being a community in which the neighbor node corresponding to the maximum modularity benefit is located; and S14, repeating steps S11 to S13 until the community attribution of each node in the knowledge graph data no longer changes.

[0095] In a possible implementation, the processing module 62 is configured to select the representative nodes based on the LeaderRank algorithm for each subgraph, specifically including: setting a community in the knowledge graph data as a community node by using a virtual node with only community information; calculating a LeaderRank value of each community node in the corresponding community, and taking a community node corresponding to the maximum LeaderRank value as the representative node.

[0096] In a possible implementation, the processing module 62 is configured to perform force-directed layout on the clustered knowledge graph data by using a tree graph space filling technique, specifically including: acquiring a subordinate relationship in the knowledge graph data based on a hierarchical architecture formed between the representative nodes; and displaying the subordinate relationship in the form of a nested rectangle in an iterative manner according to different hierarchies.

[0097] In a possible implementation, the processing module 62 is configured to assign priorities and usage times of the Barnes-Hut algorithm and the random vertex sampling algorithm to the knowledge graph data after force-directed layout in a preset manner, and display the visualization result in a dynamic hierarchical manner through the affine transformation technology, specifically including: optimizing the repulsion force algorithm in the visualization framework by using the shuffle algorithm and the random vertex sampling algorithm; completing fast rendering by using the random vertex sampling algorithm, and introducing the Barnes-Hut algorithm to improve the layout quality of the force-directed layout; and displaying the visualization result in a dynamic hierarchical manner based on the optimized repulsion force algorithm and the affine transformation technology.

[0098] In a possible implementation, the processing module 62 is configured to display the visualization result in a hierarchical manner including display of the force-directed graph, and the method further includes: binding an event to each node in the force-directed graph, and performing a first operation, the first operation including displaying or hiding adjacent nodes and displaying node details; performing a second operation for a mouse zoom event in the force-directed graph, the second operation including a zoom-in operation and a zoom-out operation; the zoom-in operation is to zoom in the knowledge graph data to display node data and edge data in the knowledge graph data; and the zoom-out operation is to zoom out the knowledge graph data to hide the node data and the edge data in the knowledge graph data.

[0099] In a possible implementation, the processing module 62 is configured to display the visualization result in a dynamic hierarchical manner through the affine transformation technology, specifically including: optimizing data update by using the d3 data binding, and using d3.select or d3.selectAll in combination with d3.attr to hide node data and edge data during the force-directed layout; and optimizing node display through the affine transformation technology, and hiding node data and edge data that are not in the view.

[0100] It should be noted that the system provided in the above embodiments is used to implement its functions, and the above division of functional modules is used as an example. In actual applications, the above functions can be completed by different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules to complete all or part of the above described functions. In addition, the system and method embodiments provided in the above embodiments belong to the same concept, and the specific implementation process is described in the method embodiments, which will not be repeated here.

[0101] The present application also provides an electronic device. Referring to Figure 7 , Figure 7 is a structural schematic diagram of an electronic device provided by an embodiment of the present application. The electronic device can include at least one processor 701, at least one communication bus 702, a user interface 703, at least one network interface 704, and a memory 705.

[0102] The communication bus 702 is configured to realize the connection communication between the components.

[0103] The user interface 703 can include a display and a camera. Optionally, the user interface 703 can further include a standard wired interface and a wireless interface.

[0104] The network interface 704 can include a standard wired interface and a wireless interface (e.g., a WI-FI interface).

[0105] The processor 701 can include one or more processing cores. The processor 701 is connected to various parts of the server through various interfaces and lines, and performs various functions of the server and processes data by running or executing instructions, programs, code sets or instruction sets stored in the memory 705, and calling data stored in the memory 705. Optionally, the processor 701 can be implemented in at least one of a digital signal processing (DSP), a field-programmable gate array (FPGA), and a programmable logic array (PLA). The processor 701 can be integrated with a combination of one or more of a central processing unit (CPU), a graphics processing unit (GPU), and a modem. The CPU is mainly used to process an operating system, a user interface, and an application program. The GPU is used to render and draw the content to be displayed on the display. The modem is used to process wireless communication. It can be understood that the above-mentioned modem can also not be integrated into the processor 701, but can be implemented by a separate chip.

[0106] The memory 705 can include a Random Access Memory (RAM) and can also include a Read-Only Memory (ROM). Optionally, the memory 705 includes a non-transitory computer-readable storage medium. The memory 705 can be used to store instructions, programs, codes, code sets, or instruction sets. The memory 705 can include a program storage area and a data storage area, where the program storage area can store instructions for implementing an operating system, instructions for at least one function (such as a touch function, a sound playing function, an image playing function, etc.), instructions for implementing the various method embodiments described above, etc.; the data storage area can store data involved in the various method embodiments described above, etc. The memory 705 can also be at least one storage system located away from the aforementioned processor 701. For reference Figure 7 The memory 705 as a computer storage medium can include an operating system, a network communication module, a user interface module, and a large-scale knowledge graph visualization application program.

[0107] In Figure 7 In the electronic device shown in FIG. 7, the user interface 703 is mainly used to provide an interface for user input and obtain data input by the user; and the processor 701 can be used to call the large-scale knowledge graph visualization application program stored in the memory 705, and when executed by one or more processors 701, cause the electronic device to perform the method described in one or more of the above embodiments. It should be noted that, for the above-mentioned method embodiments, in order to simply describe, they are all expressed as a combination of a series of actions, but those skilled in the art should know that the application is not limited by the described action sequence, because according to the application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should know that the embodiments described in the specification all belong to preferred embodiments, and the actions and modules involved are not necessarily required by the application.

[0108] The application also provides a computer-readable storage medium, which stores instructions. When executed by one or more processors, the electronic device performs the method described in one or more of the above embodiments.

[0109] In the above embodiments, the description of each embodiment has its own focus, and the parts not described in detail in a certain embodiment can be referred to the relevant description of other embodiments.

[0110] In several embodiments provided in the present application, it should be understood that the disclosed system can be implemented in other manners. For example, the division of the system embodiments described above is merely an example, and the division of the units can be different, for example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the display or discussion of the coupling or direct coupling or communication connection between the units can be indirect coupling or communication connection through some interfaces, and can be in electrical or other forms.

[0111] The units described as separated components can or can not be physically separated, and the components displayed as units can or can not be physical units, i.e., can be located in one place or can be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purposes of the embodiments of the present application.

[0112] In addition, each functional unit in the embodiments of the present application can be integrated in one processing unit, or each unit can be a physically independent unit, or two or more units can be integrated in one unit. The integrated unit can be implemented in the form of hardware or in the form of a software functional unit.

[0113] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer readable storage medium. Based on such an understanding, the technical solutions of the present application essentially or the part that contributes to the prior art or the whole or part of the technical solutions can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods in the embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, magnetic disk or optical disk, and various media that can store program codes.

[0114] The above description is only exemplary embodiments of the present application, and cannot limit the scope of the present application. Any equivalent changes and modifications made according to the teachings of the present application are still within the scope of the present application.

[0115] The present application is intended to cover any variations, uses, or adaptive changes of the present application, which follow the general principles of the present application and include common knowledge or conventional technical means in the technical field of the present application not disclosed in the present application.

Claims

1. A method for large-scale knowledge graph visualization, characterized in that, The method comprises: acquiring knowledge graph data and clustering the knowledge graph data by a modularity-based discovery algorithm; acquiring each subgraph corresponding to the knowledge graph data after clustering, and for each subgraph, selecting a representative node based on a PageRank algorithm or a LeaderRank algorithm; performing force-directed layout on the knowledge graph data after clustering by a tree graph space filling technique; for the knowledge graph data after force-directed layout, assigning priority and usage frequency of a Barnes-Hut algorithm and a random vertex sampling algorithm in a preset manner, and dynamically layering and displaying a visualization result by an affine transformation technique.

2. The method of claim 1, wherein, The clustering of the knowledge graph data by the modularity-based discovery algorithm specifically comprises: S11, for each node in the knowledge graph data, acquiring a target node and traversing all neighbor nodes corresponding to the target node, the target node being any node in each node; S12, calculating the modularity benefit brought by adding the target node to each neighbor node in the community; S13, adding the target node to a target community based on the modularity benefit, the target community being the community where the neighbor node corresponding to the maximum modularity benefit is located; S14, repeating steps S11 to S13 until the community attribution of each node in the knowledge graph data no longer changes.

3. The method of claim 1, wherein, Before the acquiring of each subgraph corresponding to the knowledge graph data after clustering and the selection of a representative node for each subgraph based on a PageRank algorithm or a LeaderRank algorithm, the method further comprises: dividing the knowledge graph data into a plurality of subgraphs by a Louvain algorithm; acquiring a target subgraph in the plurality of subgraphs, the target subgraph being any subgraph in the plurality of subgraphs; judging whether a data size value corresponding to the target subgraph is greater than an expected value; if the data size value is greater than the expected value, performing subgraph iteration on the data size value corresponding to the target subgraph until the data size value is less than or equal to the expected value.

4. The method of claim 1, wherein, For each subgraph, the selection of a representative node based on a LeaderRank algorithm specifically comprises: setting a community in the knowledge graph data as a community node by using a virtual node with only community information; calculating a LeaderRank value of each community node in the corresponding community, and taking the community node corresponding to the maximum LeaderRank value as the representative node.

5. The method of claim 1, wherein, The force-directed layout of the knowledge graph data after clustering by a tree graph space filling technique specifically comprises: acquiring a subordinate relationship in the knowledge graph data based on a hierarchical architecture formed between the representative nodes; in an iterative manner, displaying the subordinate relationship in the form of a nested rectangle according to different hierarchical levels.

6. The method of claim 1, wherein, The method comprises the following steps: performing force-directed layout on the knowledge graph data, assigning priority and usage frequency of Barnes-Hut algorithm and random vertex sampling algorithm to the knowledge graph data according to a preset mode, and dynamically displaying a visualization result in layers by using affine transformation technology. The preset mode is to optimize a repulsion force algorithm in a visualization framework by using a shuffle algorithm and the random vertex sampling algorithm. The random vertex sampling algorithm is used for fast rendering, and the Barnes-Hut algorithm is introduced to improve the layout quality of the force-directed layout. The repulsion force algorithm and the affine transformation technology are used to dynamically display the visualization result in layers.

7. The method of claim 1, wherein, The method further comprises the following steps: Binding events to each node in the force-directed graph and performing a first operation, wherein the first operation comprises displaying or hiding adjacent nodes and displaying node details. Performing a second operation on a mouse zoom event in the force-directed graph, wherein the second operation comprises zoom-in operation and zoom-out operation. The zoom-in operation is to zoom in the knowledge graph data to display node data and edge data in the knowledge graph data. The zoom-out operation is to zoom out the knowledge graph data to hide the node data and the edge data in the knowledge graph data.

8. The method of claim 7, wherein, The method further comprises the following steps: Optimizing data update by using d3 data binding, and hiding the node data and the edge data in the process of the force-directed layout by using d3.select or d3.selectAll in combination with d3.attr. Optimizing node display by using the affine transformation technology, and hiding the node data and the edge data that are not in view.

9. A large scale knowledge graph visualization system, characterized in that, The system comprises an acquisition module and a processing module. The acquisition module is configured to acquire knowledge graph data, cluster the knowledge graph data by using a modularity-based discovery algorithm, acquire each subgraph corresponding to the clustered knowledge graph data, and select a representative node for each subgraph based on a PageRank algorithm or a LeaderRank algorithm. The processing module is configured to perform force-directed layout on the clustered knowledge graph data by using a tree graph space filling technology, assign priority and usage frequency of Barnes-Hut algorithm and random vertex sampling algorithm to the knowledge graph data according to a preset mode, and dynamically display a visualization result in layers by using affine transformation technology.

10. An electronic device, comprising: The electronic device comprises a processor, a communication bus, a user interface, a network interface, and a memory, wherein the memory is configured to store instructions, the user interface and the network interface are configured to communicate with other devices, and the processor is configured to execute the instructions stored in the memory to enable the electronic device to perform the method according to any one of claims 1 to 8.

Citation Information

Patent Citations

  • Method and system for large-scale knowledge graph visualization based on LPA algorithm

    CN111190966A

  • Page layout processing method and device

    CN111258575A

  • Knowledge graph visualization method based on force guidance

    CN113254670A

Cited By

  • Hierarchical progressive visualization method of nebula map for large-scale spatio-temporal knowledge graph

    CN121327205A

  • A nebula chart hierarchical progressive visualization method for large-scale spatiotemporal knowledge graph

    CN121327205B