Graph data processing method, device, computer equipment and storage medium
Through multiple iterations, the embedding features of nodes are obtained and neighborhood information is combined with neighborhood information, the representation problem of node identity and edge pointing relationship in directed graph is solved, and efficient graph embedding is realized, which can accurately represent the dual identity of nodes and the directed edge pointingness.
Patent Information
- Application Number
- CN202111151811.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-29
- Publication Date
- 2025-08-29
- Estimated Expiration
- 2041-09-29
AI Technical Summary
The existing graph embedding technology cannot effectively represent the dual identity of nodes in directed graphs and the directed edges, resulting in the coded vector being unable to reflect the dual identity of nodes and the directed edges.
Through multiple iterations, the nodes in the target graph are obtained, and the fourth embedding feature of the node is determined based on the embedding features of the node, the embedding features of the first neighborhood and the second neighborhood, and the feature representation of the node's initiator and receiver is realized, and the directed edge direction relationship is determined through the inner product.
Effectively represent the dual identity of the node and the directed edge pointing relationship, reducing the amount of operations, and improving the efficiency and accuracy of graph embedding.
Smart Images

Figure CN115909419B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a graph data processing method, apparatus, computer equipment, and storage medium. Background Art
[0002] Graph embedding technology has become an effective tool for large-scale graph data mining. The key idea behind graph embedding is to map high-dimensional, sparse raw graph data into low-dimensional, dense vectors—that is, embedding vectors for each node in the graph—thus preserving the graph's topological structure as much as possible in the embedding space. Efficient graph embedding is a research topic.
[0003] Currently, commonly used graph embedding technologies include DeepWalk, Node2Vec (node to vector), LINE (Large-scale Information Network Embedding), etc., which use random walk algorithms to determine the business relationships between nodes in graph data and finally encode the vector of each node.
[0004] However, for a directed graph, a pair of nodes in the directed graph represent the initiator and receiver of the business relationship, respectively. The directed edge between the pair of nodes points from the initiator to the receiver. However, the three algorithms mentioned above ultimately obtain an encoding vector corresponding to each node in the graph, which can neither represent the dual identity of the node nor reflect the directional relationship of the directed edge. Summary of the Invention
[0005] The embodiments of the present application provide a graph data processing method, apparatus, computer device, and storage medium, which enable the embedded features of each node to maximize the preservation of information about the first and second neighborhoods. Furthermore, the directional relationship of a directed edge can be determined based on the inner product between the embedded features of two nodes connected by the directed edge, thereby representing both the dual identity of the node and the directional relationship of the directed edge. The technical solution is as follows:
[0006] In one aspect, a graph data processing method is provided, the method comprising:
[0007] Based on the object data, a target graph is obtained, where the target graph includes M nodes representing objects, where M is a positive integer. A directed edge in the target graph is used to indicate that a business relationship exists between objects corresponding to the connected nodes, and the pointing node of the directed edge is the initiator of the business relationship, and the pointing node of the directed edge is the recipient of the business relationship.
[0008] Performing multiple rounds of iterations based on the M nodes and the directed edges between the M nodes, obtaining initiating embedded features and receiving embedded features corresponding to the M nodes, wherein the initiating embedded features are used to represent features of the corresponding node as an initiator, and the receiving embedded features are used to represent features of the corresponding node as a receiver;
[0009] The steps of the zth iteration include:
[0010] Obtain N nodes from the M nodes, where N is a positive integer and z is a positive integer;
[0011] Determining, based on directed edges associated with the N nodes, a plurality of first neighboring nodes associated with the N nodes and a plurality of second neighboring nodes associated with the N nodes, wherein the directed edges indicated by the first neighboring nodes point to the N nodes, and the directed edges indicated by the N nodes point to the plurality of second neighboring nodes;
[0012] Based on the first embedding features of the N nodes, the second embedding features of the plurality of first neighboring nodes, and the third embedding features of the plurality of second neighboring nodes, fourth embedding features of the N nodes are determined.
[0013] In another aspect, a graph data processing apparatus is provided, the apparatus comprising:
[0014] A graph acquisition module is configured to acquire a target graph based on the object data, wherein the target graph includes M nodes representing objects, where M is a positive integer. A directed edge in the target graph is used to indicate that a business relationship exists between objects corresponding to the connected nodes, and the pointing node of the directed edge is the initiator of the business relationship, and the pointing node of the directed edge is the recipient of the business relationship.
[0015] an iterative module, configured to perform multiple rounds of iteration based on the M nodes and the directed edges between the M nodes to obtain initiating embedded features and receiving embedded features corresponding to the M nodes, wherein the initiating embedded features are used to represent features of the corresponding node as an initiator, and the receiving embedded features are used to represent features of the corresponding node as a receiver;
[0016] Wherein, the iteration module includes:
[0017] an acquiring unit, configured to acquire N nodes from the M nodes, where N is a positive integer;
[0018] a node determination unit, configured to determine, based on directed edges associated with the N nodes, a plurality of first neighboring nodes associated with the N nodes and a plurality of second neighboring nodes associated with the N nodes, wherein the directed edges indicated by the first neighboring nodes point to the N nodes, and the directed edges indicated by the N nodes point to the plurality of second neighboring nodes;
[0019] A feature determination unit is configured to determine fourth embedding features of the N nodes based on the first embedding features of the N nodes, the second embedding features of the plurality of first neighboring nodes, and the third embedding features of the plurality of second neighboring nodes.
[0020] In some embodiments, the feature determination unit includes:
[0021] a first determining subunit, configured to determine a first function based on a first embedding feature of the N nodes, a second embedding feature of the plurality of first neighborhood nodes, node in-degree distribution information, and a fifth embedding feature of the plurality of first nodes, wherein the node in-degree distribution information is used to represent the distribution of node in-degrees of the N nodes, the plurality of first nodes being obtained based on negative sampling of a first neighborhood of the N nodes, the first neighborhood including the plurality of first neighborhood nodes;
[0022] a second determining subunit, configured to determine a second function based on the first embedding features of the N nodes, the third embedding features of the plurality of second neighborhood nodes, node out-degree distribution information, and a sixth embedding feature of the plurality of second nodes, wherein the node out-degree distribution information is used to represent the distribution of the node out-degrees of the N nodes, the plurality of second nodes are obtained based on negative sampling of a second neighborhood of the N nodes, and the second neighborhood includes the plurality of second neighborhood nodes;
[0023] The first optimization subunit is configured to optimize a first objective function formed by the first function and the second function to obtain fourth embedded features of the N nodes.
[0024] In some embodiments, the first determining subunit is used to obtain N first intermediate embedded features from the first embedded features of the N nodes, and the N first intermediate embedded features are used to represent the features of the N nodes as the receivers; obtain multiple second intermediate embedded features from the second embedded features of the multiple first neighborhood nodes, and the multiple second intermediate embedded features are used to represent the features of the multiple first neighborhood nodes as the initiators; determine first expected information based on the node in-degree distribution information, and the first expected information is used to represent that the multiple first nodes meet the mathematical expectation of the node in-degree distribution information; obtain multiple third intermediate embedded features from the fifth embedded features of the multiple first nodes, and the multiple third intermediate embedded features are used to represent the features of the multiple first nodes as the initiators; determine the first function based on the N first intermediate embedded features, the multiple second intermediate embedded features, the first expected information and the multiple third intermediate embedded features.
[0025] In some embodiments, the second determining subunit is used to obtain N fourth intermediate embedded features from the first embedded features of the N nodes, and the N fourth intermediate embedded features are used to represent the characteristics of the N nodes as the initiators; obtain multiple fifth intermediate embedded features from the third embedded features of the multiple second neighboring nodes, and the multiple fifth intermediate embedded features are used to represent the characteristics of the multiple second neighboring nodes as the receivers; determine second expected information based on the node out-degree distribution information, and the second expected information is used to represent that the multiple second nodes meet the mathematical expectation of the node out-degree distribution information; obtain multiple sixth intermediate embedded features from the embedded features of the multiple second nodes, and the multiple sixth intermediate embedded features are used to represent the characteristics of the multiple second nodes as the receivers; determine the second function based on the N fourth intermediate embedded features, the multiple fifth intermediate embedded features, the second expected information and the multiple sixth intermediate embedded features.
[0026] In some embodiments, the feature determination unit includes:
[0027] a third determining subunit, configured to determine first probability information based on the first embedding features of the N nodes and the second embedding features of the plurality of first neighboring nodes, wherein the first probability information is used to indicate a probability of determining the plurality of first neighboring nodes based on the N nodes;
[0028] a fourth determining subunit, configured to determine second probability information based on the first embedding features of the N nodes and the third embedding features of the plurality of second neighboring nodes, wherein the second probability information is used to indicate a probability of determining the plurality of second neighboring nodes based on the N nodes;
[0029] a fifth determining subunit, configured to determine a second objective function based on the first probability information and the second probability information;
[0030] The second optimization subunit is used to optimize the second objective function to obtain fourth embedding features of the N nodes.
[0031] In some embodiments, the third determination subunit is used to obtain N first intermediate embedded features from the first embedded features of the N nodes, and the N first intermediate embedded features are used to represent the features of the N nodes as the receivers; obtain multiple second intermediate embedded features from the second embedded features of the multiple first neighboring nodes, and the multiple second intermediate embedded features are used to represent the features of the multiple first neighboring nodes as the initiators; obtain M seventh intermediate embedded features of the M nodes, and the M seventh intermediate embedded features are used to represent the features of the M nodes as the initiators; determine the first probability information based on the N first intermediate embedded features, the multiple second intermediate embedded features and the M seventh intermediate embedded features.
[0032] In some embodiments, the fourth determination subunit is used to obtain N fourth intermediate embedded features from the first embedded features of the N nodes, and the N fourth intermediate embedded features are used to represent the characteristics of the N nodes as the initiators; obtain multiple fifth intermediate embedded features from the third embedded features of the multiple second neighboring nodes, and the multiple fifth intermediate embedded features are used to represent the characteristics of the multiple second neighboring nodes as the receivers; obtain M eighth intermediate embedded features of the M nodes, and the M eighth intermediate embedded features are used to represent the characteristics of the M nodes as the receivers; determine the second probability information based on the N fourth intermediate embedded features, the multiple fifth intermediate embedded features and the M eighth intermediate embedded features.
[0033] In some embodiments, the apparatus further comprises:
[0034] A partitioning module, configured to divide the target graph into at least one graph partition;
[0035] A storage module, configured to store, for any graph partition, the nodes in the graph partition in a parameter server;
[0036] The storage module is further configured to store the edge table corresponding to the graph partition in the executor corresponding to the graph partition;
[0037] a sampling module, configured to, for any executor, sample a plurality of sampling edges from the target graph based on an edge table stored by the executor, where the nodes connected by the plurality of sampling edges are the N nodes;
[0038] The acquisition unit is configured to determine N node identifiers based on the multiple sampling edges; and acquire the N nodes corresponding to the N node identifiers from the parameter server.
[0039] In some embodiments, the feature determination unit is used to determine N feature gradients of the N nodes based on the first embedding features of the N nodes, the second embedding features of the multiple first neighboring nodes, and the third embedding features of the multiple second neighboring nodes; upload the N feature gradients to the parameter server, and the parameter server determines the fourth embedding features of the N nodes based on the first embedding features of the N nodes and the N feature gradients.
[0040] On the other hand, a computer device is provided, which includes a processor and a memory, wherein the memory is used to store at least one computer program, and the at least one computer program is loaded and executed by the processor to implement the operations performed by the graph data processing method in the embodiment of the present application.
[0041] On the other hand, a computer-readable storage medium is provided, in which at least one computer program is stored. The at least one computer program is loaded and executed by a processor to implement the operations performed by the image data processing method in the embodiment of the present application.
[0042] On the other hand, a computer program product is provided, which includes a computer program code, which is stored in a computer-readable storage medium. A processor of a computer device reads the computer program code from the computer-readable storage medium, and the processor executes the computer program code, so that the computer device executes the graph data processing method provided in various optional implementations of the above-mentioned aspects.
[0043] The beneficial effects of the technical solution provided by the embodiments of the present application are:
[0044] An embodiment of the present application provides a novel technical solution for graph data processing, which obtains N nodes from the target graph in each round of iteration, and then determines the fourth embedding features of the N nodes based on the first embedding features of the N nodes, the second embedding features of multiple first neighboring nodes associated with the N nodes, and the third embedding features of multiple second neighboring nodes, thereby completing a round of iteration and updating the embedding features of the N nodes. Since M nodes are not processed, the amount of calculation can be greatly reduced. After multiple rounds of iteration, the initiating embedding features of the M nodes as initiators and the receiving embedding features of the M nodes as receivers can be obtained, so that the embedding features of each node can maximize the preservation of information of the first neighborhood and the second neighborhood, and then the directional relationship of the directed edge can be determined based on the inner product between the embedding features of the two nodes connected by the directed edge, thereby representing both the dual identity of the node and the directional relationship of the directed edge. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0046] Figure 1 This is a schematic diagram of an implementation environment of a graph data processing method provided according to an embodiment of the present application;
[0047] Figure 2 This is a flowchart of a graph data processing method provided according to an embodiment of the present application;
[0048] Figure 3 is a flowchart of another graph data processing method provided according to an embodiment of the present application;
[0049] Figure 4 is a schematic diagram of a directed graph provided according to an embodiment of the present application;
[0050] Figure 5 This is a schematic diagram of a directed graph neighborhood definition provided according to an embodiment of the present application;
[0051] Figure 6 is a schematic diagram of a distributed computing architecture provided according to an embodiment of the present application;
[0052] Figure 7 is a block diagram of a graph data processing device provided according to an embodiment of the present application;
[0053] Figure 8 is a block diagram of another graph data processing device provided according to an embodiment of the present application;
[0054] Figure 9 This is a structural block diagram of a terminal provided according to an embodiment of the present application;
[0055] Figure 10 It is a structural diagram of a server provided according to an embodiment of the present application. DETAILED DESCRIPTION
[0056] In order to make the objectives, technical solutions and advantages of this application clearer, the implementation methods of this application will be further described in detail below with reference to the accompanying drawings.
[0057] In this application, the terms "first", "second", etc. are used to distinguish identical or similar items with substantially the same effects and functions. It should be understood that there is no logical or temporal dependency between "first", "second", and "nth", nor is there any limitation on the quantity and execution order.
[0058] In the present application, the term "at least one" means one or more, and the term "plurality" means two or more.
[0059] The following explains the terms used in this application.
[0060] Graph, in mathematics, is a structure described in a set of objects, where some pairs of objects are "related" in some sense. These objects correspond to mathematical abstractions called nodes (also called vertices or points), and each related pair of nodes is connected by edges (also called links or lines). In an embodiment of the present application, the objects are user accounts, items, virtual resources, positions, and virtual live broadcast rooms, etc., and this embodiment of the present application is not limited to this. If the object is a user account, different nodes in the graph represent different user accounts, and the edges in the graph represent business relationships between user accounts, such as transfers, applying for friends, etc.
[0061] A directed graph is a graph composed entirely of directed edges. A node in a directed graph has two different identities or roles. For example, if a directed edge from nodes 1 and 2 points to node 3, node 3's identity relative to nodes 1 and 2 is a receiver (also called a responder or target role). If a directed edge from node 3 points to nodes 4 and 5, node 3's identity relative to nodes 4 and 5 is an initiator (also called a sender or source role).
[0062] Asymmetric directed relationships: The edge relationship between a pair of nodes in a directed graph is asymmetric. For example, if there is a directed edge from node 1 to node 3 in the directed graph, but there is no directed edge from node 3 to node 1, then the relationship between node 1 and node 3 is asymmetric.
[0063] Graph embedding (also known as graph representation learning) is a process of mapping graph data (usually high-dimensional dense matrices) into low-dimensional dense vectors. It can effectively solve the problem that graph data is difficult to efficiently input into machine learning algorithms.
[0064] An edge table, also known as an edge set table, is a storage structure for a graph. It consists of two parts: a header node and a table node. Each vertex in the graph corresponds to a header node stored in an array.
[0065] Out-degree: The number of edges pointed out by a node is called the out-degree of the node.
[0066] In-degree: The number of edges pointing to a node is called the in-degree of the node.
[0067] The graph data processing method provided in the embodiments of the present application can be applied to various scenarios, including but not limited to cloud technology, artificial intelligence, smart transportation, and assisted driving. The following describes the implementation environment of the embodiments of the present application.
[0068] The graph data processing method provided in the embodiment of the present application can be executed by a computer device, which is a terminal or a server. The following first takes the computer device as an example to introduce the implementation environment of the graph data processing method provided in the embodiment of the present application. Figure 1 This is a schematic diagram of an implementation environment of a graph data processing method provided according to an embodiment of the present application. Figure 1 , the implementation environment includes a terminal 101 and a server 102.
[0069] The terminal 101 and the server 102 can be connected directly or indirectly via wired or wireless communication, which is not limited in this application.
[0070] In some embodiments, the terminal 101 is a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart watch, a smart home appliance, and a car terminal, etc., but is not limited to this. The terminal 101 has an application installed and running. The application is a social program, a shopping program, a multimedia program, a game program, etc., and the embodiments of the present application are not limited to this. In some embodiments, the terminal 101 is a terminal used by a user, and the terminal 101 runs a social program, and the social program is logged in to the user account of the user. In some embodiments, the number of the above-mentioned terminals 101 can be more or less. For example, the above-mentioned terminal 101 is only one, or the above-mentioned terminal 101 is dozens or hundreds, or a larger number. The embodiments of the present application do not limit the number and device type of the terminals 101.
[0071] In some embodiments, the server 102 is an independent physical server, or a server cluster or distributed system composed of multiple physical servers. It can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. The server 102 is used to provide background services for the above-mentioned applications running on the terminal 101. In some embodiments, the server 102 undertakes the main computing work and the terminal 101 undertakes the secondary computing work; or, the server 102 undertakes the secondary computing work and the terminal 101 undertakes the main computing work; or, the server 102 and the terminal 101 adopt a distributed computing architecture for collaborative computing.
[0072] In this implementation environment, the application installed in the terminal 101 is a shopping application as an example for description.
[0073] For example, the shopping program installed on the terminal 101 is logged in with a user account. The server 102 uses the user account data and the product data as object data and constructs a target graph based on the object data. The nodes in the target graph represent user accounts or products. The directed edges in the target graph represent the business relationship between the user account and the item. For example, when a customer uses a user account to purchase an item, the directed edge between node 1 representing the customer's user account and node 2 representing the item represents the business relationship of purchase. The directed edge points from node 1 to node 2. At this time, node 1 is the initiator of the purchase and node 2 is the recipient of the purchase. Similarly, when a merchant uses a user account to list an item, the directed edge between node 3 representing the merchant's user account and node 2 representing the item represents the business relationship of listing. The directed edge points from node 3 to node 2. At this time, node 3 is the initiator of listing and node 2 is the recipient of listing. The server 102 can use the graph data processing method provided in the embodiment of the present application to obtain the embedded features of each node in the target graph. The embedded features are then applied to item recommendation services, social recommendation services, and advertising services, etc., which are not limited in the embodiment of the present application.
[0074] In another embodiment, a computer device is used as a terminal, and a multimedia program is installed on the terminal as an example.
[0075] For example, after the user authorizes, the terminal obtains the historical record data of the user listening to songs, and the historical record data includes objects such as the singer name, song name, and song type. The terminal uses the historical record data as object data to construct a target graph. The nodes in the target graph represent the singer name, song name, and song type, etc. The directed edges in the target graph represent the business relationship between objects. For example, if a singer sings a song and the song belongs to a certain type, the directed edge between node A representing the singer and node B representing the song is from node A to node B, and the directed edge between node B representing the song and node C representing the type is from node B to node C. Terminal 101 can use the graph data processing method provided in the embodiment of the present application to obtain the embedded features of each node in the target graph. The embedded features are then applied to item recommendation services, social recommendation services, and advertising services, etc., which are not limited by the embodiment of the present application.
[0076] Figure 2 is a flowchart of a graph data processing method provided according to an embodiment of the present application, such as Figure 2 As shown, in the embodiment of the present application, the method for processing graph data is described by taking the execution by the server as an example. The graph data processing method includes the following steps:
[0077] 201. Based on the object data, a target graph is obtained, where the target graph includes M nodes representing objects, where M is a positive integer. A directed edge in the target graph is used to indicate that a business relationship exists between objects corresponding to the connected nodes, and the pointing node of the directed edge is the initiator of the business relationship, and the pointing node of the directed edge is the receiver of the business relationship.
[0078] In an embodiment of the present application, the objects in the object data include user accounts, items, multimedia resources, virtual resources, virtual services, and virtual live broadcast rooms, etc. The object data includes relationship information between objects, and the relationship information includes business relationships and association relationships between objects, etc. Based on different object data, the server can construct different target graphs, such as social relationship graphs, shopping graphs, and virtual live broadcast graphs, etc. Among them, the object data is data collected and used after full authorization. The directed edges in the target graph can represent the business relationship between objects. If the objects corresponding to the two nodes connected by the directed edge are two user accounts, the business relationship represented by the directed edge can be a transfer relationship, a follow-up relationship, and a like relationship, etc. For any directed edge, the node pointing to the directed edge is the initiator of the business relationship represented by the directed edge; the node to which the directed edge points is the recipient of the business relationship represented by the directed edge.
[0079] 202. Perform multiple rounds of iterations based on the directed edges between the M nodes to obtain initiating embedded features and receiving embedded features corresponding to the M nodes, where the initiating embedded features are used to represent the features of the corresponding node as an initiator, and the receiving embedded features are used to represent the features of the corresponding node as a receiver.
[0080] In an embodiment of the present application, the server can determine, based on multiple rounds of iterations, the originating embedding feature of each node in the M nodes as the originator and the receiving embedding feature of each node as the receiver. During each round of iteration, for any node, the server can obtain the first neighboring node with the node as the receiver and the second neighboring node with the node as the originator based on the directed edges between the nodes, and then gradually determine the originating embedding feature and the receiving embedding feature of the node using a gradient descent method.
[0081] The following takes the zth round of iteration as an example, where z is a positive integer. The steps of the zth round of iteration include: the server obtains N nodes from the above-mentioned M nodes, where N is a positive integer. Then, based on the directed edges associated with the N nodes, the server determines multiple first neighboring nodes associated with the N nodes and multiple second neighboring nodes associated with the N nodes. Among them, the directed edges pointed out by the first neighboring nodes point to the N nodes, and the directed edges pointed out by the N nodes point to the multiple second neighboring nodes. Then, based on the first embedding features of the above-mentioned N nodes, the second embedding features of multiple first neighboring nodes, and the third embedding features of multiple second neighboring nodes, the server determines the fourth embedding features of the N nodes to complete this round of iteration. It should be noted that the first embedding features of the above-mentioned N nodes, the second embedding features of multiple first neighboring nodes, and the third embedding features of multiple second neighboring nodes are obtained by the server after executing the z-1th round of iteration.
[0082] An embodiment of the present application provides a novel graph data processing method, which obtains N nodes from the target graph in each round of iteration, and then determines the fourth embedding features of the N nodes based on the first embedding features of the N nodes, the second embedding features of multiple first neighboring nodes associated with the N nodes, and the third embedding features of multiple second neighboring nodes, thereby completing a round of iteration and updating the embedding features of the N nodes. Since M nodes are not processed, the amount of calculation can be greatly reduced. After multiple rounds of iteration, the initiating embedding features of the M nodes as initiators and the receiving embedding features of the M nodes as receivers can be obtained, so that the embedding features of each node can maximize the preservation of information of the first neighborhood and the second neighborhood, and then the directional relationship of the directed edge can be determined based on the inner product between the embedding features of the two nodes connected by the directed edge, thereby representing both the dual identity of the node and the directional relationship of the directed edge.
[0083] Figure 2 The main process of the graph data processing method provided in the embodiment of the present application is exemplified. The graph data processing method is further introduced below based on an application scenario. Figure 3 is a flowchart of another graph data processing method provided according to an embodiment of the present application. Figure 3 As shown, in the embodiment of the present application, the method is executed by a server and applied to a social scene as an example. The graph data processing method includes the following steps:
[0084] 301. Based on the object data, obtain a target graph, where the target graph includes M nodes representing objects, where M is a positive integer. The directed edges in the target graph are used to indicate that a business relationship exists between objects corresponding to the connected nodes, and the pointing node of the directed edge is the initiator of the business relationship, and the pointing node of the directed edge is the recipient of the business relationship.
[0085] In the embodiments of the present application, the object data includes object information and relationship information. The object information is used to represent the attributes of the object, and the relationship information is used to represent the business relationships between objects. When the object data is user account data, the user account data includes user account information and account relationship information. The user account information includes user account attributes such as user account ID and user account level. The account relationship information includes business relationships between the user account and other user accounts. The embodiments of the present application do not limit the content of the object data.
[0086] In an embodiment of the present application, the server is able to construct a target graph based on the above-mentioned object data, and the target graph includes M nodes and directed edges between the M nodes. The M nodes represent M different user accounts included in the object data, and M is a positive integer. Among the M nodes, the directed edge between any two nodes is used to indicate that there is a business relationship between the user accounts corresponding to the two nodes, such as a friend relationship, a group relationship, a collection relationship, and a transfer relationship. For any directed edge, the node pointing to the directed edge is the initiator of the business relationship represented by the directed edge, and the node to which the directed edge points is the recipient of the business relationship represented by the directed edge.
[0087] For example, Figure 4 is a schematic diagram of a directed graph provided according to an embodiment of the present application. Figure 4 As shown, the directed graph exemplarily shows six nodes, A, B, C, D, E, and F, representing user accounts. Taking node C as an example, node C points to two directed edges, both of which point back to node C. Node C acts as the recipient of the business relationship with respect to nodes A and B, also known as the target role. With respect to nodes E and F, node C acts as the initiator of the business relationship, also known as the source role. For example, if the user accounts represented by nodes A and B each initiate a transfer transaction to the user account represented by node C, nodes A and B are the initiators of the transfer transaction, and node C is the recipient of the transfer transaction. If the user account represented by node C creates a group that includes the user account represented by node E, node C is the initiator of the group transaction, and node E is the recipient of the group transaction. If the user account represented by node C saves content posted by the user account represented by node F, node C is the initiator of the saved transaction, and node F is the recipient of the saved transaction.
[0088] In some embodiments, the server can also send the object data to a graph creation server, which can then create a target graph based on the object data. Of course, the server can also retrieve a target graph already created based on the object data from a local database. This embodiment of the present application does not restrict the source of the target graph.
[0089] In an embodiment of the present application, the server can perform multiple rounds of iterations based on the M nodes and the directed edges between them to determine the characteristics of each node when it is the initiator of the business relationship, as well as the characteristics of each node when it is the recipient of the business relationship. During each round of iteration, the server can process the M nodes separately, or adopt a distributed processing approach, using multiple executors to process some of the M nodes separately, to improve processing efficiency.
[0090] In some embodiments, the server can partition the target graph into at least one graph partition, each of which includes multiple nodes and directed edges between the multiple nodes. For each graph partition, the server stores the nodes in the graph partition in a parameter server and stores the edge table corresponding to the graph partition in the executor corresponding to the graph partition. By partitioning the target graph into graph partitions and distributing the nodes in the parameter server, the server can implement distributed computing across multiple executors, significantly improving the efficiency of graph embedding.
[0091] The server is equipped with multiple executors that can synchronously execute graph data processing tasks. For example, any executor can use mini-batch stochastic gradient descent to determine the embedding features of each node in the graph partition. In each iteration, the executor can obtain N nodes from the corresponding graph partition, where N is a positive integer.
[0092] The following is an introduction taking the zth round of iteration of any actuator as an example, where z is a positive integer. Steps 302 to 307 exemplify one implementation of the zth round of iteration, and steps 302, 303, and 308 to 310 exemplify another implementation of the zth round of iteration.
[0093] 302. Obtain N nodes from the M nodes, where N is a positive integer.
[0094] In an embodiment of the present application, the server can sample the above-mentioned M nodes to obtain N nodes, and the N nodes are the nodes to be processed in the zth round of iteration.
[0095] In some embodiments, each executor obtains N nodes for processing. For any executor, the server uses the Alias Table method based on the edge table stored by the executor to sample multiple sampling edges from the target graph, and the nodes connected by the multiple sampling edges are the above-mentioned N nodes. The server can determine N node identifiers based on the multiple sampling edges, and then obtain N nodes corresponding to the N node identifiers from the parameter server. Of course, the server can also use other methods to determine the sampling edges, or directly sample nodes, and the embodiments of the present application are not limited to this.
[0096] 303. Based on the directed edges associated with the N nodes, determine multiple first neighboring nodes associated with the N nodes and multiple second neighboring nodes associated with the N nodes, the directed edges indicated by the first neighboring nodes point to the N nodes, and the directed edges indicated by the N nodes point to the multiple second neighboring nodes.
[0097] In an embodiment of the present application, for any node, the server is able to model the neighborhood of the node, and according to the dual identity of the node, the neighborhood of the node is divided into a first neighborhood and a second neighborhood, and then at least one first neighborhood node associated with the node is obtained from the first neighborhood, and at least one second neighborhood node associated with the node is obtained from the second neighborhood. Wherein, the directed edge between the first neighborhood node in the first neighborhood and the node points to the node; the directed edge between the second neighborhood node in the second neighborhood and the node is pointed out by the node. It should be noted that, according to the distance between the node and the node, the neighborhood of the node is divided into 1 order to R order (also referred to as 1-hop neighbor to R-hop neighbor), and R is a positive integer. Wherein, the first neighborhood can also be referred to as the source neighborhood, and the second neighborhood can also be referred to as the target neighborhood.
[0098] For example, taking the business relationship as a transfer relationship, for any node, the user account represented by at least one first neighboring node associated with the node transfers money to the user account represented by the node; the user account represented by at least one second neighboring node associated with the node receives the transfer from the user account represented by the node.
[0099] For any node v n , the representation of the first and second neighbors of the node in order R is shown in formula (1) and formula (2):
[0100]
[0101] Among them, N s (v n ) represents node v n The first neighbor within the R order of ; Represents node v n The first-order neighbor of ; Represents node v n The second-order first neighbor of ; Represents node v n The R-order first neighbor of , where R is a positive integer.
[0102]
[0103] Among them, N t (v n ) represents node v n The second neighbor of order R; Represents node vn The first-order second neighbor of ; Represents node v n The second-order second neighbor of ; Represents node v n The R-order second neighborhood of , where R is a positive integer.
[0104] For example, Figure 5 This is a schematic diagram of a directed graph neighborhood definition provided according to an embodiment of the present application. Figure 5 As shown in the figure, the first-order first neighborhood of node A includes nodes B, C, and D, and the second-order first neighborhood of node A includes nodes H and I; the first-order second neighborhood of node A includes nodes E, F, and G, and the second-order second neighborhood of node A includes nodes J and K. The directed edge between any node in the first-order first neighborhood and node A points to node A, and the directed edge connecting any node in the second-order first neighborhood points to a node in the first-order first neighborhood; the directed edge between any node in the first-order second neighborhood and node A is pointed out by node A, and the directed edge connecting any node in the second-order second neighborhood is pointed out by a node in the first-order second neighborhood.
[0105] It should be noted that the embodiments of the present application provide two implementation methods. The first implementation method determines the embedding features of the node based on the probability information of the first neighboring node and the second neighboring node of the node, as shown in steps 304 to 307; the second implementation method determines the embedding features of the node by negatively sampling the first neighboring node and the second neighboring node of the node, as shown in steps 308 to 310.
[0106] 304. Determine first probability information based on the first embedding features of the N nodes and the second embedding features of the multiple first neighboring nodes, where the first probability information is used to indicate a probability of determining the multiple first neighboring nodes based on the N nodes.
[0107] In the embodiment of the present application, for the node v in the graph n , in the embedding space, the node v n There is an initiating embedding feature s n (also called the source role representation vector) and a receiving embedding feature t n (Also called the target role representation vector), the ultimate goal is to determine the initiating embedding matrix S′ consisting of the initiating embedding features of the M nodes in the target graph and the receiving embedding matrix T′ consisting of the receiving embedding features of the M nodes. Among them, the elements in the initiating embedding matrix S′ represent the initiating embedding features of each node in the target graph, and the elements in the receiving embedding matrix T′ represent the receiving embedding features of each node in the target graph.
[0108] In an embodiment of the present application, the first embedded feature refers to the embedded feature of the N nodes. For any node in the N nodes, the first embedded feature of the node includes the initiating embedded feature of the node and the receiving embedded feature of the node. Each of the N nodes corresponds to at least one first neighboring node. The second embedded feature refers to the embedded feature of the multiple first neighboring nodes. For any first neighboring node, the second embedded feature of the first neighboring node includes the initiating embedded feature of the first neighboring node and the receiving embedded feature of the first neighboring node.
[0109] In some embodiments, for node v n , based on the node v n Determine the first neighboring node v of the node i When the node v n As the recipient of the business relationship, the first neighbor node v i For the initiator of the business relationship, the node v is defined based on the softmax (normalization) function. n Determine the first neighbor node v in the entire target graph i The server obtains the first probability information based on the probability of the first embedding features of the N nodes and the second embedding features of the multiple first neighborhood nodes. The server determines the first probability information based on the first embedding features of the N nodes and the second embedding features of the multiple first neighborhood nodes. The steps include: the server obtains N first intermediate embedding features from the first embedding features of the N nodes, and the N first intermediate embedding features are used to represent the features of the N nodes as the receivers, that is, the receiving embedding features of the N nodes. The server obtains multiple second intermediate embedding features from the second embedding features of the multiple first neighborhood nodes, and the multiple second intermediate embedding features are used to represent the features of the multiple first neighborhood nodes as the initiators, that is, the initiating embedding features of the multiple first neighborhood nodes. The server obtains the M seventh intermediate embedding features of the M nodes, and the M seventh intermediate embedding features are used to represent the features of the M nodes as the initiators, that is, the initiating embedding features of the node. Finally, based on the N first intermediate embedding features, the multiple second intermediate embedding features and the M seventh intermediate embedding features, the first probability information is determined. Accordingly, the calculation method of the first probability information is shown in formula (3):
[0110]
[0111] Among them, p s (v i |v n ) represents the first probability information, based on the node v n Determine the first neighbor node v in the entire target graph i The probability of; exp(·) represents the exponential function with e as the base; t n Represents node v nThe first intermediate embedding feature of ; T represents the matrix transpose; s i Represents the first neighbor node v i The second intermediate embedding feature of ; M represents the total number of nodes in the target graph, M is a positive integer; s m Represents node v m The seventh intermediate embedding feature of node v m Represents the mth node in the target graph.
[0112] 305. Determine second probability information based on the first embedding features of the N nodes and the third embedding features of the multiple second neighboring nodes, where the second probability information is used to indicate a probability of determining the multiple second neighboring nodes based on the N nodes.
[0113] In the embodiment of the present application, similarly to step 304, for node v n , based on the node v n Determine the second neighboring node v of the node j When the node v n As the initiator of the business relationship, the second neighbor node v j For the receiver of the business relationship, the node v is defined based on the softmax function. n Determine the second neighbor node v in the entire target graph j The probability of , and the second probability information is obtained.
[0114] In this embodiment of the present application, each of the N nodes corresponds to at least one second neighboring node. The third embedded feature refers to the embedded features of the multiple second neighboring nodes. For any second neighboring node, the third embedded feature of the second neighboring node includes the initiating embedded feature of the second neighboring node and the receiving embedded feature of the second neighboring node.
[0115] The server determines the second probability information based on the first embedding features of the N nodes and the third embedding features of the multiple second neighborhood nodes, including the following steps: the server obtains N fourth intermediate embedding features from the first embedding features of the N nodes, and the N fourth intermediate embedding features are used to represent the features of the N nodes as the initiators, that is, the initiating embedding features of the N nodes. The server obtains multiple fifth intermediate embedding features from the third embedding features of the multiple second neighborhood nodes, and the multiple fifth intermediate embedding features are used to represent the features of the multiple second neighborhood nodes as the receivers, that is, the receiving embedding features of the multiple second neighborhood nodes. The server obtains M eighth intermediate embedding features of the M nodes, and the M eighth intermediate embedding features are used to represent the features of the M nodes as the receivers, that is, the receiving embedding features of the M nodes. Finally, based on the N fourth intermediate embedding features, the multiple fifth intermediate embedding features and the M eighth intermediate embedding features, the second probability information is determined. Accordingly, the calculation method of the second probability information is shown in formula (4):
[0116]
[0117] Among them, p t (v j |v n ) represents the second probability information, based on the node v n Determine the second neighbor node v in the entire target graph j The probability of; exp(·) represents the exponential function with e as the base; s n Represents node v n The fourth intermediate embedding feature of ; T represents the matrix transpose; t j Represents the second neighboring node v j The fifth intermediate embedding feature of t; M represents the total number of nodes in the target graph, M is a positive integer; m Represents node v m The eighth intermediate embedding feature of node v m Represents the mth node in the target graph.
[0118] 306. Determine a second objective function based on the first probability information and the second probability information.
[0119] In the embodiment of the present application, in order to maximize the preservation of information in the first and second neighborhoods of a node, the objective function is constructed using the idea of maximum likelihood estimation. For a given node v n The goal of multiple iterations is to maximize the value of v based on the node n Determine the node v n The likelihood function of the neighbor nodes includes the first neighbor node and the second neighbor node. Assume that node v nThe probability of determining neighbor nodes is independent of each other, so the likelihood function is shown in formula (5):
[0120]
[0121] in, represents the maximum likelihood function; S′ represents the initiating embedding matrix; T′ represents the receiving embedding matrix; N s (v n ) represents node v n The first neighbor within the R order; N t (v n ) represents node v n The second neighborhood of R order; П(·) represents the continuous multiplication function; p s (v i |v n ) represents the first probability information, based on the node v n Determine the first neighbor node v in the entire target graph i The probability of p t (v j |v n ) represents the second probability information, based on the node v n Determine the second neighbor node v in the entire target graph j probability.
[0122] In some embodiments, the server can convert the maximization problem in the above formula (5) into a minimization problem based on the negative log likelihood function, thereby obtaining a second objective function, which is shown in formula (6):
[0123]
[0124] Among them, L likelihood represents the negative log-likelihood function; N s (v n ) represents node v n The first neighbor within the R order; N t (v n ) represents node v n The second neighbor of order R; v i represents the first neighboring node; v j represents the second neighboring node; log(·) represents the logarithmic function; exp(·) represents the exponential function with e as the base; t n Represents node v n The first intermediate embedding feature of ; T represents the matrix transpose; s i Represents the first neighbor node v iThe second intermediate embedding feature of ; M represents the total number of nodes in the target graph, M is a positive integer; s m Represents node v m The seventh intermediate embedding feature of node v m represents the mth node in the target graph; s n Represents node v n The fourth intermediate embedding feature of t j Represents the second neighboring node v j The fifth intermediate embedding feature of t m Represents node v m The eighth intermediate embedding feature of .
[0125] 307. Optimize the second objective function to obtain fourth embedding features of the N nodes.
[0126] In an embodiment of the present application, the server can iterate based on the second objective function to obtain a fourth embedding feature of the N nodes. The fourth embedding feature represents the initiating embedding feature and the receiving embedding feature of the N nodes after iterative update. Since the optimization goal of the second objective function is minimization, the server performs multiple rounds of iterations based on the stochastic gradient descent method to obtain the initiating embedding feature and the receiving embedding feature of the N nodes.
[0127] In some embodiments, due to the high complexity of directly optimizing the second objective function, the server can implement optimization using negative sampling contrastive learning. Accordingly, by executing steps 308-310 instead of steps 304-307, the server can transform the problem of optimizing the second objective function into the problem of optimizing the first objective function. The first objective function is described in detail in steps 308-310.
[0128] It should be noted that for the node v in the graph n , the node v n The first neighborhood and the second neighborhood have different negative sample distributions, and the first neighborhood includes the node v n The first neighbor node v i , the second neighborhood includes node v n The second neighboring node v j When the node v n When negatively sampling the first neighborhood of , negative sampling focuses on the directed edge pointing to node v n The first neighbor node v i , then we get the node in-degree distribution information, which means pointing to the current node v n The distribution of the number of directed edges of the node v n When negative sampling is performed on the second neighborhood of , the negative sampling focuses on node v n The second neighboring node v pointed to by the directed edgej , then we get the node out-degree distribution information, which means that the current node v n The distribution of the number of directed edges indicated by . The calculation method of node in-degree distribution information and node out-degree distribution information is shown in formula (7) and formula (8):
[0129]
[0130] in, Indicates the node in-degree distribution information, pointing to node v n The distribution of the number of directed edges of ; Indicates pointing to node v n The number of directed edges; M represents the total number of nodes in the target graph, M is a positive integer; Indicates pointing to node v m The number of directed edges of node v m Represents the mth node in the target graph.
[0131]
[0132] in, In the node out-degree distribution information, node v n The distribution of the number of directed edges indicated; Represents node v n The number of directed edges indicated; M represents the total number of nodes in the target graph, and M is a positive integer; Represents node v m The number of directed edges indicated by node v m Represents the mth node in the target graph.
[0133] 308. Determine a first function based on the first embedding features of the N nodes, the second embedding features of the multiple first neighborhood nodes, node in-degree distribution information, and the fifth embedding features of the multiple first nodes. The node in-degree distribution information is used to represent the distribution of the node in-degrees of the N nodes. The multiple first nodes are obtained based on negative sampling of the first neighborhood of the N nodes, and the first neighborhood includes the multiple first neighborhood nodes.
[0134] In the embodiment of the present application, after obtaining the node in-degree distribution information, the server can obtain the first embedding features of the N nodes after the z-1th round of iteration, the second embedding features of the multiple first neighboring nodes, and the fifth embedding features of the multiple first nodes from the parameter server, and then determine the first function based on the above features obtained. n , in the embedding space, the node v n Corresponding to an initiating embedding feature s n and a receiving embedding feature t n, the ultimate goal is to determine the initiating embedding matrix S′, which is composed of the initiating embedding features of the M nodes in the target graph, and the receiving embedding matrix T′, which is composed of the receiving embedding features of the M nodes. The elements in the initiating embedding matrix S′ represent the initiating embedding features of each node in the target graph, and the elements in the receiving embedding matrix T′ represent the receiving embedding features of each node in the target graph.
[0135] In an embodiment of the present application, the fifth embedded feature refers to the embedded feature of the multiple first nodes. For any first node, the fifth embedded feature of the first node includes the initiating embedded feature of the first node and the receiving embedded feature of the first node.
[0136] For node v n , based on the node v n Determine the first neighboring node v of the node i When the node v n As the recipient of the business relationship, the first neighbor node v i is the initiator of the business relationship. For example, if the business relationship is a transfer, the first neighbor node v i The user accounts represented by are all transferred to node v n Based on the node in-degree distribution information obtained by negative sampling, the first function can be determined.
[0137] In some embodiments, the server determines the first function based on the first embedding features of the N nodes, the second embedding features of the multiple first neighboring nodes, the node in-degree distribution information, and the fifth embedding features of the multiple first nodes, including: the server obtains N first intermediate embedding features from the first embedding features of the N nodes, the N first intermediate embedding features used to represent the characteristics of the N nodes as the receivers, that is, the receiving embedding features of the N nodes. The server obtains multiple second intermediate embedding features from the second embedding features of the multiple first neighboring nodes, the multiple second intermediate embedding features used to represent the characteristics of the multiple first neighboring nodes as the initiators, that is, the initiating embedding features of the multiple first neighboring nodes. The server determines first expected information based on the node in-degree distribution information, the first expected information used to represent that the multiple first nodes meet the mathematical expectation of the node in-degree distribution information. The server obtains multiple third intermediate embedding features from the fifth embedding features of the multiple first nodes, the multiple third intermediate embedding features used to represent the characteristics of the multiple first nodes as the initiators, that is, the initiating embedding features of the multiple first nodes. Finally, the server determines a first function based on the N first intermediate embedding features, the multiple second intermediate embedding features, the first desired information, and the multiple third intermediate embedding features. Determining the first function based on the node in-degree distribution information obtained through negative sampling significantly reduces computational complexity because it does not require computation based on the embedding features of all nodes in the target graph, thereby improving computational efficiency and conserving computing resources.
[0138] The first function is shown in formula (9):
[0139]
[0140] Among them, L1 represents the first function, N s (v n ) represents node v n The first neighbor of order R; v i represents the first neighbor node; log(·) represents the logarithmic function; σ(·) represents the sigmoid function, t n Represents node v n The first intermediate embedding feature of ; T represents the matrix transpose; s i Represents the first neighbor node v i The second intermediate embedding feature of ; K represents the number of first nodes obtained by negative sampling of the first neighborhood, and K is a positive integer; Indicates the first expected information; v k represents the kth first node; Indicates the node in-degree distribution information, pointing to node v n The distribution of the number of directed edges of s k Represents the first node vk The third intermediate embedding feature of .
[0141] 309. Determine a second function based on the first embedding features of the N nodes, the third embedding features of the multiple second neighborhood nodes, the node out-degree distribution information, and the sixth embedding features of the multiple second nodes. The node out-degree distribution information is used to indicate the distribution of the node out-degrees of the N nodes. The multiple second nodes are obtained based on negative sampling of the second neighborhood of the N nodes, and the second neighborhood includes the multiple second neighborhood nodes.
[0142] In the embodiment of the present application, similarly to step 308, for node v n , based on the node v n Determine the second neighboring node v of the node j When the node v n As the initiator of the business relationship, the second neighbor node v j is the recipient of the business relationship. For example, if the business relationship is a transfer, the second neighbor node v j The user accounts represented by each received node v n Based on the node out-degree distribution information obtained by negative sampling, the second function can be determined.
[0143] In an embodiment of the present application, the sixth embedded feature refers to the embedded feature of the multiple second nodes. For any second node, the sixth embedded feature of the second node includes the initiating embedded feature of the second node and the receiving embedded feature of the second node.
[0144] In some embodiments, the server determines the second function based on the first embedding features of N nodes, the third embedding features of multiple second neighboring nodes, the node out-degree distribution information, and the sixth embedding features of multiple second nodes. The server obtains N fourth intermediate embedding features from the first embedding features of the N nodes, the N fourth intermediate embedding features used to represent the characteristics of the N nodes as initiators, that is, the initiating embedding features of the N nodes. The server obtains multiple fifth intermediate embedding features from the third embedding features of the multiple second neighboring nodes, the multiple fifth intermediate embedding features used to represent the characteristics of the multiple second neighboring nodes as receivers, that is, the receiving embedding features of the multiple neighboring nodes. The server determines second expected information based on the node out-degree distribution information, the second expected information used to represent that the multiple second nodes meet the mathematical expectation of the node out-degree distribution information. The server obtains multiple sixth intermediate embedding features from the embedding features of the multiple second nodes, the multiple sixth intermediate embedding features used to represent the characteristics of the multiple second nodes as receivers, that is, the receiving embedding features of the multiple second nodes. Finally, the server determines the second function based on the N fourth intermediate embedding features, the plurality of fifth intermediate embedding features, the second desired information, and the plurality of sixth intermediate embedding features. Determining the second function based on the node out-degree distribution information obtained through negative sampling significantly reduces computational complexity because it does not require computation based on the embedding features of all nodes in the target graph, thereby improving computational efficiency and conserving computing resources.
[0145] The second function is shown in formula (10):
[0146]
[0147] Among them, L2 represents the second function, N t (v n ) represents node v n The second neighbor of order R; v j represents the second neighboring node; log(·) represents the logarithmic function; σ(·) represents the sigmoid function, s n Represents node v n The fourth intermediate embedding feature of ; T represents the matrix transpose; t j Represents the second neighboring node v j The fifth intermediate embedding feature of ; L represents the number of second nodes obtained by negative sampling of the first neighborhood, and L is a positive integer; Indicates the second expected information; v l Indicates the first second node; In the node out-degree distribution information, node v n The distribution of the number of directed edges indicated; t l Represents the second node v lThe sixth intermediate embedding feature of .
[0148] 310. Optimize a first objective function based on the first function and the second function to obtain fourth embedding features of the N nodes.
[0149] In an embodiment of the present application, the server can construct a first objective function based on the first function and the second function. The first objective function is shown in formula (11):
[0150] L neg =L1+L2 (11);
[0151] Among them, L neg represents the first objective function; L1 represents the first function; L2 represents the second function.
[0152] The server uses a small batch stochastic gradient descent method to optimize the first objective function based on multiple rounds of iterations to obtain the fourth embedding features of the N nodes.
[0153] In some embodiments, by preserving first-order neighbors, the desired effect can be achieved on highly sparse graph data. Furthermore, by preserving the first-order first and second-order neighbors of a node, summing the neighborhood of a node in the first objective function is equivalent to summing all edges in the graph. Therefore, the server can transform the first objective function into a third objective function.
[0154] Among them, the third objective function is a function expressed from the perspective of the edge. For a directed edge (v x , v y ), node v x is the initiator of the business relationship corresponding to the directed edge, node v y The receiver of the business relationship corresponding to the directed edge, that is, node v x Playing the source role, node v y Play the role of the target. When observing the directed edge (v x , v y ), focus on node v x Determine node v y The probability of node v x Negative sampling is performed on the first-order second neighborhood to obtain the negative sampling node v f ; Observe the directed edge (v x , v y ), focus on node v y Determine node v x The probability of node v y Negative sampling is performed on the first-order first neighborhood to obtain the negative sampling node v g, that is, considering information in both positive and negative directions at the same time, the algorithm corresponding to the third objective function can be called a bidirectional graph embedding algorithm (Bidirectional Graph Embedding, BGE).
[0155] Among them, the third objective function is shown in formula (12):
[0156]
[0157] Wherein, L3 represents the third objective function; (v x , v y ) represents the node v in the target graph x and node v y There is a directed edge between nodes v x Points to node v y ;E graph represents the set of directed edges in the target graph; log(·) represents the logarithmic function; σ(·) represents the sigmoid function; s x Represents node v x The initiated embedding feature; T represents the matrix transpose; t y Represents node v y The received embedding features; F represents the embedding features of node v x Negative sampling is performed on the first-order second neighborhood to obtain the negative sampling node v f The number of , F is a positive integer; Indicates the node out-degree distribution information, node v x The distribution of the number of directed edges indicated; t f Represents node v f The received embedding features; G represents the embedding features of node v y Negative sampling is performed on the first-order first neighborhood to obtain the negative sampling node v g The number of , G is a positive integer; Indicates the node in-degree distribution information, pointing to node v y The distribution of the number of directed edges of s g Represents node v g The initiated embedding feature.
[0158] It should be noted that the server performs step 311 after performing multiple rounds of iterations based on the implementation methods shown in steps 302 to 307 above, or the server performs step 311 after performing multiple rounds of iterations based on the implementation methods shown in steps 302, 303, and 308 to 310 above.
[0159] 311. In response to the completion of multiple rounds of iterations, the initiating embedded features and receiving embedded features corresponding to the M nodes are obtained, where the initiating embedded features are used to represent the features of the corresponding nodes as initiators, and the receiving embedded features are used to represent the features of the corresponding nodes as receivers.
[0160] In an embodiment of the present application, the server ends the iteration after the target number of iterations, and obtains the initiating embedded features of each node in the target graph as an initiator and the receiving embedded features of each node as a receiver.
[0161] In some embodiments, for any node, the server can splice the node's initiating embedded features and receiving embedded features with the account features of the user account represented by the node, and then determine whether there is a risk in the business between the node and other nodes based on the spliced features. For example, when the user account corresponding to the node initiates a transfer request to the user account corresponding to another node, the server can splice the corresponding initiating embedded features and receiving embedded features based on the account features of the above two user accounts, and input the spliced features into the anti-fraud model to determine whether the transfer request is a fraudulent business. By introducing the embedded features obtained based on the graph data processing method provided in the embodiment of the present application into the anti-fraud model, the anti-fraud model's fraud hit rate is relatively improved by 14%-21%, and the hit rate of the fraud amount is relatively improved by 27%-47%. In addition, the graph data processing method provided by the present application is 2-5 times more efficient than the existing technical solution in obtaining the embedded features of the node, and the efficiency is significantly improved.
[0162] It should be noted that in order to make the process of the distributed execution of the graph data processing method provided by the embodiment of the present application easier to understand, see Figure 6 As shown, Figure 6 This is a schematic diagram of a distributed computing architecture provided according to an embodiment of the present application. Figure 6In the distributed computing architecture, multiple executors and multiple parameter servers are included. The server partitions the target graph, stores the edge tables corresponding to each graph partition in the executor, and stores the nodes corresponding to each graph partition in the corresponding parameter server. Each node has two embedding features, one representing the embedding feature of the node as a source role, and the other representing the embedding feature of the node as a target role. The parameter server initializes the embedding features of each node, and each executor pulls the first embedding features of N nodes, the second embedding features of multiple first neighboring nodes, and the third embedding features of multiple second neighboring nodes from the parameter server in batches within the corresponding graph partition to determine the N feature gradients of the N nodes. The N feature gradients are then uploaded to the parameter server, and the parameter server determines the fourth embedding features of the N nodes based on the first embedding features and N feature gradients of the N nodes to update the embedding features of the nodes. The process ends after iterating to the target number of rounds.
[0163] It should be noted that the graph data processing method provided in the embodiment of the present application can also be combined with existing models to implement different businesses. In combination with the recommendation model, for example, when applied to a social scenario, the initiating embedded features and receiving embedded features of the node obtained based on the graph data processing method provided in the embodiment of the present application are introduced into the friend recommendation model, so that the recommendation model can more accurately recommend friends to users. For example, when applied to a shopping scenario, the initiating embedded features and receiving embedded features of the node obtained based on the graph data processing method provided in the embodiment of the present application are introduced into the item recommendation model, so that the recommendation model can more accurately recommend goods to users. I will not give examples one by one here.
[0164] It should be noted that the embodiment of the present application is described with one type of business relationship between nodes. Since there may be multiple types of business relationships between objects in the object data, such as a transfer relationship and a follow relationship between Object A and Object B, and a transfer relationship and a like relationship between Object A and Object C, since the follow relationship and the like relationship belong to the same type of business relationship, they usually occur in the same business scenario, such as a live broadcast scene; while the transfer relationship and the above two relationships belong to different types of business relationships, and usually occur in different business scenarios, such as a transfer relationship occurring in a social scene. Therefore, the server can determine multiple target graphs based on the graph data according to the relationship type between the nodes. The directed edges in the same target graph represent the same type of business relationship, and the directed edges in different target graphs represent different types of business relationships. Based on the graph data processing method provided in the embodiment of the present application, the server processes the multiple target graphs separately, and then splices or weightedly fuses the initiating embedding features and receiving embedding features obtained for the same node based on different target graphs to obtain the final initiating embedding features and receiving embedding features of the node. By processing according to different types of business relationships, when a node has more than two identities, it is possible to determine the embedded features of multiple identities, thereby facilitating the use of the embedded features of corresponding identities for different business scenarios.
[0165] An embodiment of the present application provides a novel graph data processing method, which obtains N nodes from the target graph in each round of iteration, and then determines the fourth embedding features of the N nodes based on the first embedding features of the N nodes, the second embedding features of multiple first neighboring nodes associated with the N nodes, and the third embedding features of multiple second neighboring nodes, thereby completing a round of iteration and updating the embedding features of the N nodes. Since M nodes are not processed, the amount of calculation can be greatly reduced. After multiple rounds of iteration, the initiating embedding features of the M nodes as initiators and the receiving embedding features of the M nodes as receivers can be obtained, so that the embedding features of each node can maximize the preservation of information of the first neighborhood and the second neighborhood, and then the directional relationship of the directed edge can be determined based on the inner product between the embedding features of the two nodes connected by the directed edge, thereby representing both the dual identity of the node and the directional relationship of the directed edge.
[0166] Figure 7 This is a block diagram of a graph data processing device provided according to an embodiment of the present application. The device is used to perform the steps in the above-mentioned graph data processing method, see Figure 7 The device includes: a graph acquisition module 71 and an iteration module 72, wherein the iteration module 72 includes an acquisition unit 721, a node determination unit 722 and a feature determination unit 723.
[0167] A graph acquisition module 71 is configured to acquire a target graph based on the object data. The target graph includes M nodes representing objects, where M is a positive integer. A directed edge in the target graph indicates that a business relationship exists between objects corresponding to the connected nodes. The node pointing out of the directed edge is the initiator of the business relationship, and the node to which the directed edge points is the recipient of the business relationship.
[0168] an iterative module 72, configured to perform multiple rounds of iteration based on the directed edges between the M nodes to obtain an initiating embedded feature and a receiving embedded feature corresponding to the M nodes, wherein the initiating embedded feature is used to represent a feature of the corresponding node as an initiator, and the receiving embedded feature is used to represent a feature of the corresponding node as a receiver;
[0169] The iteration module 72 includes:
[0170] An acquiring unit 721 is configured to acquire N nodes from the M nodes, where N is a positive integer;
[0171] a node determination unit 722 configured to determine, based on the directed edges associated with the N nodes, a plurality of first neighboring nodes associated with the N nodes and a plurality of second neighboring nodes associated with the N nodes, wherein the directed edges indicated by the first neighboring nodes point to the N nodes, and the directed edges indicated by the N nodes point to the plurality of second neighboring nodes;
[0172] The feature determination unit 723 is configured to determine fourth embedding features of the N nodes based on the first embedding features of the N nodes, the second embedding features of the plurality of first neighboring nodes, and the third embedding features of the plurality of second neighboring nodes.
[0173] In some embodiments, Figure 8 is a block diagram of another graph data processing device provided according to an embodiment of the present application, see Figure 8 As shown, the feature determination unit 723 includes:
[0174] A first determining subunit 7231 is configured to determine a first function based on the first embedding features of the N nodes, the second embedding features of the multiple first neighborhood nodes, node in-degree distribution information, and fifth embedding features of the multiple first nodes, wherein the node in-degree distribution information is used to represent the distribution of node in-degrees of the N nodes, the multiple first nodes are obtained based on negative sampling of a first neighborhood of the N nodes, and the first neighborhood includes the multiple first neighborhood nodes.
[0175] A second determining subunit 7232 is configured to determine a second function based on the first embedding features of the N nodes, the third embedding features of the plurality of second-neighboring nodes, node out-degree distribution information, and a sixth embedding feature of the plurality of second nodes, wherein the node out-degree distribution information is used to represent the distribution of the node out-degrees of the N nodes, the plurality of second nodes are obtained based on negative sampling of a second neighborhood of the N nodes, the second neighborhood including the plurality of second-neighboring nodes;
[0176] The first optimization subunit 7233 is configured to optimize a first objective function based on the first function and the second function to obtain fourth embedded features of the N nodes.
[0177] In some embodiments, see Figure 8 As shown, the first determination subunit 7231 is used to obtain N first intermediate embedded features from the first embedded features of the N nodes, and the N first intermediate embedded features are used to represent the features of the N nodes as the receivers; obtain multiple second intermediate embedded features from the second embedded features of the multiple first neighborhood nodes, and the multiple second intermediate embedded features are used to represent the features of the multiple first neighborhood nodes as the initiators; determine first expected information based on the node in-degree distribution information, and the first expected information is used to represent that the multiple first nodes meet the mathematical expectation of the node in-degree distribution information; obtain multiple third intermediate embedded features from the fifth embedded features of the multiple first nodes, and the multiple third intermediate embedded features are used to represent the features of the multiple first nodes as the initiators; determine the first function based on the N first intermediate embedded features, the multiple second intermediate embedded features, the first expected information and the multiple third intermediate embedded features.
[0178] In some embodiments, the second determination subunit 7232 is used to obtain N fourth intermediate embedded features from the first embedded features of the N nodes, and the N fourth intermediate embedded features are used to represent the features of the N nodes as the initiators; obtain multiple fifth intermediate embedded features from the third embedded features of the multiple second neighboring nodes, and the multiple fifth intermediate embedded features are used to represent the features of the multiple second neighboring nodes as the receivers; determine second expected information based on the node out-degree distribution information, and the second expected information is used to represent that the multiple second nodes meet the mathematical expectation of the node out-degree distribution information; obtain multiple sixth intermediate embedded features from the embedded features of the multiple second nodes, and the multiple sixth intermediate embedded features are used to represent the features of the multiple second nodes as the receivers; determine the second function based on the N fourth intermediate embedded features, the multiple fifth intermediate embedded features, the second expected information and the multiple sixth intermediate embedded features.
[0179] In some embodiments, the feature determination unit 723 includes:
[0180] A third determining subunit 7234 is configured to determine, based on the first embedding features of the N nodes and the second embedding features of the plurality of first neighboring nodes, first probability information indicating a probability of determining the plurality of first neighboring nodes based on the N nodes;
[0181] a fourth determining subunit 7235, configured to determine, based on the first embedding features of the N nodes and the third embedding features of the plurality of second neighboring nodes, second probability information indicating a probability of determining the plurality of second neighboring nodes based on the N nodes;
[0182] a fifth determining subunit 7236, configured to determine a second objective function based on the first probability information and the second probability information;
[0183] The second optimization subunit 7237 is configured to optimize the second objective function to obtain fourth embedding features of the N nodes.
[0184] In some embodiments, the third determination subunit 7234 is used to obtain N first intermediate embedded features from the first embedded features of the N nodes, and the N first intermediate embedded features are used to represent the features of the N nodes as the receivers; obtain multiple second intermediate embedded features from the second embedded features of the multiple first neighboring nodes, and the multiple second intermediate embedded features are used to represent the features of the multiple first neighboring nodes as the initiators; obtain M seventh intermediate embedded features of the M nodes, and the M seventh intermediate embedded features are used to represent the features of the M nodes as the initiators; determine the first probability information based on the N first intermediate embedded features, the multiple second intermediate embedded features and the M seventh intermediate embedded features.
[0185] In some embodiments, the fourth determination subunit 7235 is used to obtain N fourth intermediate embedded features from the first embedded features of the N nodes, and the N fourth intermediate embedded features are used to represent the features of the N nodes as the initiator; obtain multiple fifth intermediate embedded features from the third embedded features of the multiple second neighboring nodes, and the multiple fifth intermediate embedded features are used to represent the features of the multiple second neighboring nodes as the receiver; obtain M eighth intermediate embedded features of the M nodes, and the M eighth intermediate embedded features are used to represent the features of the M nodes as the receiver; determine the second probability information based on the N fourth intermediate embedded features, the multiple fifth intermediate embedded features and the M eighth intermediate embedded features.
[0186] In some embodiments, see Figure 8 As shown, the device also includes:
[0187] A partitioning module 73, configured to divide the target graph into at least one graph partition;
[0188] A storage module 74 is configured to store, for any graph partition, the nodes in the graph partition in a parameter server;
[0189] The storage module 74 is further configured to store the edge table corresponding to the graph partition in the executor corresponding to the graph partition;
[0190] A sampling module 75 is configured to sample, for any executor, a plurality of sampling edges from the target graph based on an edge table stored in the executor, where the nodes connected by the plurality of sampling edges are the N nodes;
[0191] The acquiring unit 721 is configured to determine N node identifiers based on the multiple sampled edges; and acquire the N nodes corresponding to the N node identifiers from the parameter server.
[0192] In some embodiments, the feature determination unit 723 is used to determine the N feature gradients of the N nodes based on the first embedding features of the N nodes, the second embedding features of the multiple first neighboring nodes, and the third embedding features of the multiple second neighboring nodes; upload the N feature gradients to the parameter server, and the parameter server determines the fourth embedding features of the N nodes based on the first embedding features of the N nodes and the N feature gradients.
[0193] The graph data processing device provided by the embodiment of the present application obtains N nodes from the target graph in each round of iteration, and then determines the fourth embedding features of the N nodes based on the first embedding features of the N nodes, the second embedding features of multiple first neighboring nodes associated with the N nodes, and the third embedding features of multiple second neighboring nodes, thereby completing one round of iteration and updating the embedding features of the N nodes. Since it does not process M nodes, the amount of calculation can be greatly reduced. After multiple rounds of iteration, the initiating embedding features of the M nodes as initiators and the receiving embedding features of the M nodes as receivers can be obtained, so that the embedding features of each node can maximize the preservation of information about the first neighborhood and the second neighborhood, and then the directional relationship of the directed edge can be determined based on the inner product between the embedding features of the two nodes connected by the directed edge, thereby representing both the dual identity of the node and the directional relationship of the directed edge.
[0194] It should be noted that the graph data processing device provided in the above embodiment only uses the division of the above functional modules as an example to illustrate the processing of graph data. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the graph data processing device provided in the above embodiment and the graph data processing method embodiment are based on the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.
[0195] In the embodiments of the present application, the computer device can be configured as a terminal or a server. When the computer device is configured as a terminal, the terminal can be used as the execution subject to implement the technical solution provided in the embodiments of the present application. When the computer device is configured as a server, the server can be used as the execution subject to implement the technical solution provided in the embodiments of the present application. The technical solution provided in the present application can also be implemented through interaction between the terminal and the server. The embodiments of the present application do not limit this.
[0196] Figure 9 The following is a block diagram of a terminal 900 according to an embodiment of the present application. Terminal 900 may be a portable mobile terminal, such as a smartphone, tablet computer, MP3 player (Moving Picture Experts Group Audio Layer III), MP4 player (Moving Picture Experts Group Audio Layer IV), laptop computer, or desktop computer. Terminal 900 may also be referred to as user equipment, portable terminal, laptop terminal, desktop terminal, or other similar names.
[0197] Typically, the terminal 900 includes a processor 901 and a memory 902 .
[0198] The processor 901 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 901 may be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), or PLA (Programmable Logic Array). The processor 901 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 901 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 901 may also include an AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.
[0199] The memory 902 may include one or more computer-readable storage media, which may be non-transitory. The memory 902 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices and flash memory storage devices. In some embodiments, the non-transitory computer-readable storage medium in the memory 902 is used to store at least one computer program, which is used to be executed by the processor 901 to implement the graph data processing method provided in the method embodiment of the present application.
[0200] In some embodiments, terminal 900 may optionally include a peripheral device interface 903 and at least one peripheral device. The processor 901, memory 902, and peripheral device interface 903 may be connected via a bus or signal lines. Each peripheral device may be connected to peripheral device interface 903 via a bus, signal lines, or circuit boards. Specifically, the peripheral device may include at least one of a radio frequency circuit 904, a display screen 905, a camera assembly 906, an audio circuit 907, a positioning assembly 908, and a power supply 909.
[0201] The peripheral device interface 903 can be used to connect at least one I / O (Input / Output)-related peripheral device to the processor 901 and the memory 902. In some embodiments, the processor 901, the memory 902, and the peripheral device interface 903 are integrated on the same chip or circuit board; in some other embodiments, any one or two of the processor 901, the memory 902, and the peripheral device interface 903 can be implemented on separate chips or circuit boards, which is not limited in this embodiment.
[0202] The RF circuit 904 is used to receive and transmit RF (Radio Frequency) signals, also known as electromagnetic signals. The RF circuit 904 communicates with communication networks and other communication devices via electromagnetic signals. The RF circuit 904 converts electrical signals into electromagnetic signals for transmission, or converts received electromagnetic signals into electrical signals. In some embodiments, the RF circuit 904 includes an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a user identity module card, and the like. The RF circuit 904 can communicate with other terminals via at least one wireless communication protocol. Such wireless communication protocols include, but are not limited to, the World Wide Web, metropolitan area networks, intranets, various generations of mobile communication networks (2G, 3G, 4G, and 5G), wireless local area networks, and / or WiFi (Wireless Fidelity) networks. In some embodiments, the RF circuit 904 may also include circuits related to Near Field Communication (NFC), which is not limited in this application.
[0203] The display screen 905 is used to display a user interface (UI). This UI may include graphics, text, icons, videos, or any combination thereof. When the display screen 905 is a touch screen, it is also capable of collecting touch signals on or above the surface of the display screen 905. These touch signals can be input as control signals to the processor 901 for processing. In this case, the display screen 905 can also be used to provide virtual buttons and / or a virtual keyboard, also known as soft buttons and / or a soft keyboard. In some embodiments, there can be a single display screen 905, located on the front panel of the terminal 900. In other embodiments, there can be at least two display screens 905, located on different surfaces of the terminal 900 or in a foldable design. In other embodiments, the display screen 905 can be a flexible display screen, located on a curved or foldable surface of the terminal 900. Furthermore, the display screen 905 can be configured as a non-rectangular irregular shape, i.e., a special-shaped screen. The display screen 905 can be made of materials such as LCD (Liquid Crystal Display) and OLED (Organic Light-Emitting Diode).
[0204] The camera assembly 906 is used to capture images or videos. In some embodiments, the camera assembly 906 includes a front camera and a rear camera. Typically, the front camera is arranged on the front panel of the terminal, and the rear camera is arranged on the back of the terminal. In some embodiments, there are at least two rear cameras, which are any one of a main camera, a depth of field camera, a wide-angle camera, and a telephoto camera, so as to realize the fusion of the main camera and the depth of field camera to realize the background blur function, the fusion of the main camera and the wide-angle camera to realize panoramic shooting and VR (Virtual Reality) shooting function or other fusion shooting functions. In some embodiments, the camera assembly 906 may also include a flash. The flash can be a monochrome temperature flash or a dual-color temperature flash. A dual-color temperature flash refers to a combination of a warm light flash and a cold light flash, which can be used for light compensation at different color temperatures.
[0205] The audio circuit 907 may include a microphone and a speaker. The microphone is used to collect sound waves from the user and the environment, and convert the sound waves into electrical signals to be input into the processor 901 for processing, or input into the radio frequency circuit 904 to achieve voice communication. For the purpose of stereo sound collection or noise reduction, there may be multiple microphones, each located in different parts of the terminal 900. The microphone may also be an array microphone or an omnidirectional collection microphone. The speaker is used to convert electrical signals from the processor 901 or the radio frequency circuit 904 into sound waves. The speaker may be a traditional thin film speaker or a piezoelectric ceramic speaker. When the speaker is a piezoelectric ceramic speaker, it can not only convert electrical signals into sound waves audible to humans, but also convert electrical signals into sound waves inaudible to humans for purposes such as ranging. In some embodiments, the audio circuit 907 may also include a headphone jack.
[0206] Positioning component 908 is used to locate the current geographic location of terminal 900 to implement navigation or LBS (Location Based Service). Positioning component 908 can be a positioning component based on the US GPS (Global Positioning System), China's Beidou system, or Russia's Galileo system.
[0207] Power supply 909 is used to power various components in terminal 900. Power supply 909 can be AC power, DC power, a disposable battery, or a rechargeable battery. When power supply 909 includes a rechargeable battery, the rechargeable battery can be a wired rechargeable battery or a wireless rechargeable battery. A wired rechargeable battery is a battery that is charged via a wired line, while a wireless rechargeable battery is a battery that is charged via a wireless coil. The rechargeable battery can also be used to support fast charging technology.
[0208] In some embodiments, the terminal 900 further includes one or more sensors 910 , including but not limited to: an acceleration sensor 911 , a gyroscope sensor 912 , a pressure sensor 913 , a fingerprint sensor 914 , an optical sensor 915 , and a proximity sensor 916 .
[0209] The accelerometer 911 can detect the magnitude of acceleration along the three coordinate axes of the coordinate system established by the terminal 900. For example, the accelerometer 911 can be used to detect the components of gravity acceleration along the three coordinate axes. The processor 901 can control the display screen 905 to display the user interface in a landscape or portrait view based on the gravity acceleration signal collected by the accelerometer 911. The accelerometer 911 can also be used to collect game or user motion data.
[0210] The gyroscope sensor 912 can detect the orientation and rotation angle of the terminal 900. It can work with the accelerometer 911 to collect the user's 3D movements on the terminal 900. Based on the data collected by the gyroscope sensor 912, the processor 901 can implement the following functions: motion sensing (for example, changing the UI based on the user's tilt operation), image stabilization during shooting, game control, and inertial navigation.
[0211] The pressure sensor 913 can be set on the side frame of the terminal 900 and / or the lower layer of the display screen 905. When the pressure sensor 913 is set on the side frame of the terminal 900, it can detect the user's grip signal of the terminal 900, and the processor 901 performs left and right hand recognition or shortcut operations based on the grip signal collected by the pressure sensor 913. When the pressure sensor 913 is set on the lower layer of the display screen 905, the processor 901 controls the operable controls on the UI interface based on the user's pressure operation on the display screen 905. The operable controls include at least one of button controls, scroll bar controls, icon controls, and menu controls.
[0212] The fingerprint sensor 914 is used to collect the user's fingerprint. The processor 901 identifies the user's identity based on the fingerprint collected by the fingerprint sensor 914, or the fingerprint sensor 914 identifies the user's identity based on the collected fingerprint. When the user's identity is identified as a trusted identity, the processor 901 authorizes the user to perform relevant sensitive operations, such as unlocking the screen, viewing encrypted information, downloading software, making payments, and changing settings. The fingerprint sensor 914 can be set on the front, back, or side of the terminal 900. When a physical button or manufacturer logo is provided on the terminal 900, the fingerprint sensor 914 can be integrated with the physical button or manufacturer logo.
[0213] The optical sensor 915 is used to detect ambient light intensity. In one embodiment, the processor 901 can control the display brightness of the display screen 905 based on the ambient light intensity detected by the optical sensor 915. Specifically, when the ambient light intensity is high, the display brightness of the display screen 905 is increased; when the ambient light intensity is low, the display brightness of the display screen 905 is decreased. In another embodiment, the processor 901 can also dynamically adjust the shooting parameters of the camera assembly 906 based on the ambient light intensity detected by the optical sensor 915.
[0214] Proximity sensor 916, also known as a distance sensor, is typically located on the front panel of terminal 900. Proximity sensor 916 is used to detect the distance between the user and the front of terminal 900. In one embodiment, when proximity sensor 916 detects that the distance between the user and the front of terminal 900 is gradually decreasing, processor 901 controls display screen 905 to switch from the screen-on state to the screen-off state. When proximity sensor 916 detects that the distance between the user and the front of terminal 900 is gradually increasing, processor 901 controls display screen 905 to switch from the screen-off state to the screen-on state.
[0215] Those skilled in the art will understand that Figure 9 The structure shown in the figure does not constitute a limitation on the terminal 900, and the terminal 900 may include more or fewer components than shown in the figure, or combine certain components, or adopt a different component arrangement.
[0216] Figure 10 This is a structural diagram of a server provided according to an embodiment of the present application. The server 1000 may have relatively large differences due to different configurations or performances, and may include one or more processors (Central Processing Units, CPU) 1001 and one or more memories 1002, wherein the memory 1002 stores at least one computer program, and the at least one computer program is loaded and executed by the processor 1001 to implement the graph data processing method provided by the above-mentioned various method embodiments. Of course, the server may also have components such as a wired or wireless network interface, a keyboard, and an input and output interface for input and output. The server may also include other components for implementing device functions, which will not be described here.
[0217] The present application also provides a computer-readable storage medium that stores at least one computer program. The at least one computer program is loaded and executed by a processor of a computer device to implement the operations performed by the computer device in the graph data processing method of the above embodiment. For example, the computer-readable storage medium can be a read-only memory (ROM), a random access memory (RAM), a compact disc read-only memory (CD-ROM), a magnetic tape, a floppy disk, an optical data storage device, etc.
[0218] In some embodiments, the computer program involved in the embodiments of the present application may be deployed and executed on a computer device, or on multiple computer devices located at one location, or on multiple computer devices distributed at multiple locations and interconnected through a communication network. Multiple computer devices distributed at multiple locations and interconnected through a communication network may constitute a blockchain system.
[0219] The present application also provides a computer program product, including computer program code stored in a computer-readable storage medium. A processor of a computer device reads the computer program code from the computer-readable storage medium and executes the computer program code, causing the computer device to perform the graph data processing methods provided in the various optional implementations described above.
[0220] Those skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware, or by a program to instruct the relevant hardware, and the program may be stored in a computer-readable storage medium, which may be a read-only memory, a disk, or an optical disk, etc.
[0221] The above description is merely an optional embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application shall be included in the scope of protection of the present application.
Claims
1. A graph data processing method, characterized in that: The method comprises: Based on the object data, a target graph is obtained, where the target graph includes M nodes representing objects, where M is a positive integer. A directed edge in the target graph is used to indicate that a business relationship exists between objects corresponding to the connected nodes, and the pointing node of the directed edge is the initiator of the business relationship, and the pointing node of the directed edge is the recipient of the business relationship. Performing multiple rounds of iterations based on the M nodes and the directed edges between the M nodes, obtaining initiating embedded features and receiving embedded features corresponding to the M nodes, wherein the initiating embedded features are used to represent features of the corresponding node as an initiator, and the receiving embedded features are used to represent features of the corresponding node as a receiver; The steps of the zth iteration include: Obtain N nodes from the M nodes, where N is a positive integer and z is a positive integer; Determining, based on directed edges associated with the N nodes, a plurality of first neighboring nodes associated with the N nodes and a plurality of second neighboring nodes associated with the N nodes, wherein the directed edges indicated by the first neighboring nodes point to the N nodes, and the directed edges indicated by the N nodes point to the plurality of second neighboring nodes; Based on the first embedding features of the N nodes, the second embedding features of the plurality of first neighboring nodes, and the third embedding features of the plurality of second neighboring nodes, fourth embedding features of the N nodes are determined.
2. The method according to claim 1, characterized in that The determining, based on the first embedding features of the N nodes, the second embedding features of the plurality of first neighboring nodes, and the third embedding features of the plurality of second neighboring nodes, the fourth embedding features of the N nodes includes: Determining a first function based on first embedding features of the N nodes, second embedding features of the plurality of first neighborhood nodes, node in-degree distribution information, and fifth embedding features of the plurality of first nodes, wherein the node in-degree distribution information is used to represent the distribution of node in-degrees of the N nodes, the plurality of first nodes are obtained based on negative sampling of first neighborhoods of the N nodes, the first neighborhood including the plurality of first neighborhood nodes; Determining a second function based on the first embedding features of the N nodes, the third embedding features of the multiple second neighborhood nodes, node out-degree distribution information, and the sixth embedding features of the multiple second nodes, wherein the node out-degree distribution information is used to represent the distribution of the node out-degrees of the N nodes, the multiple second nodes are obtained based on negative sampling of a second neighborhood of the N nodes, and the second neighborhood includes the multiple second neighborhood nodes; A first objective function formed based on the first function and the second function is optimized to obtain fourth embedding features of the N nodes.
3. The method according to claim 2, characterized in that The determining of the first function based on the first embedding features of the N nodes, the second embedding features of the plurality of first neighborhood nodes, the node in-degree distribution information, and the fifth embedding features of the plurality of first nodes includes: Obtaining N first intermediate embedded features from the first embedded features of the N nodes, where the N first intermediate embedded features are used to represent features of the N nodes as the receivers; Acquire a plurality of second intermediate embedded features from the second embedded features of the plurality of first neighborhood nodes, the plurality of second intermediate embedded features being used to represent features of the plurality of first neighborhood nodes as the initiators; Determining first expected information based on the node in-degree distribution information, where the first expected information is used to indicate that the plurality of first nodes satisfy a mathematical expectation of the node in-degree distribution information; acquiring a plurality of third intermediate embedded features from the fifth embedded features of the plurality of first nodes, the plurality of third intermediate embedded features being used to represent features of the plurality of first nodes as the initiators; The first function is determined based on the N first intermediate embedded features, the plurality of second intermediate embedded features, the first expected information, and the plurality of third intermediate embedded features.
4. The method according to claim 2, characterized in that The determining of the second function based on the first embedding features of the N nodes, the third embedding features of the plurality of second neighborhood nodes, the node out-degree distribution information, and the sixth embedding features of the plurality of second nodes includes: Obtaining N fourth intermediate embedded features from the first embedded features of the N nodes, wherein the N fourth intermediate embedded features are used to represent features of the N nodes as the initiators; acquiring a plurality of fifth intermediate embedded features from the third embedded features of the plurality of second neighboring nodes, wherein the plurality of fifth intermediate embedded features are used to represent features of the plurality of second neighboring nodes as the receivers; Determining second expected information based on the node out-degree distribution information, where the second expected information is used to indicate that the plurality of second nodes satisfy a mathematical expectation of the node out-degree distribution information; acquiring a plurality of sixth intermediate embedded features from the embedded features of the plurality of second nodes, the plurality of sixth intermediate embedded features being used to represent features of the plurality of second nodes as the receivers; The second function is determined based on the N fourth intermediate embedded features, the plurality of fifth intermediate embedded features, the second desired information, and the plurality of sixth intermediate embedded features.
5. The method according to claim 1, characterized in that The determining, based on the first embedding features of the N nodes, the second embedding features of the plurality of first neighboring nodes, and the third embedding features of the plurality of second neighboring nodes, the fourth embedding features of the N nodes includes: Determining first probability information based on the first embedded features of the N nodes and the second embedded features of the plurality of first neighboring nodes, where the first probability information is used to indicate a probability of determining the plurality of first neighboring nodes based on the N nodes; Determining second probability information based on the first embedding features of the N nodes and the third embedding features of the plurality of second neighboring nodes, where the second probability information is used to indicate a probability of determining the plurality of second neighboring nodes based on the N nodes; determining a second objective function based on the first probability information and the second probability information; The second objective function is optimized to obtain fourth embedding features of the N nodes.
6. The method according to claim 5, characterized in that The determining of first probability information based on the first embedded features of the N nodes and the second embedded features of the plurality of first neighboring nodes includes: Obtaining N first intermediate embedded features from the first embedded features of the N nodes, where the N first intermediate embedded features are used to represent features of the N nodes as the receivers; Acquire a plurality of second intermediate embedded features from the second embedded features of the plurality of first neighborhood nodes, the plurality of second intermediate embedded features being used to represent features of the plurality of first neighborhood nodes as the initiators; Obtaining M seventh intermediate embedded features of the M nodes, where the M seventh intermediate embedded features are used to indicate features of the M nodes as the initiators; The first probability information is determined based on the N first intermediate embedded features, the plurality of second intermediate embedded features, and the M seventh intermediate embedded features.
7. The method according to claim 5, characterized in that The determining of second probability information based on the first embedding features of the N nodes and the third embedding features of the plurality of second neighboring nodes includes: Obtaining N fourth intermediate embedded features from the first embedded features of the N nodes, wherein the N fourth intermediate embedded features are used to represent features of the N nodes as the initiators; acquiring a plurality of fifth intermediate embedded features from the third embedded features of the plurality of second neighboring nodes, wherein the plurality of fifth intermediate embedded features are used to represent features of the plurality of second neighboring nodes as the receivers; Obtaining M eighth intermediate embedded features of the M nodes, where the M eighth intermediate embedded features are used to represent features of the M nodes as the receivers; The second probability information is determined based on the N fourth intermediate embedding features, the plurality of fifth intermediate embedding features, and the M eighth intermediate embedding features.
8. The method according to any one of claims 1 to 7, characterized in that The method further comprises: The target graph is divided into at least one graph partition; For any graph partition, store the nodes in the graph partition in the parameter server; Storing the edge table corresponding to the graph partition in the executor corresponding to the graph partition; For any executor, based on the edge table stored in the executor, a plurality of sampling edges are sampled from the target graph, where the nodes connected by the plurality of sampling edges are the N nodes; The acquiring N nodes from the M nodes includes: Determining N node identifiers based on the multiple sampled edges; Obtain the N nodes corresponding to the N node identifiers from the parameter server.
9. The method according to claim 8, characterized in that The determining, based on the first embedding features of the N nodes, the second embedding features of the plurality of first neighboring nodes, and the third embedding features of the plurality of second neighboring nodes, the fourth embedding features of the N nodes includes: Determining N feature gradients of the N nodes based on the first embedding features of the N nodes, the second embedding features of the plurality of first neighboring nodes, and the third embedding features of the plurality of second neighboring nodes; The N feature gradients are uploaded to the parameter server, and the parameter server determines fourth embedding features of the N nodes based on the first embedding features of the N nodes and the N feature gradients.
10. A graph data processing device, characterized in that: The device comprises: A graph acquisition module is configured to acquire a target graph based on the object data, wherein the target graph includes M nodes representing objects, where M is a positive integer. A directed edge in the target graph is used to indicate that a business relationship exists between objects corresponding to the connected nodes, and the pointing node of the directed edge is the initiator of the business relationship, and the pointing node of the directed edge is the recipient of the business relationship. an iterative module, configured to perform multiple rounds of iteration based on the M nodes and the directed edges between the M nodes to obtain initiating embedded features and receiving embedded features corresponding to the M nodes, wherein the initiating embedded features are used to represent features of the corresponding node as an initiator, and the receiving embedded features are used to represent features of the corresponding node as a receiver; Wherein, the iteration module includes: an acquiring unit, configured to acquire N nodes from the M nodes, where N is a positive integer; a node determination unit, configured to determine, based on directed edges associated with the N nodes, a plurality of first neighboring nodes associated with the N nodes and a plurality of second neighboring nodes associated with the N nodes, wherein the directed edges indicated by the first neighboring nodes point to the N nodes, and the directed edges indicated by the N nodes point to the plurality of second neighboring nodes; A feature determination unit is configured to determine fourth embedding features of the N nodes based on the first embedding features of the N nodes, the second embedding features of the plurality of first neighboring nodes, and the third embedding features of the plurality of second neighboring nodes.
11. A computer device, characterized in that: The computer device includes a processor and a memory, the memory is used to store at least one computer program, and the at least one computer program is loaded by the processor and executes the graph data processing method described in any one of claims 1 to 9.
12. A computer-readable storage medium, characterized in that The computer-readable storage medium is used to store at least one computer program, and the at least one computer program is used to execute the graph data processing method according to any one of claims 1 to 9.
13. A computer program product, characterized in that The computer program product includes a computer program code, which is stored in a computer-readable storage medium. The processor of a computer device reads the computer program code from the computer-readable storage medium, and the processor executes the computer program code, so that the computer device executes the graph data processing method described in any one of claims 1 to 9.
Citation Information
Patent Citations
A method and a device for performing node embedding on a relational network diagram
CN109918454A
Graph query method and device, electronic equipment and computer readable storage medium
CN111460234A