Customer equity ratio calculation method and related device
By converting the directed and ring-shaped graph of the equity relationship into acyclic graph, and using the concepts of fan-entry nodes and terminating sub-graphs to calculate the proportion of customers' equity, the problems of inefficient computing efficiency and infinite cycles in the existing technology are solved, and more efficient and accurate calculations are achieved.
Patent Information
- Application Number
- CN202411743742.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-30
- Publication Date
- 2025-03-11
AI Technical Summary
When calculating the proportion of equity of customers, when the existing technology faces the number of equity penetration layers or the structure is complex in the equity relationship diagram, the traversal algorithm may fall into an infinite loop, resulting in inefficient computing efficiency or calculation timeout.
By determining the target node from the preset equity relationship directed and ring graph, converting it into a directed acyclic graph, determining the fan-entry node and constructing a termination sub-graph, calculating the equity ratio of the target fan-entry node to determine the equity ratio of the target customer.
It improves the efficiency and accuracy of the calculation of the equity proportion of customers, avoids the calculation complexity brought by the ring structure, and ensures the stability and efficiency of the calculation.
Smart Images

Figure CN119599803A_ABST
Abstract
Description
Technical Field
[0001] The application relates to the field of financial enterprise analysis, and in particular to a method of calculating the proportion of equity of a customer and related devices. Background Art
[0002] In recent years, with the booming capital market, equity investment relationships have evolved into the core link between different companies, individuals and financial products. This relationship is not only intricate, but also plays a key role in the transmission and transformation of credit risk. In this context, financial institutions are facing unprecedented challenges: they need to more accurately sort out and depict the multi-level equity relationship directed cycle diagram between each customer.
[0003] At present, financial institutions usually directly use this equity relationship directed and ring graph to solve the proportion of customers' equity through width-first traversal or depth-first traversal.
[0004] However, when there are many equity penetration layers in the equity relationship directed cyclic graph or the equity relationship structure is complex, a simple traversal algorithm may fall into an infinite loop and fail to correctly calculate the equity ratio. Direct traversal may also lead to low computational efficiency and even computational timeout or resource exhaustion in some cases. Summary of the invention
[0005] In view of the above problems, this application provides a method and related device for calculating the equity proportion of a customer, in order to improve the calculation efficiency and accuracy of the equity proportion of a customer. The specific plan is as follows:
[0006] The first aspect of this application provides a method for calculating the equity proportion of a customer, including:
[0007] Determine a target node from a preset equity relationship directed cyclic graph, wherein the equity relationship directed cyclic graph includes a plurality of nodes and edges between the nodes, the nodes are used to indicate customers, the edges are used to indicate equity ratios between the customers, and the target node is used to indicate a target customer;
[0008] The directed and ring graph of the equity relationship is converted to obtain the directed and ring graph of the equity relationship of the target node;
[0009] The fan-entry node of the target node is determined in the equity relationship directed acyclic graph, and a terminating sub-graph is constructed based on the fan-entry node of the target node;
[0010] Determine the fan-in node of the termination subgraph in the equity relationship directed acyclic graph, and determine the target fan-in node of the termination subgraph from the fan-in nodes of the termination subgraph based on the fan-out nodes of the fan-in node of the termination subgraph;
[0011] The equity ratio of the customer corresponding to each of the target fan-in nodes is calculated, and based on the equity ratio of the customer corresponding to each of the target fan-in nodes and the edges between each of the fan-in nodes and the termination subgraph, the equity ratio of the target customer corresponding to the target node is determined.
[0012] In a possible implementation, converting the equity relationship directed cyclic graph to obtain the equity relationship directed acyclic graph of the target node includes:
[0013] Taking the target node as the starting node;
[0014] Perform a breadth-first search traversal on the starting node to obtain the fan-in nodes of the starting node;
[0015] The fan-in nodes of the starting node are respectively used as the starting nodes, and the step of performing a breadth-first search traversal on the starting node to obtain the fan-in nodes of the starting node is returned;
[0016] Based on the target node and the fan-in nodes of each of the starting nodes, a directed acyclic graph of the equity relationship of the target node is constructed.
[0017] In a possible implementation, constructing a termination subgraph based on the fan-in node of the target node includes:
[0018] Determine whether the number of fan-in nodes of the target node is 1;
[0019] If the number of fan-in nodes of the target node is 1, the target node and the fan-in nodes of the target node are used as the termination subgraph;
[0020] If the number of fan-in nodes of the target node is greater than 1, the target node is used as a termination subgraph.
[0021] In a possible implementation, determining the target fan-in node of the termination subgraph from the fan-in nodes of the termination subgraph based on the fan-out node of the fan-in node of the termination subgraph includes:
[0022] For each fan-in node of the termination subgraph, determining whether the number of fan-out nodes of the fan-in node of the termination subgraph is 1;
[0023] If the number of fan-out nodes of the fan-in node of the termination subgraph is 1, the fan-in node of the termination subgraph is determined as the target fan-in node of the termination subgraph.
[0024] In a possible implementation, calculating the equity ratio of the customer corresponding to each of the target fan-in nodes includes:
[0025] For each of the target fan-in nodes, determine an upstream node of the target fan-in node in the equity relationship directed acyclic graph, and construct a region corresponding to the target fan-in node based on the target fan-in node and the upstream node of the target fan-in node;
[0026] Based on the edges in the region corresponding to the target fan-in node, the equity ratio of the customer corresponding to the target fan-in node is calculated.
[0027] A second aspect of the present application provides a device for calculating a customer's equity ratio, including:
[0028] A first determining unit is used to determine a target node from a preset equity relationship directed cyclic graph, wherein the equity relationship directed cyclic graph includes a plurality of nodes and edges between the nodes, the nodes are used to indicate customers, the edges are used to indicate equity ratios between the customers, and the target node is used to indicate a target customer;
[0029] A conversion unit, used to convert the equity relationship directed cyclic graph to obtain the equity relationship directed acyclic graph of the target node;
[0030] A construction unit, used to determine the fan-in node of the target node in the equity relationship directed acyclic graph, and construct a termination subgraph based on the fan-in node of the target node;
[0031] A second determining unit is used to determine the fan-in node of the termination subgraph in the equity relationship directed acyclic graph, and determine the target fan-in node of the termination subgraph from the fan-in nodes of the termination subgraph based on the fan-out nodes of the fan-in nodes of the termination subgraph;
[0032] The third determination unit is used to calculate the equity ratio of the customers corresponding to each of the target fan-in nodes, and determine the equity ratio of the target customers corresponding to the target nodes based on the equity ratio of the customers corresponding to each of the target fan-in nodes and the edges between each of the fan-in nodes and the termination subgraph.
[0033] In a possible implementation, the conversion unit includes:
[0034] A first determining subunit, configured to use the target node as a starting node;
[0035] A traversal subunit, used for performing a breadth-first search traversal on the starting node to obtain a fan-in node of the starting node;
[0036] A second determination subunit is used to respectively use the fan-in nodes of the starting node as the starting node, and return to execute the step of performing a breadth-first search traversal on the starting node to obtain the fan-in nodes of the starting node;
[0037] A construction subunit is used to construct a directed acyclic graph of the equity relationship of the target node based on the target node and the fan-in nodes of each of the starting nodes.
[0038] A third aspect of the present application provides a computer program product, including computer-readable instructions. When the computer-readable instructions are executed on an electronic device, the electronic device implements the method for calculating the equity ratio of a customer according to the first aspect or any implementation method of the first aspect.
[0039] A fourth aspect of the present application provides an electronic device, comprising at least one processor and a memory connected to the processor, wherein:
[0040] The memory is used to store computer programs;
[0041] The processor is used to execute the computer program so that the electronic device can implement the method for calculating the equity ratio of the customer according to the first aspect or any implementation method of the first aspect.
[0042] A fifth aspect of the present application provides a computer storage medium, which carries one or more computer programs. When the one or more computer programs are executed by an electronic device, the electronic device can calculate the equity ratio of a customer according to the first aspect or any implementation method of the first aspect.
[0043] By means of the above technical scheme, the present application provides a method for calculating the equity ratio of a customer and a related device, the method comprising determining a target node from a preset equity relationship directed cyclic graph, the equity relationship directed cyclic graph comprising multiple nodes and edges between the nodes, the nodes being used to indicate customers, the edges being used to indicate the equity ratio between the customers, and the target node being used to indicate the target customer; converting the equity relationship directed cyclic graph to obtain an equity relationship directed acyclic graph of the target node, which more clearly displays the equity relationship between the customers and avoids the computational complexity brought by the ring structure; determining the fan-in node of the target node in the equity relationship directed acyclic graph, and constructing a termination subgraph based on the fan-in node of the target node; determining the fan-in node of the termination subgraph in the equity relationship directed acyclic graph, and determining the target fan-in node of the termination subgraph from the fan-in nodes of the termination subgraph based on the fan-out nodes of the fan-in node of the termination subgraph; calculating the equity ratio of the customer corresponding to each target fan-in node, and determining the equity ratio of the target customer corresponding to the target node based on the equity ratio of the customer corresponding to each target fan-in node and the edges between each fan-in node and the termination subgraph. By using the concepts of termination subgraph and target fan-in node, this solution can accurately locate the equity relationship directly related to the target customer, thereby efficiently calculating the target customer's equity ratio, improving the calculation efficiency and accuracy of the customer's equity ratio. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and the originals and elements are not necessarily drawn to scale.
[0045] Figure 1 A flowchart of a method for calculating a customer's equity ratio provided in an embodiment of the present application;
[0046] Figure 2 A schematic diagram of a directed cyclic graph of equity relations provided in an embodiment of the present application;
[0047] Figure 3 A schematic diagram of a directed acyclic graph of equity relations of a target node provided in an embodiment of the present application;
[0048] Figure 4 A schematic diagram of a termination subgraph provided in an embodiment of the present application;
[0049] Figure 5 A schematic diagram of a region provided in an embodiment of the present application;
[0050] Figure 6 A schematic diagram of another region provided in an embodiment of the present application;
[0051] Figure 7 A schematic diagram of a split region provided in an embodiment of the present application;
[0052] Figure 8 A schematic diagram of another split region provided in an embodiment of the present application;
[0053] Fig. 9 A schematic diagram of the structure of a device for calculating the equity ratio of a customer provided in an embodiment of the present application;
[0054] Fig.10 A schematic diagram of the hardware structure of a device for calculating a customer's equity ratio provided in an embodiment of the present application. DETAILED DESCRIPTION
[0055] The following describes the embodiments of the present application in conjunction with the drawings in the embodiments of the present application. The terms used in the implementation method section of the present application are only used to explain the specific embodiments of the present application, and are not intended to limit the present application.
[0056] The embodiments of the present application are described below in conjunction with the accompanying drawings. Those skilled in the art will appreciate that, with the development of technology and the emergence of new scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0057] The terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and need not be used to describe a specific order or sequential order. It should be understood that the terms used in this way can be interchangeable under appropriate circumstances, which is only to describe the distinction mode adopted by the objects of the same attributes when describing in the embodiments of the present application. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, so that the process, method, system, product or equipment comprising a series of units need not be limited to those units, but may include other units that are not clearly listed or inherent to these processes, methods, products or equipment.
[0058] In order to improve the calculation efficiency and accuracy of the customer's equity ratio, the present application provides a method for calculating the customer's equity ratio. The following is a further detailed description of the method for calculating the customer's equity ratio provided in the present application in conjunction with the accompanying drawings and specific implementation methods.
[0059] Please see attached Figure 1 , Figure 1 A flow chart of a method for calculating a customer's equity ratio provided in an embodiment of the present application. The method can be applied to a system for calculating a customer's equity ratio, which is composed of a data preprocessing unit and a calculation unit.
[0060] Among them, the data preprocessing unit is composed of a data processor and a relationship network traverser; the computing unit is composed of a region divider, a segmenter, a final calculator of the target customer equity ratio and a persistent memory programming library.
[0061] The method may include the following steps:
[0062] Step S101: Determine a target node from a preset equity relationship directed cyclic graph, where the equity relationship directed cyclic graph includes multiple nodes and edges between the nodes, where the nodes are used to indicate customers, the edges are used to indicate the equity ratio between the customers, and the target node is used to indicate the target customer.
[0063] The data processor is responsible for receiving the equity ratio of customers whose equity relationship is to be penetrated, and traversing these data in turn to generate a directed cyclic graph of equity relationship. In the directed cyclic graph of equity relationship, the nodes represent each customer. These customers can be individuals, companies, funds, or any other entities that own equity. The name of the customer is usually marked on the node. Edges are used to connect each node to indicate the equity ratio relationship between customers. These edges are directed, that is, they point from one node to another, indicating the holding or control relationship of equity. The weight of the edge (or length, thickness, etc.) may be used to indicate the size of the equity ratio, that is, how much proportion of equity one customer holds in another customer. And there may be loops, which means that there may be cross-holdings or mutual holdings between some customers, which is a common complex phenomenon in the equity structure. For ease of understanding, please refer to the details. Figure 2 , Figure 2 A schematic diagram of a directed cyclic graph of equity relations is provided for an application embodiment, and the target node may be customer T in the graph.
[0064] The actual controller or ultimate beneficiary may not appear directly on the shareholder register, but through complex equity structures or agreements, they actually control operations and decision-making. This usually involves an in-depth analysis of the equity structure, so the relationship network traversal can determine the target node from the preset equity relationship directed cycle graph based on business needs or analysis purposes.
[0065] Calculating the equity ratio for only one target node can reduce the problem size and improve the calculation efficiency. If calculations need to be performed for multiple target nodes, they can be implemented through parallel computing to further improve efficiency.
[0066] Step S102: convert the equity relationship directed cyclic graph to obtain the equity relationship directed acyclic graph of the target node.
[0067] In the equity relationship analysis, in order to simplify the problem and avoid an infinite loop in the calculation, it is necessary to extract the equity relationship related to the target node from the equity relationship directed cyclic graph and construct an acyclic directed graph, that is, the equity relationship directed acyclic graph of the target node.
[0068] In the present application, the relationship network traverser first takes the target node as the starting node. Then, a breadth-first search traversal is performed on the starting node to obtain the fan-in nodes of the starting node. Then, the fan-in nodes of the starting node are respectively taken as the starting nodes, and the step of performing a breadth-first search traversal on the starting node to obtain the fan-in nodes of the starting node is returned. Finally, based on the target node and the fan-in nodes of each starting node, a directed acyclic graph of the equity relationship of the target node is constructed.
[0069] It should be noted that for a certain node, its fan-in nodes refer to all nodes pointing to this node, that is, nodes holding shares in this node.
[0070] Specifically, with the target node as the starting node, a breadth-first search is performed from the starting node, the nodes are traversed along the width of the graph, all adjacent nodes are visited, all nodes that directly point to the target node (i.e., the fan-in nodes of the target node) are found, and they are recorded as a node set. The customers corresponding to these nodes are the direct shareholders or superior shareholders of the customers corresponding to the target node. For each node in the node set, the breadth-first search is repeated. In each search, all nodes that directly point to the current starting node (excluding the current starting node itself and the nodes that have been traversed) are found, and these newly found nodes are added to the new node set (if they have not been recorded yet), until there are no nodes with the starting node as the fan-out node. By traversing layer by layer, it can be ensured that the nodes that have been visited will not be returned to, and the loops in the graph can be eliminated, thereby avoiding the formation of loops.
[0071] Based on the nodes collected in the above steps and the equity relationships between them, a directed acyclic graph of the equity relationship of the target node is constructed. This graph shows the equity relationship between the target node and its direct and indirect shareholders, but all loops have been removed. For easier understanding, please refer to Figure 3 , Figure 3 A schematic diagram of a directed acyclic graph of equity relations of a target node provided for an application embodiment, that is, a schematic diagram of a directed acyclic graph of equity relations of client T.
[0072] Step S103: Determine the fan-in node of the target node in the equity relationship directed acyclic graph, and construct a termination subgraph based on the fan-in node of the target node.
[0073] In this application, the region divider first finds all fan-in nodes of the target node, which are nodes holding equity in the target node, and then constructs a termination subgraph based on the number of fan-in nodes of the target node.
[0074] Specifically, it is determined whether the number of fan-in nodes of the target node is 1. If the number of fan-in nodes of the target node is 1, the target node and the fan-in nodes of the target node are used as the termination subgraph. If the number of fan-in nodes of the target node is greater than 1, the target node is used as the termination subgraph.
[0075] If the number of fan-in nodes of the target node is 1, it means that the target node has only one direct source of equity. In this case, the target node and its only fan-in node are taken as the terminal subgraph. This is because the equity ratio of the target node can be directly calculated through this only fan-in node.
[0076] If the number of fan-in nodes of the target node is greater than 1, it means that the target node has multiple direct equity sources. In this case, only the target node is used as the terminal subgraph. This is because, although it is known that the target node has multiple equity sources, it is necessary to further analyze the equity ratios of these fan-in nodes and their respective fan-in nodes to calculate the equity ratio of the target node. The target node is used as a separate terminal subgraph for subsequent analysis and calculation. For ease of understanding, please refer to Figure 4 , Figure 4 A schematic diagram of a termination subgraph provided for an embodiment of the application, wherein the termination subgraph consists of client T and client A.
[0077] Step S104: determining the fan-in node of the termination subgraph in the equity relationship directed acyclic graph, and determining the target fan-in node of the termination subgraph from the fan-in nodes of the termination subgraph based on the fan-out nodes of the fan-in node of the termination subgraph.
[0078] In the equity relationship directed acyclic graph, the terminal subgraph is a subgraph composed of nodes that can directly determine the final equity ratio (such as the target node and its only fan-in node under certain conditions). The fan-in nodes of the terminal subgraph are those nodes that point to the nodes in the terminal subgraph, that is, the nodes that hold the equity of the nodes in the terminal subgraph. For ease of understanding, the following example is given: the fan-in nodes of the terminal subgraph composed of customer T and customer A are customer B, customer C, customer D, and customer F.
[0079] For each fan-in node of the termination subgraph, its fan-out nodes need to be further analyzed, and the number of its fan-out nodes is crucial to determining the target fan-in node. Specifically, for each fan-in node of the termination subgraph, the region divider determines whether the number of fan-out nodes of the fan-in node of the termination subgraph is 1. If the number of fan-out nodes of the fan-in node of the termination subgraph is 1, the fan-in node of the termination subgraph is determined as the target fan-in node of the termination subgraph.
[0080] If the number of fan-out nodes is 1, it means that the fan-in node holds the equity of only one node, and this node belongs to the termination subgraph or a region further upstream. In this case, the fan-in node has a direct impact on the calculation of the equity ratio of the node in the termination subgraph, so it is determined as the target fan-in node of the termination subgraph. Target fan-in nodes are those nodes that can affect the equity ratio of nodes in the termination subgraph directly or through a simple path. For ease of understanding, an example is given below: The target fan-in nodes of the termination subgraph composed of customer T and customer A are customer B, customer C, and customer D.
[0081] Step S105: Calculate the equity ratio of the customer corresponding to each target fan-in node, and determine the equity ratio of the target customer corresponding to the target node based on the equity ratio of the customer corresponding to each target fan-in node and the edge between each fan-in node and the termination subgraph.
[0082] In the present application, for each target fan-in node, the region divider determines the upstream node of the target fan-in node in the equity relationship directed acyclic graph, and constructs the region corresponding to the target fan-in node based on the target fan-in node and the upstream node of the target fan-in node. Based on each edge in the region corresponding to the target fan-in node, the equity ratio of the customer corresponding to the target fan-in node is calculated.
[0083] Based on the target fan-in node of the termination subgraph, the equity relationship directed acyclic graph can be divided into multiple regions. Each region consists of the target fan-in node, its upstream node, and the connecting edges between these nodes. This region forms a relatively independent subgraph in the equity relationship, which reflects the equity transfer path from the upstream node to the target fan-in node.
[0084] When the terminal subgraph is excluded from the directed graph, the directed graph as a whole will be presented as several regions. These regions may have some intersections in the upstream, but in the downstream, they are independent of each other. Therefore, the equity ratio of each region can be calculated independently. When a region is calculated, only the nodes belonging to the region need to be considered, without considering other nodes. This greatly reduces the amount of data required for calculation and improves the calculation efficiency. For ease of understanding, please refer to Figure 5 and Figure 6 , Figure 5 A schematic diagram of a region provided in an embodiment of the application, in which the region is named region C according to a target fan-in node C therein; Figure 6 This is a schematic diagram of another area disclosed in an embodiment of the application. In the figure, the area is named area D according to the target fan-in node D therein.
[0085] Taking region D as an example, calculate the equity ratio of customer D corresponding to the target fan-in node D, multiply customer D's equity by the fan-in node equity ratio, and if its fan-in node still has fan-in nodes, use the same method to calculate the equity ratio of the customer corresponding to the node, such as customer G. Finally, the equity ratio of customer D can be obtained as d×g1×j1+d×g1×j2+d×g1×j3+d×g2+d×g3.
[0086] When processing complex equity relationship data, although the region divider can effectively reduce the amount of data and store all the calculated data of a region in a single table, a single table may still not be able to handle the storage task for some particularly large regions. To address this challenge, the partitioning strategy is introduced. The partitioner further divides large regions into multiple subgraphs, and each subgraph is stored in an independent table.
[0087] The design goals of the split strategy can be considered: minimizing storage capacity and optimizing query performance. Among them, minimizing storage capacity: find a balance between not splitting (resulting in huge tables) and splitting on each node (resulting in too many tables), choose an appropriate split strategy to minimize the sum of the total storage capacity of all tables, and consider the distribution of data and the size of the table when splitting to ensure storage efficiency. Optimizing query performance: Since it directly affects the number of tables and the number of connection operations between tables, it is necessary to reasonably design the structure of the table so that the number of tables is moderate and the number of connection operations is minimized, thereby improving query performance.
[0088] For ease of understanding, let's take an example: suppose region G contains multiple nodes and complex equity relationships, and its data volume exceeds the storage capacity of a single table. To optimize storage, the splitter can split region G into two subgraphs. For details, see Figure 7 and Figure 8 , Figure 7 A schematic diagram of a split region provided in an embodiment of the application, Figure 8 Another schematic diagram of a split region provided in an embodiment of the application. The two graphs respectively contain a portion of nodes in region G and the edges connecting these nodes, which can be Figure 7 and Figure 8 Create separate tables to store only the data in each subgraph.
[0089] After ensuring that the equity ratios of all customers corresponding to the target fan-in nodes have been calculated, these data can be used to continue to calculate the equity ratio of target customer T. For ease of understanding, an example is given below: Equity ratio of target customer T = a1 × equity ratio of customer B + a2 × equity ratio of customer C + a3 × equity ratio of customer D. The calculation process only involves simple multiplication of the shareholding ratio numbers, which can avoid complex matrix calculations and simplify the calculation process.
[0090] Due to the need to access a large amount of data quickly, frequently and randomly, the tables generated in the computing process for storing generated data can all be represented and operated using the persistent memory programming library. It should be noted that the persistent memory programming library, also known as non-volatile memory or memory-level storage, is a storage medium between memory and persistent storage. It can maintain the persistence of data after the system is restarted. It provides a larger capacity than dynamic random access memory and a more significant access speed than storage. Applications can access persistent memory like accessing traditional memory, without switching data blocks back and forth between memory and storage. This programming library accesses external storage through the mmap mechanism, allowing byte addressable and random access to data in external storage. The API provided by the persistent memory programming library is very friendly. Accessing table cells is as simple as accessing container elements, without having to care about the specific storage method of data in external storage. And the programming library uses internal memory as a buffer to optimize the speed of accessing external data, thereby providing fast access capabilities. Overall, by using the persistent memory programming library, the I / O performance bottleneck problem can be solved, while reducing hardware costs and maintaining a relatively low level of resource usage.
[0091] In summary, the present application provides a method for calculating the equity ratio of a customer, the method comprising determining a target node from a preset equity relationship directed cyclic graph, the equity relationship directed cyclic graph comprising multiple nodes and edges between the nodes, the nodes being used to indicate customers, the edges being used to indicate the equity ratio between the customers, and the target node being used to indicate the target customer; converting the equity relationship directed cyclic graph to obtain an equity relationship directed acyclic graph of the target node, which more clearly displays the equity relationship between the customers and avoids the computational complexity brought by the ring structure; determining the fan-in node of the target node in the equity relationship directed acyclic graph, and constructing a termination subgraph based on the fan-in node of the target node; determining the fan-in node of the termination subgraph in the equity relationship directed acyclic graph, and determining the target fan-in node of the termination subgraph from the fan-in nodes of the termination subgraph based on the fan-out nodes of the fan-in node of the termination subgraph; calculating the equity ratio of the customer corresponding to each target fan-in node, and determining the equity ratio of the target customer corresponding to the target node based on the equity ratio of the customer corresponding to each target fan-in node and the edges between each fan-in node and the termination subgraph. By using the concepts of termination subgraph and target fan-in node, this solution can accurately locate the equity relationship directly related to the target customer, thereby efficiently calculating the target customer's equity ratio, improving the calculation efficiency and accuracy of the customer's equity ratio.
[0092] A method for calculating a customer's equity ratio provided in an embodiment of the present application is introduced above. A device for executing the above method for calculating a customer's equity ratio will be introduced below.
[0093] See also Fig. 9 , Fig. 9 A schematic diagram of a device for calculating a customer's equity ratio provided in an embodiment of the present application. Fig. 9 As shown, the calculation device of the equity ratio of the customer includes:
[0094] The first determination unit 11 is used to determine a target node from a preset equity relationship directed cyclic graph, wherein the equity relationship directed cyclic graph includes multiple nodes and edges between the nodes, the nodes are used to indicate customers, the edges are used to indicate the equity ratio between the customers, and the target node is used to indicate the target customer.
[0095] The conversion unit 12 is used to convert the equity relationship directed cyclic graph to obtain the equity relationship directed acyclic graph of the target node.
[0096] The construction unit 13 is used to determine the fan-in node of the target node in the equity relationship directed acyclic graph, and to construct a termination subgraph based on the fan-in node of the target node.
[0097] The second determination unit 14 is used to determine the fan-in node of the termination subgraph in the equity relationship directed acyclic graph, and determine the target fan-in node of the termination subgraph from the fan-in nodes of the termination subgraph based on the fan-out nodes of the fan-in nodes of the termination subgraph.
[0098] The third determination unit 15 is used to calculate the equity ratio of the customers corresponding to each of the target fan-in nodes, and determine the equity ratio of the target customers corresponding to the target nodes based on the equity ratio of the customers corresponding to each of the target fan-in nodes and the edges between each of the fan-in nodes and the termination subgraph.
[0099] In a possible implementation, the conversion unit 12 includes:
[0100] The first determining subunit is configured to use the target node as a starting node.
[0101] The traversal subunit is used to perform a breadth-first search traversal on the starting node to obtain the fan-in node of the starting node.
[0102] The second determination subunit is used to respectively use the fan-in nodes of the starting node as the starting node, and return to execute the step of performing a breadth-first search traversal on the starting node to obtain the fan-in nodes of the starting node.
[0103] A construction subunit is used to construct a directed acyclic graph of the equity relationship of the target node based on the target node and the fan-in nodes of each of the starting nodes.
[0104] In a possible implementation, the construction unit 13 includes:
[0105] The first judging subunit is used to judge whether the number of fan-in nodes of the target node is 1.
[0106] The third determining sub-unit is configured to use the target node and the fan-in nodes of the target node as a termination subgraph if the number of the fan-in nodes of the target node is 1.
[0107] The fourth determining sub-unit is configured to use the target node as a termination subgraph if the number of fan-in nodes of the target node is greater than 1.
[0108] In a possible implementation, the second determining unit 14 includes:
[0109] The second judgment subunit is used to judge, for each fan-in node of the termination subgraph, whether the number of fan-out nodes of the fan-in node of the termination subgraph is 1.
[0110] The fifth determining subunit is configured to determine the fan-in node of the termination subgraph as the target fan-in node of the termination subgraph if the number of fan-out nodes of the fan-in node of the termination subgraph is 1.
[0111] In a possible implementation, the third determining unit 15 includes:
[0112] The region construction subunit is used to determine the upstream node of the target fan-in node in the equity relationship directed acyclic graph for each target fan-in node, and to construct the region corresponding to the target fan-in node based on the target fan-in node and the upstream node of the target fan-in node.
[0113] The calculation subunit is used to calculate the equity ratio of the customer corresponding to the target fan-in node based on each of the edges in the area corresponding to the target fan-in node.
[0114] The present application also provides an electronic device in an embodiment. Fig.10 As shown, it shows a schematic diagram of the structure of an electronic device suitable for implementing the embodiment of the present application. The electronic device in the embodiment of the present application may include but is not limited to fixed terminals such as mobile phones, laptops, PDAs (personal digital assistants), PADs (tablet computers), desktop computers, etc. Fig.10 The electronic device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0115] like Fig.10As shown, the electronic device may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 1001, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1002 or a program loaded from a storage device 1008 to a random access memory (RAM) 1003. When the electronic device is powered on, various programs and data required for the operation of the electronic device are also stored in the RAM 1003. The processing device 1001, the ROM 1002, and the RAM 1003 are connected to each other via a bus 1004. An input / output (I / O) interface 1005 is also connected to the bus 1004.
[0116] Typically, the following devices may be connected to the I / O interface 1005: an input device 1006 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 1007 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 1008 including, for example, a memory card, a hard disk, etc.; and a communication device 1009. The communication device 1009 may allow the electronic device to communicate with other devices wirelessly or by wire to exchange data. Although Fig.10 An electronic device having various devices is shown, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.
[0117] Also provided in an embodiment of the present application is a computer program product including computer-readable instructions. When the computer-readable instructions are executed on an electronic device, the electronic device implements a method for calculating the equity ratio of any customer provided in an embodiment of the present application.
[0118] A computer-readable storage medium is also provided in an embodiment of the present application. The storage medium carries one or more computer programs. When the one or more computer programs are executed by an electronic device, the electronic device can implement a method for calculating the equity ratio of any customer provided in an embodiment of the present application.
[0119] It should also be noted that the device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed over multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. In addition, in the drawings of the device embodiments provided by the present application, the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines.
[0120] Through the description of the above implementation mode, the technicians in the field can clearly understand that the present application can be implemented by means of software plus necessary general hardware, and of course, it can also be implemented by special hardware including special integrated circuits, special CPUs, special memories, special components, etc. In general, all functions completed by computer programs can be easily implemented by corresponding hardware, and the specific hardware structure used to implement the same function can also be various, such as analog circuits, digital circuits or special circuits. However, for the present application, software program implementation is a better implementation mode in more cases. Based on such an understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a readable storage medium, such as a computer floppy disk, a U disk, a mobile hard disk, a ROM, a RAM, a disk or an optical disk, etc., including a number of instructions to enable a computer device (which can be a personal computer, a training device, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0121] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part of the embodiments may be implemented in the form of a computer program product.
[0122] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website site, a computer, a training device, or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, training device, or data center. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a training device, a data center, etc. that includes one or more available media integrations. The available medium may be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)), etc.
Claims
1. A method for calculating a customer's equity ratio, characterized in that: include: Determine a target node from a preset equity relationship directed cyclic graph, wherein the equity relationship directed cyclic graph includes a plurality of nodes and edges between the nodes, the nodes are used to indicate customers, the edges are used to indicate equity ratios between the customers, and the target node is used to indicate a target customer; Converting the equity relationship directed cyclic graph to obtain the equity relationship directed acyclic graph of the target node; Determine the fan-in node of the target node in the equity relationship directed acyclic graph, and construct a termination subgraph based on the fan-in node of the target node; Determine the fan-in node of the termination subgraph in the equity relationship directed acyclic graph, and determine the target fan-in node of the termination subgraph from the fan-in nodes of the termination subgraph based on the fan-out nodes of the fan-in node of the termination subgraph; The equity ratio of the customer corresponding to each of the target fan-in nodes is calculated, and based on the equity ratio of the customer corresponding to each of the target fan-in nodes and the edges between each of the fan-in nodes and the termination subgraph, the equity ratio of the target customer corresponding to the target node is determined.
2. The method for calculating the equity ratio of a customer according to claim 1, characterized in that: The step of converting the equity relationship directed cyclic graph to obtain the equity relationship directed acyclic graph of the target node includes: Taking the target node as the starting node; Perform a breadth-first search traversal on the starting node to obtain the fan-in nodes of the starting node; The fan-in nodes of the starting node are respectively used as the starting nodes, and the step of performing a breadth-first search traversal on the starting node to obtain the fan-in nodes of the starting node is returned; Based on the target node and the fan-in nodes of each of the starting nodes, a directed acyclic graph of the equity relationship of the target node is constructed.
3. The method for calculating the equity ratio of a customer according to claim 1, characterized in that: The step of constructing a termination subgraph based on the fan-in node of the target node includes: Determine whether the number of fan-in nodes of the target node is 1; If the number of fan-in nodes of the target node is 1, the target node and the fan-in nodes of the target node are used as the termination subgraph; If the number of fan-in nodes of the target node is greater than 1, the target node is used as a termination subgraph.
4. The method for calculating the equity ratio of a customer according to claim 1, characterized in that: The step of determining the target fan-in node of the termination subgraph from the fan-in nodes of the termination subgraph based on the fan-out node of the termination subgraph comprises: For each fan-in node of the termination subgraph, determining whether the number of fan-out nodes of the fan-in node of the termination subgraph is 1; If the number of fan-out nodes of the fan-in node of the termination subgraph is 1, the fan-in node of the termination subgraph is determined as the target fan-in node of the termination subgraph.
5. The method for calculating the equity ratio of a customer according to claim 1, characterized in that: The calculating the equity ratio of the customer corresponding to each of the target fan-in nodes includes: For each of the target fan-in nodes, determine an upstream node of the target fan-in node in the equity relationship directed acyclic graph, and construct a region corresponding to the target fan-in node based on the target fan-in node and the upstream node of the target fan-in node; Based on the edges in the region corresponding to the target fan-in node, the equity ratio of the customer corresponding to the target fan-in node is calculated.
6. A device for calculating a customer's equity ratio, characterized in that: include: A first determining unit is used to determine a target node from a preset equity relationship directed cyclic graph, wherein the equity relationship directed cyclic graph includes a plurality of nodes and edges between the nodes, the nodes are used to indicate customers, the edges are used to indicate equity ratios between the customers, and the target node is used to indicate a target customer; A conversion unit, used to convert the equity relationship directed cyclic graph to obtain the equity relationship directed acyclic graph of the target node; A construction unit, used to determine the fan-in node of the target node in the equity relationship directed acyclic graph, and construct a termination subgraph based on the fan-in node of the target node; A second determining unit is used to determine the fan-in node of the termination subgraph in the equity relationship directed acyclic graph, and determine the target fan-in node of the termination subgraph from the fan-in nodes of the termination subgraph based on the fan-out nodes of the fan-in nodes of the termination subgraph; The third determination unit is used to calculate the equity ratio of the customers corresponding to each of the target fan-in nodes, and determine the equity ratio of the target customers corresponding to the target nodes based on the equity ratio of the customers corresponding to each of the target fan-in nodes and the edges between each of the fan-in nodes and the termination subgraph.
7. The device for calculating the equity ratio of a customer according to claim 6, characterized in that: The conversion unit comprises: A first determining subunit, configured to use the target node as a starting node; A traversal subunit, used for performing a breadth-first search traversal on the starting node to obtain a fan-in node of the starting node; A second determination subunit is used to respectively use the fan-in nodes of the starting node as the starting node, and return to execute the step of performing a breadth-first search traversal on the starting node to obtain the fan-in nodes of the starting node; A construction subunit is used to construct a directed acyclic graph of the equity relationship of the target node based on the target node and the fan-in nodes of each of the starting nodes.
8. A computer program product, characterized in that It includes computer-readable instructions, and when the computer-readable instructions are executed on an electronic device, the electronic device implements the method for calculating the equity ratio of a customer as described in any one of claims 1 to 5.
9. An electronic device, characterized in that: The method comprises at least one processor and a memory connected to the processor, wherein: The memory is used to store computer programs; The processor is used to execute the computer program so that the electronic device can implement the method for calculating the equity ratio of a customer as described in any one of claims 1 to 5.
10. A computer storage medium, characterized in that: The storage medium carries one or more computer programs, and when the one or more computer programs are executed by an electronic device, the electronic device can implement the method for calculating the equity ratio of a customer as described in any one of claims 1 to 5.