A method and device for processing a directed weighted graph
By establishing and optimizing the directed weighted graph, the problem of handling complex debt relationships is solved, and the debt relationship is simplified and the systemic risk is reduced.
Patent Information
- Application Number
- CN202110183545.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-02-10
- Publication Date
- 2025-06-17
- Estimated Expiration
- 2041-02-10
AI Technical Summary
The existing technology is difficult to effectively deal with complex debt relationships, which can easily lead to systemic risks.
By obtaining the debt data and debt relationships between each trading enterprise, a directed weighted graph is established, and a deep priority algorithm is used to traverse the complex closed-loop chain, and the directed weighted graph of open chains is optimized to simplify the complexity of the debt relationship.
It reduces the complexity of debt relationships, effectively resolves systemic complex debt relationships, and reduces systemic risks.
Smart Images

Figure CN112925951B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of financial management, and in particular, to a method and apparatus for processing a directed weighted graph. Background Art
[0002] Among the countries with the most complete range of industries in the United Nations, the layout of production and trading enterprises is extensive, the categories are complete, and there are numerous entities. In production and operation, it is inevitable that debts will occur between various trading enterprises, and the debts generated in the industrial chain are easily transmitted up and down to form a debt chain. If not properly handled, it is easy to generate systemic risks. Thus, it can be seen that debt, this invisible killer lurking in economic activities, is everywhere, and will become an economic cancer through certain accumulation, seriously affecting the development of the economic society.
[0003] There are many complex relationships in the real world that can be represented by graphs. Graphs have penetrated into the research of complex social, biological, and technological systems with multi-dimensional data, or the dynamic processes of networks, such as the spread of epidemics. In network science, the problems that researchers are interested in are not solved by analyzing data, but by analyzing the structure of graphs. Therefore, the theory regarding the analysis and processing of signals on graphs is becoming increasingly mature. For example, complex debt relationships can be represented as a directed weighted graph. Therefore, there is an urgent need for a method to resolve systemic complex debt relationships through a directed weighted graph. Summary of the Invention
[0004] Aiming at the problems in the prior art, the present invention provides a method and apparatus for processing a directed weighted graph, which can simplify the directed weighted graph based on debt relationships, thereby reducing the complexity of debt relationships.
[0005] To solve the above technical problems, the present invention provides the following technical solutions:
[0006] In a first aspect, the present invention provides a method for processing a directed weighted graph, including:
[0007] Obtaining debt data and debt relationships between various trading enterprises;
[0008] Establishing a directed weighted graph based on the debt data and the debt relationships;
[0009] If the directed weighted graph is a single closed-loop chain, optimizing the directed weighted graph to obtain an open-chain directed weighted graph;
[0010] If the directed weighted graph is a complex closed-loop chain, traversing the directed weighted graph through a depth-first algorithm to obtain at least two weighted graphs in a single closed-loop chain state, and optimizing the weighted graphs to make the weighted graphs open-chain.
[0011] Wherein, the directed weighted graph includes at least three nodes and the weights between adjacent nodes.
[0012] Among them, optimizing the directed weighted graph to obtain an open-chain directed weighted graph includes:
[0013] Performing mutual cancellation processing based on the minimum weight value on the directed weighted graph to obtain an open-chain directed weighted graph;
[0014] Among them, a single closed-loop chain means that each node on the directed weighted graph has an incoming edge and an outgoing edge; an open chain means that the head node on the directed weighted graph only has an outgoing edge, and the tail node only has an incoming edge.
[0015] Among them, traversing the directed weighted graph through the depth-first algorithm to obtain at least two weighted graphs in the state of single closed-loop chains includes:
[0016] Start visiting from any node A in the directed weighted graph;
[0017] Sequentially start from the unvisited adjacent nodes starting from node A, and perform a depth-first traversal of the directed weighted graph; until all the nodes that are path-connected between the directed weighted graph and node A are visited, and at the same time record the weights between the visited nodes and their adjacent nodes;
[0018] If there are still nodes in the directed weighted graph that have not been visited, start visiting from any unvisited node, and perform a depth-first traversal again until all nodes in the directed weighted graph have been visited;
[0019] Form a directed path through iterative backtracking to obtain at least two weighted graphs in the state of single closed-loop chains.
[0020] If there are common edges in at least two weighted graphs in the state of single closed-loop chains;
[0021] Then split the at least two weighted graphs in the state of single closed-loop chains with common edges according to the respective minimum weight values corresponding to the at least two weighted graphs in the state of single closed-loop chains and the weight value corresponding to the common edge, to obtain at least two independent weighted graphs in the state of single closed-loop chains.
[0022] In a second aspect, the present invention provides a processing device for a directed weighted graph, including:
[0023] An acquisition module, configured to acquire debt data and debt relationships between various trading enterprises;
[0024] A weighted graph module, configured to establish a directed weighted graph based on the debt data and the debt relationships;
[0025] A first processing module, configured to, if the directed weighted graph is a single closed-loop chain, optimize the directed weighted graph to obtain an open-chain directed weighted graph;
[0026] A second processing module, configured to, if the directed weighted graph is a complex closed loop chain, traverse the directed weighted graph through a depth-first algorithm to obtain at least two weighted graphs in a single closed loop chain state, and optimize the weighted graph so that the weighted graph is an open chain.
[0027] Wherein, the directed weighted graph includes at least three nodes and the weights between adjacent nodes.
[0028] Wherein, the first processing module includes:
[0029] A cancellation unit, configured to perform mutual cancellation processing based on the minimum weight on the directed weighted graph to obtain an open-chain directed weighted graph;
[0030] Wherein, a single closed loop chain means that each node on the directed weighted graph has an incoming edge and an outgoing edge; an open chain means that the first node on the directed weighted graph has only an outgoing edge and the last node has only an incoming edge.
[0031] Wherein, the second processing module includes:
[0032] An access unit, configured to start accessing from any node A in the directed weighted graph;
[0033] A traversal unit, configured to start from the unvisited adjacent nodes starting from node A in sequence, perform a depth-first traversal on the directed weighted graph; until all the nodes that are path-connected to the directed weighted graph and node A are visited, and at the same time record the visited nodes and the weights between adjacent nodes;
[0034] An iteration unit, configured to, if there are still nodes in the directed weighted graph that have not been visited, start accessing from any unvisited node and perform a depth-first traversal again until all the nodes in the directed weighted graph have been visited;
[0035] A backtracking unit, configured to form a directed path through iterative backtracking to obtain at least two weighted graphs in a single closed loop chain state.
[0036] The backtracking unit is further configured to if there are common edges in at least two weighted graphs in a single closed loop chain state;
[0037] Then, split the at least two weighted graphs in a single closed loop chain state with common edges according to the respective minimum weights corresponding to the at least two weighted graphs in a single closed loop chain state and the weight corresponding to the common edge, to obtain at least two independent weighted graphs in a single closed loop chain state.
[0038] In a third aspect, the present invention provides an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, and when the processor executes the program, the steps of the processing method of the directed weighted graph are implemented.
[0039] Fourthly, the present invention provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the processing method of the directed weighted graph are implemented.
[0040] As can be seen from the above technical solutions, the present invention provides a processing method and device for a directed weighted graph. By obtaining the debt data and debt relationships between various trading enterprises; establishing a directed weighted graph based on the debt data and the debt relationships; if the directed weighted graph is a single closed-loop chain, optimizing the directed weighted graph to obtain an open-chain directed weighted graph; if the directed weighted graph is a complex closed-loop chain, traversing the directed weighted graph through a depth-first algorithm to obtain at least two weighted graphs in a single closed-loop chain state, and optimizing the weighted graph to make the weighted graph an open chain, it is possible to simplify the directed weighted graph based on debt relationships, thereby reducing the complexity of debt relationships and being able to better solve complex relationships such as debt types. A solution is proposed for resolving systematic complex debt relationships. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the following drawings are some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.
[0042] Figure 1 It is a schematic flowchart of the processing method of the directed weighted graph in the embodiment of the present invention.
[0043] Figure 2 It is a schematic diagram of the compensation of the single closed-loop chain directed weighted graph in the processing method of the directed weighted graph in the embodiment of the present invention.
[0044] Figure 3 It is a schematic diagram of the compensation of the open-chain directed weighted graph in the processing method of the directed weighted graph in the embodiment of the present invention.
[0045] Figure 4 It is a schematic flowchart of step S104 in the processing method of the directed weighted graph in the embodiment of the present invention.
[0046] Figure 5 It is a schematic diagram of the structure of the complex closed-loop chain in the processing method of the directed weighted graph in the embodiment of the present invention.
[0047] Figure 6 It is a schematic diagram of the structure of the co-edge chain in the processing method of the directed weighted graph in the embodiment of the present invention.
[0048] Figure 7Schematic diagram of the structure of the processing device for the directed weighted graph in the embodiments of the present invention.
[0049] Figure 8 Schematic diagram of the structure of the electronic device in the embodiments of the present invention. Detailed implementation manners
[0050] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Apparently, the described embodiments are some but not all of the embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.
[0051] The present invention provides an embodiment of a method for processing a directed weighted graph. Refer to Figure 1 , and the method for processing the directed weighted graph specifically includes the following contents:
[0052] S101: Obtain the debt data and debt relationships between various trading enterprises;
[0053] S102: Establish a directed weighted graph based on the debt data and the debt relationships;
[0054] It should be noted that each node in the directed weighted graph is each trading enterprise, the weight value between adjacent nodes is obtained by weighted calculation based on the debt data, and the in-edges and out-edges on each node in the directed weighted graph are the debt relationships between various trading enterprises.
[0055] In this embodiment, the directed weighted graph includes at least three nodes and the weight values between adjacent nodes.
[0056] S103: If the directed weighted graph is a single closed-loop chain, optimize the directed weighted graph to obtain an open-chain directed weighted graph;
[0057] In this step, for the directed weighted graph of a single closed-loop chain, as Figure 2 shown, the number of nodes in the directed weighted graph A is 6 (a, b, c, d, e, f), and the minimum value of the weight of the edge is 4. Since each node in the single closed-loop chain in the directed weighted graph has both in-edges and out-edges, for the minimum weight value of 4, mutual cancellation processing can be performed. Therefore, the edges of the single closed-loop chain directed weighted graph A become an open-chain directed weighted graph B after mutual cancellation processing; an open chain means that the first node in the directed weighted graph has only out-edges and the last node has only in-edges.
[0058] Among them, let f(x) be the cancellation function, then f(x) = 6 × 4 = 24. That is, for any single closed-loop chain A, let the number of its nodes be a and the minimum value of the weight be m, then its cancellation function fA (x) = am.
[0059] It should be noted that for an open chain, since it does not satisfy that each node has both an incoming edge and an outgoing edge (the head node has only an outgoing edge and the tail node has only an incoming edge), it is impossible to achieve automatic cancellation of weights.
[0060] S104: If the directed weighted graph is a complex closed loop chain, traverse the directed weighted graph through a depth-first algorithm to obtain at least two weighted graphs in the state of single closed loop chains, and optimize the weighted graph to make the weighted graph an open chain.
[0061] From the above description, it can be seen that the method for processing a directed weighted graph provided by the embodiment of the present invention obtains the debt data and debt relationships between various trading enterprises; establishes a directed weighted graph based on the debt data and the debt relationships; if the directed weighted graph is a single closed loop chain, optimize the directed weighted graph to obtain an open-chain directed weighted graph; if the directed weighted graph is a complex closed loop chain, traverse the directed weighted graph through a depth-first algorithm to obtain at least two weighted graphs in the state of single closed loop chains, and optimize the weighted graph to make the weighted graph an open chain, which can simplify the directed weighted graph based on the debt relationship, thereby reducing the complexity of the debt relationship and being able to better solve complex relationships such as debt types. It provides a solution for resolving systematic complex debt relationships.
[0062] In an embodiment of the present invention, refer to Figure 3 , and provide a compensation processing method for an open-chain directed weighted graph, which specifically includes the following content:
[0063] For an open chain, since it does not satisfy that each node has both an incoming edge and an outgoing edge (the head node has only an outgoing edge and the tail node has only an incoming edge), it is impossible to achieve automatic cancellation of weights. If the head node of the open chain can initiate the cancellation of weights, it can drive the cancellation of weights of the entire chain.
[0064] Introduce a super node g, which can be connected to any node of the directed weighted graph. The incoming edge weight of this node comes from the directed weighted graph and is extracted from the weights of each node in a preset manner, such as in proportion. As Figure 3 shown:
[0065] The left and right of the super node g provide a compensation mechanism for the open chain, which can promote the cancellation effect of the weights of the open chain nodes. The following is an example for illustration:
[0066] This compensation mechanism in real life is helpful for cleaning the weights of open chains. For example, for an open chain formed by debts, such as when a bank acts as a super node and a debt enterprise registers and authenticates into the bank's debt network, the bank extracts a portion of funds (e.g., 1%) according to the debt situation and puts it into the bank's debt fund pool. When encountering an open-chain debt chain where automatic debt cleaning cannot be achieved, debt funds are compensated from the fund pool according to the total amount of debts involved in the chain. Then, for the first node of this debt chain, by paying a small amount of debt authentication fees and obtaining debt compensation provided by the bank that is greater than this fee, it can be prompted to repay the debt, and thus the debts of this debt chain can be cleaned to a certain extent.
[0067] In an embodiment of the present invention, referring to Figure 4 , a method for traversing the directed weighted graph through a depth-first algorithm is provided, which specifically includes the following contents:
[0068] S1041: Start accessing from any node A in the directed weighted graph;
[0069] S1042: Starting from the unvisited adjacent nodes of node A in sequence, perform a depth-first traversal of the directed weighted graph; until all the nodes in the directed weighted graph that are path-connected to node A are visited, and at the same time record the weights between the visited nodes and their adjacent nodes;
[0070] S1043: If there are still nodes in the directed weighted graph that have not been visited, start accessing from any unvisited node and perform a depth-first traversal again until all nodes in the directed weighted graph have been visited;
[0071] S1044: Form a directed path through iterative backtracking to obtain at least two weighted graphs in the state of single closed-loop chains.
[0072] In this embodiment, for the directed weighted graph, the key lies in identifying the links. For a complex directed weighted graph as shown in Figure 5 , this directed weighted graph can be traversed using the depth-first algorithm (DFS):
[0073] All the links of this directed weighted graph can be obtained through the depth-first algorithm (DFS). Some of these links are closed-loop links, simply referred to as closed chains, and some are open links, simply referred to as open chains.
[0074] It should be noted that in the above step S1044, the complex directed weighted graph can be converted into closed chains and open chains; among them, there are cases where links share edges, that is, one link contains the nodes and edges in another link.
[0075] If at least two weighted graphs in the state of single closed-loop chains share edges;
[0076] Then, according to the minimum weights corresponding to the weighted graphs of at least two single closed-loop chain states and the weights corresponding to the common edges, the weighted graphs of at least two single closed-loop chain states sharing the common edges are split to obtain at least two independent weighted graphs of single closed-loop chain states.
[0077] In this embodiment, for Figure 6 , for those links where there are common edges in the weighted graphs of at least two single closed-loop chain states, processing is required. The weights on the common links are allocated in an optimal manner. Define a link A(a,m), where a represents the number of nodes in the link and m represents the minimum weight of all edges on the link.
[0078] 1. Two closed-loop chains share a common link: A(a,m), B(b,n), with their common edge being L and the weight being l:
[0079] (1) When l≥m + n, the weight of the common edge can be directly allocated according to the minimum weights of the two closed-loop chains A and B to form two independent closed-loop chains A′(a,m), B′(b,n), and f(x) = am + bn.
[0080] (2) When l≥m, l≥n and l<m + n, the weight of the common edge needs to be allocated between the two common links. Assume 0≤x≤m, and the weight allocated on A is x, then the weight allocated on B is l - x. The profit functions for the weights allocated on the two chains are as follows:
[0081] f(x) = ax + b(l - x) = (a - b)x + bl, where the value range of x is l - n≤x≤m. It should be noted that when x>m, for the closed-loop chain, its value can only play the role of m. When l ensures that the B chain is fully allocated n according to its minimum value n, the rest should be allocated to the A chain, so the minimum value of x should be l - n. According to the characteristics of the linear function, when a>b, f(x) takes the maximum value when x = m; when a < b, f(x) takes the maximum value when x = l - n; when a = b, f(x) takes the constant value bl, that is, l can be randomly allocated between the A chain and the B chain.
[0082] (3) When x∈[min(m,n),max(m,n)], if m>n, then f(x) = max(al,bn); if m < n, then f(x) = max(am,bl).
[0083] (4) When l<m and l<n, then l is the minimum weight value of both the A chain and the B chain, and f(x) = max(al,bl).
[0084] The above discusses the case of 2 common links. For the case of 3 common links, assume three closed-loop chains share a common link: A(a,m), B(b,n), C(c,k), with their common edge being L and the weight being l. For the allocation of l, the profit - first principle is adopted, as follows:
[0085] (1) When l ≥ m + n + k, according to the foregoing, f(x) = am + bn + ck.
[0086] (2) When l is greater than or equal to the sum of any two of m, n, and k and less than the sum of the three, such as m + n ≤ l ≤ m + n + k, compare the magnitudes of am + bn and ck. If am + bn ≥ ck, then l is mainly allocated to the common chain of A and B, and l - (m + n) is allocated to chain C; if am + bn < ck, then l is mainly allocated to chain C, and l - k is allocated to the common chain of A and B. The remaining is processed according to the two common chains.
[0087] (3) When l is not greater than the sum of any two of m, n, and k, but l is greater than or equal to m, n, and k, compare the magnitudes of am, bn, and ck, and allocate to the one with the largest value first. The other cases are similar and will not be listed one by one. The remaining common chain is processed with reference to the foregoing.
[0088] For the case of more than 3 common chains, it can be recursively split in turn.
[0089] For the case of a closed-loop chain and an open-chain common chain: Let the closed-loop chain be A(a, m) and the open-chain be B(b, n), and their common edge be L with a weight value of l. According to the foregoing, l is preferentially allocated to the closed-loop chain. For the case of two open-chains in common, the allocation is made with reference to the case of two closed-loop chains in common.
[0090] The embodiments of the present invention provide a specific implementation manner of a processing device for a directed weighted graph that can implement all the contents in the processing method of the directed weighted graph. Refer to Figure 7 , the processing device for the directed weighted graph specifically includes the following contents:
[0091] An acquisition module 10, configured to acquire debt data and debt relationships between various trading enterprises;
[0092] A weighted graph module 20, configured to establish a directed weighted graph based on the debt data and the debt relationships;
[0093] A first processing module 30, configured to optimize the directed weighted graph to obtain an open-chain directed weighted graph if the directed weighted graph is a single closed-loop chain;
[0094] A second processing module 40, configured to traverse the directed weighted graph by using a depth-first algorithm to obtain at least two weighted graphs in a single closed-loop chain state if the directed weighted graph is a complex closed-loop chain, and optimize the weighted graph to make the weighted graph an open chain.
[0095] Wherein, the directed weighted graph includes at least three nodes and weight values between adjacent nodes.
[0096] Among them, the first processing module includes:
[0097] A cancellation unit, configured to perform mutual cancellation processing based on the smallest weight value on the directed weighted graph to obtain an open-chain directed weighted graph;
[0098] Among them, a single closed loop chain means that each node on the directed weighted graph has an incoming edge and an outgoing edge; an open chain means that the head node on the directed weighted graph has only an outgoing edge and the tail node has only an incoming edge.
[0099] Among them, the second processing module includes:
[0100] An access unit, configured to start accessing from any node A in the directed weighted graph;
[0101] A traversal unit, configured to start from the unvisited adjacent nodes starting from node A in sequence, and perform a depth-first traversal on the directed weighted graph; until all the nodes that are path-connected to the directed weighted graph and node A are visited, and at the same time record the weights between the visited nodes and their adjacent nodes;
[0102] An iteration unit, configured to, if there are still nodes in the directed weighted graph that have not been visited, start accessing from any unvisited node and perform a depth-first traversal again until all nodes in the directed weighted graph have been visited;
[0103] A backtracking unit, configured to form a directed path through iterative backtracking to obtain at least two weighted graphs in a single closed loop chain state.
[0104] The backtracking unit is further configured to if there are common edges in at least two weighted graphs in a single closed loop chain state;
[0105] Then, split the at least two weighted graphs in a single closed loop chain state with the common edge according to the respective minimum weight values corresponding to the at least two weighted graphs in a single closed loop chain state and the weight value corresponding to the common edge to obtain at least two independent weighted graphs in a single closed loop chain state.
[0106] The embodiment of the processing device for a directed weighted graph provided by the present invention can specifically be used to execute the processing flow of the embodiment of the processing method for a directed weighted graph in the above embodiment, and its functions will not be elaborated here, and reference can be made to the detailed description of the above method embodiment.
[0107] As can be seen from the above description, the processing device for the directed weighted graph provided by the embodiment of the present invention obtains the debt data and debt relationships between various trading enterprises; establishes a directed weighted graph based on the debt data and the debt relationships; if the directed weighted graph is a single closed-loop chain, optimizes the directed weighted graph to obtain an open-chain directed weighted graph; if the directed weighted graph is a complex closed-loop chain, traverses the directed weighted graph through a depth-first algorithm to obtain at least two weighted graphs in a single closed-loop chain state, and optimizes the weighted graph to make the weighted graph an open chain, which can simplify the directed weighted graph based on the debt relationship, thereby reducing the complexity of the debt relationship and being able to better solve complex relationships such as debt types. A solution is proposed to resolve systematic complex debt relationships.
[0108] This application provides an embodiment of an electronic device for implementing all or part of the content in the processing method of the directed weighted graph. The electronic device specifically includes the following:
[0109] A processor, a memory, a communication interface, and a bus; wherein, the processor, the memory, and the communication interface complete communication with each other through the bus; the communication interface is used to implement information transmission between related devices; the electronic device can be a desktop computer, a tablet computer, a mobile terminal, etc., and this embodiment is not limited thereto. In this embodiment, the electronic device can be implemented with reference to the embodiments for implementing the processing method of the directed weighted graph and the embodiments for implementing the processing device of the directed weighted graph, and the content is incorporated herein, and the repeated parts will not be elaborated.
[0110] Figure 8 It is a schematic block diagram of the system composition of the electronic device 9600 according to an embodiment of this application. As Figure 8 shown, the electronic device 9600 may include a central processing unit 9100 and a memory 9140; the memory 9140 is coupled to the central processing unit 9100. It should be noted that this Figure 8 is exemplary; other types of structures can also be used to supplement or replace this structure to implement telecommunication functions or other functions.
[0111] In one embodiment, the processing function of the directed weighted graph can be integrated into the central processing unit 9100. Among them, the central processing unit 9100 can be configured to perform the following controls:
[0112] Obtain the debt data and debt relationships among various trading enterprises; establish a directed weighted graph based on the debt data and the debt relationships; if the directed weighted graph is a single closed-loop chain, optimize the directed weighted graph to obtain an open-chain directed weighted graph; if the directed weighted graph is a complex closed-loop chain, traverse the directed weighted graph through a depth-first algorithm to obtain at least two weighted graphs in the state of single closed-loop chains, and optimize the weighted graphs to make the weighted graphs into open chains.
[0113] As can be seen from the above description, the electronic device provided by the embodiment of the present application obtains the debt data and debt relationships among various trading enterprises; establishes a directed weighted graph based on the debt data and the debt relationships; if the directed weighted graph is a single closed-loop chain, optimize the directed weighted graph to obtain an open-chain directed weighted graph; if the directed weighted graph is a complex closed-loop chain, traverse the directed weighted graph through a depth-first algorithm to obtain at least two weighted graphs in the state of single closed-loop chains, and optimize the weighted graphs to make the weighted graphs into open chains, which can simplify the directed weighted graph based on the debt relationship, thereby reducing the complexity of the debt relationship and being able to better solve complex relationships such as debt types.
[0114] In another embodiment, the processing device of the directed weighted graph can be separately configured from the central processing unit 9100. For example, the processing of the directed weighted graph can be configured as a chip connected to the central processing unit 9100, and the processing function of the directed weighted graph is realized through the control of the central processing unit.
[0115] As Figure 8 shown, the electronic device 9600 may further include: a communication module 9110, an input unit 9120, an audio processor 9130, a display 9160, and a power supply 9170. It should be noted that the electronic device 9600 does not necessarily have to include Figure 8 all the components shown in Figure 8 ; in addition, the electronic device 9600 may further include
[0116] As Figure 8 shown, the central processing unit 9100 is sometimes also called a controller or an operation control, and may include a microprocessor or other processor devices and / or logic devices. The central processing unit 9100 receives inputs and controls the operations of the various components of the electronic device 9600.
[0117] Among them, the memory 9140 can be, for example, one or more of a buffer, a flash memory, a hard drive, a removable medium, a volatile memory, a non-volatile memory, or other suitable devices. The above information related to failures can be stored, and in addition, a program for executing relevant information can also be stored. And the central processing unit 9100 can execute the program stored in the memory 9140 to achieve information storage or processing, etc.
[0118] The input unit 9120 provides input to the central processing unit 9100. The input unit 9120 is, for example, a key or a touch input device. The power supply 9170 is used to supply power to the electronic device 9600. The display 9160 is used to display display objects such as images and texts. The display can be, for example, an LCD display, but is not limited thereto.
[0119] The memory 9140 can be a solid-state memory. For example, a read-only memory (ROM), a random access memory (RAM), a SIM card, etc. It can also be a memory that stores information even when power is off, can be selectively erased, and has more data. An example of this memory is sometimes referred to as an EPROM, etc. The memory 9140 can also be some other type of device. The memory 9140 includes a buffer memory 9141 (sometimes referred to as a buffer). The memory 9140 can include an application / function storage unit 9142, and the application / function storage unit 9142 is used to store application programs and function programs or the processes for operating the electronic device 9600 through the central processing unit 9100.
[0120] The memory 9140 can also include a data storage unit 9143, and the data storage unit 9143 is used to store data, such as contacts, digital data, pictures, sounds, and / or any other data used by the electronic device. The driver storage unit 9144 of the memory 9140 can include various drivers of the electronic device for communication functions and / or for executing other functions of the electronic device (such as a messaging application, an address book application, etc.).
[0121] The communication module 9110 is a transmitter / receiver 9110 that transmits and receives signals via the antenna 9111. The communication module (transmitter / receiver) 9110 is coupled to the central processing unit 9100 to provide input signals and receive output signals, which can be the same as the case of a conventional mobile communication terminal.
[0122] Based on different communication technologies, in the same electronic device, multiple communication modules 9110 can be provided, such as a cellular network module, a Bluetooth module, and / or a wireless local area network module, etc. The communication module (transmitter / receiver) 9110 is also coupled to a speaker 9131 and a microphone 9132 via an audio processor 9130 to provide an audio output via the speaker 9131 and receive an audio input from the microphone 9132, thereby implementing normal telecommunication functions. The audio processor 9130 may include any suitable buffers, decoders, amplifiers, etc. Additionally, the audio processor 9130 is also coupled to a central processor 9100, enabling recording on the device through the microphone 9132 and playing the sounds stored on the device through the speaker 9131.
[0123] Embodiments of the present invention also provide a computer-readable storage medium capable of implementing all steps in the processing method of the directed weighted graph in the above embodiments. A computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, all steps of the processing method of the directed weighted graph in the above embodiments are implemented. For example, when the processor executes the computer program, the following steps are implemented:
[0124] Obtain the debt data and debt relationships between each trading enterprise; establish a directed weighted graph based on the debt data and the debt relationships; if the directed weighted graph is a single closed-loop chain, optimize the directed weighted graph to obtain an open-chain directed weighted graph; if the directed weighted graph is a complex closed-loop chain, perform a traversal process on the directed weighted graph through a depth-first algorithm to obtain at least two weighted graphs in a single closed-loop chain state, and optimize the weighted graph to make the weighted graph an open chain.
[0125] As can be seen from the above description, the computer-readable storage medium provided by the embodiments of the present invention can simplify the directed weighted graph based on debt relationships by obtaining the debt data and debt relationships between each trading enterprise; establishing a directed weighted graph based on the debt data and the debt relationships; if the directed weighted graph is a single closed-loop chain, optimizing the directed weighted graph to obtain an open-chain directed weighted graph; if the directed weighted graph is a complex closed-loop chain, performing a traversal process on the directed weighted graph through a depth-first algorithm to obtain at least two weighted graphs in a single closed-loop chain state, and optimizing the weighted graph to make the weighted graph an open chain, thereby reducing the complexity of the debt relationships and being able to better solve complex relationships such as debt types.
[0126] Although the present invention provides method operation steps as described in the embodiments or flowcharts, more or fewer operation steps may be included based on routine or non-creative labor. The order of steps listed in the embodiments is only one way among many execution orders of steps and does not represent the only execution order. When the actual device or client product is executed, it may be executed in the order of the method shown in the embodiments or the drawings or executed in parallel (such as in an environment of parallel processors or multi-threaded processing).
[0127] Those skilled in the art should understand that the embodiments of this specification can be provided as methods, devices (systems) or computer program products. Therefore, the embodiments of this specification can take the form of completely hardware embodiments, completely software embodiments or embodiments combining software and hardware aspects. Moreover, the present invention can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk memories, CD-ROMs, optical memories, etc.) containing computer-usable program code therein.
[0128] The present invention is described with reference to the flowcharts and / or block diagrams of methods, devices (systems) and computer program products according to the embodiments of the present invention. It should be understood that each flow and / or block in the flowchart and / or block diagram can be implemented by computer program instructions, and the combination of the flows and / or blocks in the flowchart and / or block diagram can also be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor or other programmable data processing devices to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing devices generate a device for implementing the specified functions in one process Figure 1 one process or multiple processes and / or blocks Figure 1 or multiple blocks.
[0129] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory generate a manufactured article including an instruction device, and the instruction device implements the specified functions in one process Figure 1 one process or multiple processes and / or blocks Figure 1 or multiple blocks.
[0130] These computer program instructions can also be loaded onto a computer or other programmable data processing device, so that a series of operation steps are executed on the computer or other programmable device to generate a computer-implemented process, and thus the instructions executed on the computer or other programmable device provide steps for implementing the specified functions in one process Figure 1 one process or multiple processes and / or blocks Figure 1 or multiple blocks.
[0131] Each embodiment in this specification is described in a progressive manner. For the same or similar parts among the embodiments, reference can be made to each other, and the key point of each embodiment is to illustrate the differences from other embodiments. It should be noted that, without conflict, the embodiments and the features in the embodiments of the present invention can be combined with each other. The present invention is not limited to any single aspect, nor to any single embodiment, nor to any arbitrary combination and / or permutation of these aspects and / or embodiments. Moreover, each aspect and / or embodiment of the present invention can be used alone or in combination with one or more other aspects and / or their embodiments.
[0132] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements on some or all of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present invention, and they should all be covered by the scope of the claims and the specification of the present invention.
Claims
1. A method for processing a directed weighted graph, characterized in that, Including: Obtaining debt data and debt relationships among various trading enterprises; Establishing a directed weighted graph based on the debt data and the debt relationships; If the directed weighted graph is a single closed-loop chain, optimizing the directed weighted graph to obtain an open-chain directed weighted graph; If the directed weighted graph is a complex closed-loop chain, traversing the directed weighted graph through a depth-first algorithm to obtain at least two weighted graphs in a single closed-loop chain state, and optimizing the weighted graph to make the weighted graph an open chain; if there are common edges in at least two weighted graphs in a single closed-loop chain state, then splitting the at least two weighted graphs in a single closed-loop chain state with common edges according to the minimum weights corresponding to the at least two weighted graphs in a single closed-loop chain state and the weight corresponding to the common edge, to obtain at least two independent weighted graphs in a single closed-loop chain state; where: When two closed-loop chains have a common edge, the two closed-loop chains are A(a, m) and B(b, n) respectively, where a represents the number of nodes of A(a, m), m represents the minimum value of the weights of all edges on A(a, m), b represents the number of nodes of B(b, n), n represents the minimum value of the weights of all edges on B(b, n), the common edge is l, and the weight corresponding to the common edge is 1. The weight corresponding to the common edge is distributed according to the principle of profit priority, where: When l≥m + n, the weight of the common edge is directly distributed according to the minimum weights of the two closed-loop chains A(a, m) and B(b, n) to form two independent closed-loop chains A′(a, m) and B′(b, n), and the profit functions for distributing weights on the two chains are: f(x) = am + bn; When l≥m, l≥n and l<m + n, assume that the weight distributed on A is x and 0≤x≤m, then the weight distributed on B is l - x, and the profit functions for distributing weights on the two chains are: f(x) = ax + b(l - x) = (a - b)x + bl; where: When the value range of x is l - n≤x≤m, according to the characteristics of the linear function, when a>b, f(x) takes the maximum value when x = m; when a<b, f(x) takes the maximum value when x = l - n; when a = b, f(x) takes the constant value bl, and l can be randomly distributed on the A′(a, m) chain and the B(b, n) chain; When x∈[min(m, n), max(m, n)], when m>n, then f(x) = max(al, bn); when m<n, then f(x) = max(am, bl); When l<m and l<n, l is the minimum weight value of the A′(a, m) chain and the B(b, n) chain, and f(x) = max(al, bl); Among them, for an open chain, since it does not satisfy that each node has an in-edge and an out-edge, a super node g is introduced, and the super node g can be connected to any node of the directed weighted graph, where: The super node g is a bank. When a debt enterprise registers and authenticates into the bank's debt network, the bank extracts a portion of funds in proportion to the debt situation and puts it into the bank's debt fund pool. When encountering an open-chain debt chain where automatic debt clearance cannot be achieved, debt fund compensation is provided from the bank's debt fund pool according to the total amount of debt involved in the open-chain debt chain. For the first node of the open-chain debt chain, a small amount of debt authentication fee is paid, and thus debt compensation greater than the debt authentication fee provided by the bank can be obtained, which can prompt the first node of the open-chain debt chain to repay the debt.
2. The method for processing a directed weighted graph according to claim 1, characterized in that, The directed weighted graph contains at least three nodes and the weights between adjacent nodes.
3. The method for processing a directed weighted graph according to claim 2, characterized in that, Optimizing the directed weighted graph to obtain an open-chain directed weighted graph includes: Based on the smallest weight on the directed weighted graph, mutual cancellation processing is performed to obtain an open-chain directed weighted graph; Among them, a single closed-loop chain means that each node on the directed weighted graph has an incoming edge and an outgoing edge; an open chain means that the first node on the directed weighted graph has only an outgoing edge and the last node has only an incoming edge.
4. The method for processing a directed weighted graph according to claim 2, characterized in that, Traversing the directed weighted graph through the depth-first algorithm to obtain at least two weighted graphs in the state of single closed-loop chains includes: Starting from any node A in the directed weighted graph for access; Successively starting from the unvisited adjacent nodes starting from node A, performing a depth-first traversal of the directed weighted graph; until all nodes in the directed weighted graph that have a path connection with node A are visited, and at the same time recording the visited nodes and the weights between adjacent nodes; If there are still nodes in the directed weighted graph that have not been visited, start from any unvisited node for access and perform a depth-first traversal again until all nodes in the directed weighted graph have been visited; Forming a directed path through iterative backtracking to obtain at least two weighted graphs in the state of single closed-loop chains.
5. A device for processing a directed weighted graph, characterized in that, Including: An acquisition module for acquiring the debt data and debt relationships between various trading enterprises; A weighted graph module for establishing a directed weighted graph based on the debt data and the debt relationships; A first processing module for optimizing the directed weighted graph to obtain an open-chain directed weighted graph if the directed weighted graph is a single closed-loop chain; A second processing module for, if the directed weighted graph is a complex closed-loop chain, traversing the directed weighted graph through the depth-first algorithm to obtain at least two weighted graphs in the state of single closed-loop chains, and optimizing the weighted graph to make the weighted graph an open chain; where: When two closed-loop chains share an edge, the two closed-loop chains are respectively A(a, m) and B(b, n), where a represents the number of nodes of A(a, m), m represents the minimum value of the weights of all edges on A(a, m), b represents the number of nodes of B(b, n), n represents the minimum value of the weights of all edges on B(b, n), the shared edge is l, and the weight corresponding to the shared edge is 1. The weight corresponding to the shared edge is distributed according to the principle of profit priority, where: When l ≥ m + n, the weight of the shared edge is directly distributed according to the minimum weights of the two closed-loop chains A(a, m) and B(b, n) to form two independent closed-loop chains A′(a, m) and B′(b, n), and the profit functions for distributing weights on the two chains are: f(x) = am + bn; When l≥m, l≥n and l<m + n, assume that the weight value x is assigned on A and 0≤x≤m, then the weight value assigned on B is l - x, and the revenue function of the weight values assigned on the two chains is: f(x) = ax + b(l - x) = (a - b)x + bl; where: When the value range of x is l - n≤x≤m, according to the characteristics of the linear function, when a>b, f(x) takes the maximum value when x = m; when a<b, f(x) takes the maximum value when x = l - n; when a = b, the value of f(x) is the constant bl, and l can be arbitrarily assigned on the chain A′(a, m) and the chain B(b, n). When x∈[min(m, n), max(m, n)], when m>n, then f(x) = max(al, bn); when m<n, then f(x) = max(am, bl). When l<m and l<n, l is the minimum weight value of the chain A′(a, m) and the chain B(b, n), and f(x) = max(al, bl). Among them, for the open chain, since it does not satisfy that each node has an incoming edge and an outgoing edge, a super node g is introduced. The super node g can be connected to any node of the directed weighted graph, where: The super node g is a bank. When registering and authenticating the debt network of the debtor enterprise into the bank, the bank extracts a part of the funds proportionally according to the debt situation and enters the bank debt fund pool. When encountering an open chain debt chain and unable to realize the automatic clearing of debts, debt fund compensation is provided from the bank debt fund pool according to the total amount of debts involved in the open chain debt chain. For the first node of the open chain debt chain, a small amount of debt authentication fee is paid, so as to obtain debt compensation provided by the bank that is greater than the debt authentication fee, which can prompt the first node of the open chain debt chain to repay the debt.
6. The processing device for a directed weighted graph according to claim 5, wherein, The directed weighted graph includes at least three nodes and the weight values between adjacent nodes.
7. The processing device for a directed weighted graph according to claim 6, wherein, The first processing module includes: An offset unit, configured to perform mutual offset processing based on the minimum weight value on the directed weighted graph to obtain an open chain directed weighted graph. Among them, a single closed loop chain means that each node on the directed weighted graph has an incoming edge and an outgoing edge; an open chain means that the first node on the directed weighted graph has only an outgoing edge and the last node has only an incoming edge.
8. The processing device for a directed weighted graph according to claim 6, wherein, The second processing module includes: An access unit, configured to start accessing from any node A in the directed weighted graph. A traversal unit, configured to start from the unvisited adjacent nodes starting from node A in turn, and perform a depth - first traversal on the directed weighted graph; until all the nodes that are path - connected to the directed weighted graph and node A are visited, and at the same time record the visited nodes and the weight values between adjacent nodes. An iteration unit, configured to if there are still nodes in the directed weighted graph that have not been visited, start accessing from any unvisited node and perform a depth - first traversal again until all nodes in the directed weighted graph have been visited. A backtracking unit, configured to form a directed path through iterative backtracking to obtain at least two weighted graphs in the state of single closed loop chains.
9. An electronic device, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein, When the processor executes the program, it implements the steps of the processing method of the directed weighted graph described in any one of claims 1 to 4.
10. A computer-readable storage medium, on which a computer program is stored, wherein, When the computer program is executed by a processor, it implements the steps of the processing method of the directed weighted graph described in any one of claims 1 to 4.
Citation Information
Patent Citations
Debt resolution method and system based on big data
CN110838056A