A large-scale graph layout optimization method and system based on sparse negative sampling
Patent Information
- Application Number
- CN202611157673.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-31
- Publication Date
- 2026-10-16
AI Technical Summary
[0005]针对现有技术中大规模图布局存在的斥力计算复杂度高、辅助数据结构内存开销大、社区结构分离不清晰以及加权斥力容易导致簇内部过度扩张的问题,本发明提供一种基于稀疏负采样的大规模图布局优化方法及系统
兼具高质量社区分离、线性时间复杂度、低内存消耗及高并行效率。
Smart Images

Figure CN122926672A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of data visualization and graph computing technology, and in particular to a method and system for optimizing large-scale graph layouts based on sparse negative sampling. Background Technology
[0002] The statements in this section are merely background information related to the present invention and do not necessarily constitute prior art.
[0003] Graphs, as a key data structure for describing relationships between entities, are widely used in social networks, bioinformatics networks, knowledge graphs, and communication networks. Node-linked graphs are the most common visualization form of graph data, with force-oriented layouts (FRs) being widely applied due to their clear physical meaning and good visual representation. The classic FR model achieves uniform node distribution through squared attraction and inverse repulsion; the Kamada-Kawai model constructs global stress optimization based on the shortest path distance. However, with the rapid increase in graph size, traditional methods face two major challenges: first, severe node overlap, edge intersection, and "balling" phenomena make it difficult to identify community structures and local topologies; second, the computation of all repulsion forces leads to… Its time complexity is insufficient for graph data exceeding one million records.
[0004] To enhance community separation, the LinLog and ForceAtlas2 models introduce degree-weighted repulsion. However, the power function generates unbounded repulsion over short distances, leading to local instability and community overexpansion. Recent t-FDP models employ bounded short-range repulsion to improve local preservation, but fail to fully incorporate degree weighting, resulting in insufficient community spacing and blurred group boundaries. In terms of performance optimization, the Barnes-Hut approximation algorithm and multi-level coarsening strategies reduce complexity to... However, the auxiliary structure has a large overhead; although random sampling methods achieve linear complexity, they are prone to compromising structural fidelity. Negative sampling and dimensionality reduction embedding methods also struggle to balance community separation, stability, parallel efficiency, and low memory usage. Summary of the Invention
[0005] To address the problems of high computational complexity of repulsion forces, large memory overhead of auxiliary data structures, unclear separation of community structures, and excessive cluster expansion caused by weighted repulsion in existing large-scale graph layout technologies, this invention provides a large-scale graph layout optimization method and system based on sparse negative sampling. Without altering the graph topology or relying on complex multi-layer graph structures or spatial index structures, it employs attraction and repulsion expressions derived from the t-distribution force-oriented model. By approximating the global repulsion term through an edge-center negative sampling mechanism, the computational complexity of a single-round layout is reduced from that of traditional full-node repulsion calculations. Reduced to a value linearly related to the number of edges Meanwhile, by using linearly normalized degree weights, the compactness of community clusters, inter-cluster separation, and adjacency relationship preservation capabilities in large-scale graphs are improved.
[0006] To achieve the above objectives, the present invention adopts the following technical solution: The first aspect of the present invention provides a method for optimizing large-scale graph layouts based on sparse negative sampling.
[0007] A large-scale graph layout optimization method based on sparse negative sampling includes: Initialize the graph layout, including initializing node positions, and split undirected edges into directed edges, randomly shuffle them, and obtain a list of directed edges; Traverse the list of directed edges, calculate the attraction between nodes for each edge in the list; perform negative sampling on the outgoing points of the edges, use the t-distribution force-guided model to calculate the repulsion between the negative sampling points and the outgoing points, update the node positions based on the attraction and repulsion, implicitly implement the linear normalization degree weight mechanism; dynamically update the learning rate until convergence. The edge set is grouped according to the outgoing nodes of the directed edge list, so that edges with the same outgoing node are assigned to the same edge partition as much as possible; according to the edge partitioning results, different edge partitions are assigned to different computing threads to form thread-local edge sets; each thread independently traverses its own edge partition and updates the gravity and negative sampling repulsion forces respectively; until convergence.
[0008] Furthermore, the initialization of the graph layout includes initializing node positions and splitting undirected edges into directed edges, randomly shuffling them to obtain a list of directed edges; the method includes: Read the graph data and initialize the layout; read the node set and edge set, and use the PMDS method to perform two-dimensional embedding initialization of the nodes to obtain the node layout coordinate set; For undirected edges Generate respectively Given two directed edges, construct a complete list of directed edges, and then randomly shuffle the complete list of directed edges to obtain another list of directed edges.
[0009] Furthermore, the attraction between the computing nodes is expressed by the following formula:
[0010]
[0011] in, This represents the attraction between node i and node j; For the t-distribution force-guided model parameters; This represents the Euclidean distance between node i and node j; , These represent the layout coordinates of node i and node j, respectively.
[0012] Furthermore, the repulsive force between the negative sampling point and the output point is calculated using the t-distribution force-guided model, employing the following formula:
[0013]
[0014] in, This represents the repulsive force in the t-distribution repulsive force model; For the t-distribution force-guided model parameters; This is the negative sampling node number.
[0015] Furthermore, update the node position based on the attraction; represented in the following form:
[0016]
[0017] Update node positions based on repulsion; expressed in the following form:
[0018]
[0019] in, This represents the current learning rate.
[0020] The repulsive force accumulates during the negative sampling process. The mathematical expectation is consistent with the result of the linear normalization weight:
[0021] Meanwhile, the negative sampling process does not affect the form of gravity; therefore, the expected resultant force of gravity and repulsion is consistent with the resultant force of the linear normalization degree weighting mechanism.
[0022] This implicitly implements the linear normalization degree weighting mechanism.
[0023] Furthermore, an independent random number generator is used within each thread to perform negative sampling operations, thereby reducing the correlation between random sampling processes between threads; and a lock-free stochastic gradient descent update method is used to directly update the node position coordinates.
[0024] A second aspect of the present invention provides a large-scale graph layout optimization system based on sparse negative sampling.
[0025] A large-scale graph layout optimization system based on sparse negative sampling includes: The initialization module is configured to: initialize the graph layout, including initializing the node positions, and split the undirected edges into directed edges, randomly shuffle them, and obtain a list of directed edges; The negative sampling optimization module is configured to: traverse the list of directed edges, calculate the attractive force between nodes for each edge in the list; perform negative sampling on the outgoing points of the edges, calculate the repulsive force between the negative sampling points and the outgoing points using the t-distribution force-guided model, update the node positions based on the attractive and repulsive forces, implicitly implement the linear normalization degree weight mechanism; and dynamically update the learning rate until convergence. The edge partitioning optimization module is configured to: group the edge set according to the outgoing nodes of the directed edge list, so that edges with the same outgoing nodes are assigned to the same edge partition as much as possible; according to the edge partitioning results, assign different edge partitions to different computing threads to form thread-local edge sets; independently traverse the edge partitions within the thread and update the gravity and negative sampling repulsion forces respectively; until convergence.
[0026] A third aspect of the present invention provides a computer device comprising: A processor, adapted to execute computer programs; A computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps in the large-scale graph layout optimization method based on sparse negative sampling as described in the first aspect above.
[0027] A fourth aspect of the present invention provides a computer-readable storage medium storing a computer program adapted to be loaded by a processor and to execute steps in the large-scale graph layout optimization method based on sparse negative sampling as described in the first aspect above.
[0028] The fifth aspect of the present invention provides a computer program product or computer program.
[0029] This invention provides a computer program product or computer program comprising computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the steps in the large-scale graph layout optimization method based on sparse negative sampling as described in the first aspect above.
[0030] Compared with the prior art, the beneficial effects of the present invention are: It combines high-quality community separation, linear time complexity, low memory consumption, and high parallel efficiency.
[0031] This invention splits each undirected edge into directed edges and randomly shuffles them. It calculates the t-distribution attractive force centered on each directed edge, while simultaneously calculating the t-distribution repulsive force by negative sampling at the edge's exit points. The node layout is iteratively optimized using sparse stochastic gradient descent. Furthermore, it employs an edge partitioning parallel strategy based on edge exit points, achieving multi-threaded parallel acceleration through lock-free stochastic gradient descent, thereby reducing the computational complexity of the repulsive force from... Reduced to It only requires maintaining two core data structures: edge list and node coordinates. There is no need to build auxiliary data structures such as spatial trees, multi-layer graph structures or interpolation grids. It has a low memory footprint and can be applied to complex network analysis, information visualization, human-computer interaction and graph data mining scenarios with millions or even tens of millions of node graph data. Attached Figure Description
[0032] The accompanying drawings, which form part of this invention, are used to provide a further understanding of the invention. The illustrative embodiments of the invention and their descriptions are used to explain the invention and do not constitute an improper limitation of the invention.
[0033] Figure 1 This is a flowchart illustrating a large-scale graph layout optimization method based on sparse negative sampling, as shown in an embodiment of the present invention. Figure 2 This is an overall flowchart of a large-scale graph layout optimization method based on sparse negative sampling, as shown in an embodiment of the present invention. Figure 3 This is a schematic diagram illustrating the layout optimization iteration process on an example dataset, as shown in an embodiment of the present invention. Figure 3 (a) shows the initial PMDS layout result. Figure 3 (b) shows the layout result after one iteration. Figure 3 (c) shows the layout result after 5 iterations. Figure 3 (d) shows the layout result after 30 iterations; Figure 4 This is a comparative diagram showing the impact of different negative sampling numbers on the layout results in an embodiment of the present invention, with the layout visualization results corresponding to negative sampling numbers k=1, 3, 5, and 10 respectively; Figure 5 This is a schematic diagram illustrating the verification of the effectiveness of the edge-center negative sampling strategy according to an embodiment of the present invention, wherein... Figure 5 (a) shows the curves of actual energy loss and equivalent global energy loss during the optimization process, illustrating that the negative sampling stochastic optimization process can converge to the global objective function; Figure 5 (b) shows a superimposed comparison of the layout results using edge-center negative sampling and the layout results calculated using full global repulsion. Figure 6This is a structural diagram of a large-scale graph layout optimization system based on sparse negative sampling, as shown in an embodiment of the present invention. Figure 7 This is a structural diagram of a computer device shown in an embodiment of the present invention. Detailed Implementation
[0034] The present invention will be further described below with reference to the accompanying drawings and embodiments.
[0035] It should be noted that the following detailed description is illustrative and intended to provide further explanation of the invention. Unless otherwise specified, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains.
[0036] It should be noted that the terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the scope of exemplary embodiments according to the invention. As used herein, the singular form is intended to include the plural form as well, unless the context clearly indicates otherwise. Furthermore, it should be understood that when the terms "comprising" and / or "including" are used in this specification, they indicate the presence of features, steps, operations, devices, components, and / or combinations thereof.
[0037] Figure 1 This is a flowchart illustrating a large-scale graph layout optimization method based on sparse negative sampling, as shown in an embodiment of the present invention; see reference. Figure 1 The method includes: Initialize the graph layout, including initializing node positions, and split undirected edges into directed edges, randomly shuffle them, and obtain a list of directed edges; Traverse the list of directed edges, calculate the attraction between nodes for each edge in the list; perform negative sampling on the outgoing points of the edges, use the t-distribution force-guided model to calculate the repulsion between the negative sampling points and the outgoing points, update the node positions based on the attraction and repulsion, implicitly implement the linear normalization degree weight mechanism; dynamically update the learning rate until convergence. The edge set is grouped according to the outgoing nodes of the directed edge list, so that edges with the same outgoing node are assigned to the same edge partition as much as possible; according to the edge partitioning results, different edge partitions are assigned to different computing threads to form thread-local edge sets; each thread independently traverses its own edge partition and updates the gravity and negative sampling repulsion forces respectively; until convergence.
[0038] This invention, without altering the graph topology or relying on complex multi-layered graph structures or spatial indexing structures, employs attraction and repulsion expressions derived from the t-distribution force-oriented model. It approximates the global repulsion term through an edge-center negative sampling mechanism, thereby reducing the computational complexity of a single-round layout from that of traditional full-node repulsion calculations. Reduced to a value linearly related to the number of edges Meanwhile, by using linearly normalized degree weights, the compactness of community clusters, inter-cluster separation, and adjacency relationship preservation capabilities in large-scale graphs are improved.
[0039] Figure 2 This is an overall flowchart illustrating a large-scale graph layout optimization method based on sparse negative sampling, as shown in an embodiment of the present invention; Figure 2 As shown, taking the friend relationship data of a social networking platform as an example, in the social networking platform, users are modeled as nodes, and the friend relationships between users are modeled as edges. Let the social networking platform have a total of N There are 3 users, and the friend relationships between users form a graph G(V,E). The method described in this embodiment is described in detail below: Step (1): Initialize the graph layout, including initializing the node positions, splitting the undirected edges into directed edges and then randomly shuffling the edge list.
[0040] In some embodiments, the specific implementation process of step (1) includes: Step (1-1): Read the graph data and initialize the layout. The specific implementation process of step (1-1) includes: Step (1-1-1): Read the set of user nodes in the social network Collection of relationships with friends ; Step (1-1-2): Initialize the user nodes using the Pivot Multidimensional Scaling (PMDS) method for two-dimensional embedding. Run the PMDS method to obtain the set of user node layout coordinates:
[0041] Will Set as the initial coordinates. PMDS initialization can preserve a certain global topology in the initial layout state, thereby reducing layout oscillations caused by random initialization and improving the convergence speed of subsequent optimization.
[0042] Step (1-2): Split each undirected friend relationship edge into two directed friend relationship edges, and randomly shuffle the edge list. The specific implementation process of step (1-2) includes: Step (1-2-1): For undirected friend relationship edges Generate respectively Two edges with a directed friendship relationship; Step (1-2-2): Construct a complete list of directed friend relationship edges:
[0043] Step (1-2-3): Randomly shuffle the list of directed friend edges. Randomly shuffling the list of friend edges can reduce the impact of edge access order on the stochastic gradient optimization process and improve the stability of layout optimization.
[0044] Step (2): The edge-centered negative sampling strategy is adopted to implicitly implement the linear normalization degree weight model, including calculating the attraction with the edge as the center, performing negative sampling on the outgoing points of the edge and calculating the repulsion, and dynamically updating the learning rate until convergence.
[0045] In some embodiments, the specific implementation process of step (2) includes: Step (2-1): Set the maximum number of iterations T and execute the layout optimization iteration. The specific implementation process of step (2-1) includes: Step (2-1-1): Set the maximum number of iterations for layout optimization ; Step (2-1-2): Set the number of negative samples ; Step (2-1-3): Set the initial learning rate ; Step (2-1-4): Begin the iterative process.
[0046] Step (2-2): Enumerate all friend relationship edges in the directed edge set. The specific implementation process of step (2-2) includes: Step (2-2-1): Traverse the randomly shuffled list of directed edges; Step (2-2-2): For the current friend relationship edge Perform gravity update and negative sampling repulsion update; Step (2-2-3): Repeat until all friend relationship edges have been traversed.
[0047] Figure 3 The layout optimization process of this invention on an example dataset is demonstrated. Figure 3 (a) represents the initial PMDS layout result; Figure 3 (b) represents the layout result after one iteration; Figure 3 (c) represents the layout result after 5 iterations; Figure 3 (d) represents the layout result after 30 iterations. As the number of iterations increases, nodes gradually form a clear community structure, while the distance between different communities gradually increases.
[0048] Step (2-3): For the current friend relationship edge, calculate the attraction of the friend relationship edge using the t-distribution force-directed model and update the layout result. The specific implementation process of step (2-3) includes: Step (2-3-1): For the current friend relationship edge Calculate the Euclidean distance between user node i and user node j:
[0049] Step (2-3-2): Calculate the attractive force between user node i and user node j using the t-distribution force model:
[0050] in, For the attractive force in the t-distribution force-oriented model, For the t-distribution force-guided model parameters, this algorithm takes... .
[0051] Compared to the power function gravity model in the traditional FR model, the above t-distribution model can reduce the excessive interaction between distant nodes, thereby improving layout stability.
[0052] Step (2-3-3): Update the user node position based on attraction:
[0053]
[0054] in, This represents the current learning rate.
[0055] Step (2-4): Negatively sample the output point k times, calculate the repulsive force between the negatively sampled point and the output point using the t-distribution force-guided model, and update the layout results. The specific implementation process of step (2-4) includes: Step (2-4-1): For the outgoing nodes of the current friend relationship edges Random sampling One negative sample node:
[0056] in, This is the negative sampling node number.
[0057] Step (2-4-2): Calculate the repulsion force between user nodes using the t-distribution repulsion force model:
[0058] in, For the repulsive force in the t-distribution repulsive force model, For the t-distribution force-guided model parameters, this algorithm takes... The repulsive force accumulates during the negative sampling process at the edge center. The mathematical expectation is consistent with the result of the linear normalization weight:
[0059] Meanwhile, the negative sampling process does not affect the form of gravity; therefore, the expected resultant force of gravity and repulsion is consistent with the resultant force of the linear normalization degree weighting mechanism.
[0060] This invention replaces the traditional full-node repulsion force calculation with a negative sampling mechanism based on edge centers, implicitly implementing a linear normalization degree weighting mechanism, thus reducing the complexity of repulsion force calculation in traditional force-directed layouts from... Reduced to This significantly improves the efficiency of layout for ultra-large-scale graphs.
[0061] Step (2-4-3): Update the user node position based on the repulsion force:
[0062]
[0063] Step (2-4-4): Repeat the process Secondary negative sampling process.
[0064] Table 1. Pseudocode of the large-scale graph layout optimization algorithm based on edge center negative sampling
[0065] Figure 4 The impact of different negative sampling numbers (k=1, 3, 5, 10) on the layout results is shown. When k=3, the present invention achieves the best balance between community separation capability and neighborhood preservation capability.
[0066] This invention combines a bounded short-range repulsion model based on t-distribution with a linear normalization degree weighting mechanism based on edge center negative sampling. While maintaining the stability of local neighborhood relationships, it improves the compactness of community structure and the separation effect between clusters, thereby improving the community visualization quality in large-scale graphs.
[0067] Step (2-5): Dynamically update the learning rate. The specific implementation process of step (2-5) includes: Step (2-5-1): After each iteration, update the learning rate according to the following formula:
[0068] in, The current learning rate, This represents the maximum number of iteration rounds.
[0069] The above update method allows the learning rate to gradually approach the minimum learning rate in an exponential decay manner, thereby maintaining a large node movement capability in the early stage of layout optimization and gradually reducing the node update amplitude in the later stage, improving the stability of the layout result and reducing oscillation.
[0070] Step (3): Perform parallel layout optimization based on edge partitioning, including partitioning the edge set according to the node output point, performing parallel gravity and negative sampling repulsion updates based on thread local edge partitioning, and using lock-free stochastic gradient descent to reduce thread write conflicts.
[0071] In some embodiments, the specific implementation process of step (3) includes: Step (3-1): Group the edge set according to the outgoing nodes of the directed edges, so that edges with the same outgoing nodes are assigned to the same edge partition as much as possible. Step (3-2): Based on the edge partitioning results, assign different edge partitions to different computation threads, thereby forming a thread-local edge set:
[0072] in, Represents a thread The corresponding edge partition; Step (3-3): Independently traverse the corresponding edge partition within the thread and perform gravity update and negative sampling repulsion update respectively; Step (3-4): Perform negative sampling operation using an independent random number generator within each thread to reduce the correlation of random sampling processes between threads; Step (3-5): The user node position coordinates are directly updated using a lock-free stochastic gradient descent update method, thereby reducing thread synchronization overhead and cache contention issues; Steps (3-6): After each iteration, each thread synchronously enters the next layout optimization iteration; Step (3-7): Repeat the above process until the maximum number of iterations T is reached.
[0073] This invention adopts an edge partitioning parallel strategy based on edge-out points, and reduces the overhead of thread synchronization and cache contention by using a lock-free stochastic gradient descent update method, thereby improving the efficiency of multi-threaded parallel layout optimization.
[0074] Figure 5 This is a schematic diagram illustrating the verification of the effectiveness of the edge-center negative sampling strategy according to an embodiment of the present invention, wherein... Figure 5 (a) shows the curves of actual energy loss and equivalent global energy loss during the optimization process, illustrating that the negative sampling stochastic optimization process can converge to the global objective function; Figure 5(b) shows a superimposed comparison of the results of the edge-center negative sampling layout and the complete global repulsion calculation layout, illustrating that the present invention can maintain the consistency of community structure and group adjacency relationship while reducing computational complexity.
[0075] Since the edge-center negative sampling update process in this invention involves only a small number of node coordinates, each update exhibits strong sparsity. By employing an edge partitioning strategy based on the outgoing node, the write conflict caused by different threads updating the same node simultaneously can be effectively reduced, thereby improving the efficiency of parallel layout optimization.
[0076] Through the above steps, social networking platforms can achieve linear time complexity. Complete the layout of friend relationship graphs for millions of users, generate visualizations with clear community structures, and help platform operators and users intuitively understand the group structure and discover community relationships in social networks.
[0077] The above combination Figure 1 The large-scale graph layout optimization method based on sparse negative sampling provided in the embodiments of the present invention has been described in detail. Next, the large-scale graph layout optimization system based on sparse negative sampling provided in the embodiments of the present invention will be described in conjunction with the accompanying drawings.
[0078] Figure 4 This is a schematic diagram of the structure of a large-scale graph layout optimization system based on sparse negative sampling, as shown in an embodiment of the present invention. Figure 4 The system described in this invention includes: The initialization module is configured to: initialize the graph layout, including initializing the node positions, and split the undirected edges into directed edges, randomly shuffle them, and obtain a list of directed edges; The negative sampling optimization module is configured to: traverse the list of directed edges, calculate the attractive force between nodes for each edge in the list; perform negative sampling on the outgoing points of the edges, calculate the repulsive force between the negative sampling points and the outgoing points using the t-distribution force-guided model, update the node positions based on the attractive and repulsive forces, implicitly implement the linear normalization degree weight mechanism; and dynamically update the learning rate until convergence. The edge partitioning optimization module is configured to: group the edge set according to the outgoing nodes of the directed edge list, so that edges with the same outgoing nodes are assigned to the same edge partition as much as possible; according to the edge partitioning results, assign different edge partitions to different computing threads to form thread-local edge sets; independently traverse the edge partitions within the thread and update the gravity and negative sampling repulsion forces respectively; until convergence.
[0079] In some embodiments, the initialization module is specifically configured to: read graph data and initialize the layout; read the node set and edge set, perform two-dimensional embedding initialization of the nodes using the PMDS method, and obtain the node layout coordinate set; for undirected edges... Generate respectively Given two directed edges, construct a complete list of directed edges, and then randomly shuffle the complete list of directed edges to obtain another list of directed edges.
[0080] In some embodiments, the attractive force between the computing nodes is expressed by the following formula:
[0081]
[0082] in, This represents the attraction between node i and node j; For the t-distribution force-guided model parameters; This represents the Euclidean distance between node i and node j; , These represent the layout coordinates of node i and node j, respectively.
[0083] In some embodiments, the calculation of the repulsive force between the negative sampling point and the exit point using the t-distribution force-guided model employs the following formula:
[0084]
[0085] in, This represents the repulsive force in the t-distribution repulsive force model; For the t-distribution force-guided model parameters; This is the negative sampling node number.
[0086] In some embodiments, node positions are updated based on attraction; represented in the following form:
[0087]
[0088] Update node positions based on repulsion; expressed in the following form:
[0089]
[0090] in, This is the current learning rate; In some embodiments, the negative sampling process accumulates repulsive forces. The mathematical expectation is consistent with the result of the linear normalization weight:
[0091] Meanwhile, the negative sampling process does not affect the form of gravity; therefore, the expected resultant force of gravity and repulsion is consistent with the resultant force of the linear normalization degree weighting mechanism.
[0092] This implicitly implements the linear normalization degree weighting mechanism.
[0093] In some embodiments, an independent random number generator is used within a thread to perform negative sampling operations in order to reduce the correlation of random sampling processes between threads; and a lock-free stochastic gradient descent update method is used to directly update the node position coordinates.
[0094] According to embodiments of the present invention, the large-scale graph layout optimization system based on sparse negative sampling can correspond to the execution of the method described in the embodiments of the present invention, and the above and other operations and / or functions of each module of the large-scale graph layout optimization system based on sparse negative sampling are respectively for implementing Figure 1 For the sake of brevity, the corresponding processes of each method in the code will not be elaborated here.
[0095] See Figure 5 The diagram shows the structure of a computer device, which includes a processor, a communication interface, and a computer-readable storage medium. The processor, communication interface, and computer-readable storage medium are connected via a bus or other means. The communication interface is used to receive and send data. The computer-readable storage medium can be stored in the computer device's memory. The computer-readable storage medium stores computer programs, including program instructions, and the processor executes the program instructions stored in the computer-readable storage medium. The processor (or CPU, Central Processing Unit) is the computing and control core of the computer device, suitable for implementing one or more instructions, specifically suitable for loading and executing one or more instructions to implement the corresponding steps in the embodiment of the large-scale graph layout optimization method based on sparse negative sampling.
[0096] This embodiment provides a computer-readable storage medium (Memory), which is a memory device in a computer device used to store programs and data. It is understood that the computer-readable storage medium here can include both the built-in storage medium in the computer device and extended storage media supported by the computer device. The computer-readable storage medium provides storage space that stores the processing system of the computer device.
[0097] Furthermore, this storage space also contains one or more instructions suitable for loading and execution by the processor. These instructions can be one or more computer programs (including program code). It should be noted that the computer-readable storage medium here can be high-speed RAM memory or non-volatile memory, such as at least one disk storage device; optionally, it can also be at least one computer-readable storage medium located remotely from the aforementioned processor.
[0098] In one embodiment, the computer-readable storage medium stores one or more instructions; the processor loads and executes one or more instructions stored in the computer-readable storage medium to implement the corresponding steps in the above embodiment of the large-scale graph layout optimization method based on sparse negative sampling.
[0099] This embodiment provides a computer program product or computer program that includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the corresponding steps in the above-described embodiment of the large-scale graph layout optimization method based on sparse negative sampling.
[0100] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of hardware embodiments, software embodiments, or embodiments combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage and optical storage) containing computer-usable program code.
[0101] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations 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, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0102] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0103] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0104] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. The storage medium can be a magnetic disk, optical disk, read-only memory (ROM), or random access memory (RAM), etc.
[0105] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A large-scale graph layout optimization method based on sparse negative sampling, characterized in that, include: Initialize the graph layout, including initializing node positions, and split undirected edges into directed edges, randomly shuffle them, and obtain a list of directed edges; Traverse the list of directed edges, calculate the attraction between nodes for each edge in the list; perform negative sampling on the outgoing points of the edges, use the t-distribution force-guided model to calculate the repulsion between the negative sampling points and the outgoing points, update the node positions based on the attraction and repulsion, implicitly implement the linear normalization degree weight mechanism; dynamically update the learning rate until convergence. The edge set is grouped according to the outgoing nodes of the directed edge list, so that edges with the same outgoing node are assigned to the same edge partition as much as possible; according to the edge partitioning results, different edge partitions are assigned to different computing threads to form thread-local edge sets; each thread independently traverses its own edge partition and updates the gravity and negative sampling repulsion forces respectively; until convergence.
2. The large-scale graph layout optimization method based on sparse negative sampling according to claim 1, characterized in that, The initialization of the graph layout includes initializing node positions and splitting undirected edges into directed edges, randomly shuffling them to obtain a list of directed edges; the method includes: Read the graph data and initialize the layout; read the node set and edge set, and use the PMDS method to perform two-dimensional embedding initialization of the nodes to obtain the node layout coordinate set; For undirected edges Generate respectively Given two directed edges, construct a complete list of directed edges, and then randomly shuffle the complete list of directed edges to obtain another list of directed edges.
3. The large-scale graph layout optimization method based on sparse negative sampling according to claim 1, characterized in that, The attraction between the computing nodes is defined by the following formula: in, This represents the attraction between node i and node j; For the t-distribution force-guided model parameters; This represents the Euclidean distance between node i and node j; , These represent the layout coordinates of node i and node j, respectively.
4. The large-scale graph layout optimization method based on sparse negative sampling according to claim 3, characterized in that, The repulsive force between the negative sampling point and the output point is calculated using the t-distribution force-guided model, and the following formula is used: in, This represents the repulsive force in the t-distribution repulsive force model; For the t-distribution force-guided model parameters; This is the negative sampling node number.
5. The large-scale graph layout optimization method based on sparse negative sampling according to claim 4, characterized in that, Update node positions based on attraction; It shall be expressed in the following form: Update the node position based on the repulsion force; It shall be expressed in the following form: in, This is the current learning rate; The repulsive force accumulates during the negative sampling process. The mathematical expectation is consistent with the result of the linear normalization weight: Meanwhile, the negative sampling process does not affect the form of gravity; therefore, the expected resultant force of gravity and repulsion is consistent with the resultant force of the linear normalization degree weighting mechanism. This implicitly implements the linear normalization degree weighting mechanism.
6. The large-scale graph layout optimization method based on sparse negative sampling according to claim 1, characterized in that, An independent random number generator is used within each thread to perform negative sampling operations, thereby reducing the correlation of random sampling processes between threads; and a lock-free stochastic gradient descent update method is used to directly update the node position coordinates.
7. A large-scale graph layout optimization system based on sparse negative sampling, characterized in that, include: The initialization module is configured to: initialize the graph layout, including initializing the node positions, and split the undirected edges into directed edges, randomly shuffle them, and obtain a list of directed edges; The negative sampling optimization module is configured to: traverse the list of directed edges, calculate the attractive force between nodes for each edge in the list; perform negative sampling on the outgoing points of the edges, calculate the repulsive force between the negative sampling points and the outgoing points using the t-distribution force-guided model, update the node positions based on the attractive and repulsive forces, implicitly implement the linear normalization degree weight mechanism; and dynamically update the learning rate until convergence. The edge partitioning optimization module is configured to: group the edge set according to the outgoing nodes of the directed edge list, so that edges with the same outgoing nodes are assigned to the same edge partition as much as possible; according to the edge partitioning results, assign different edge partitions to different computing threads to form thread-local edge sets; independently traverse the edge partitions within the thread and update the gravity and negative sampling repulsion forces respectively; until convergence.
8. A computer device, characterized in that, A processor, adapted to execute computer programs; A computer-readable storage medium storing a computer program, which, when executed by the processor, implements the steps of the large-scale graph layout optimization method based on sparse negative sampling as described in any one of claims 1-6.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program adapted to be loaded by a processor and to execute the steps of the large-scale graph layout optimization method based on sparse negative sampling as described in any one of claims 1-6.
10. A computer program product, characterized in that, The computer program product includes a computer program that, when executed by a processor, implements the steps in the large-scale graph layout optimization method based on sparse negative sampling as described in any one of claims 1-6.