Resource flow path extraction method and device, storage medium and program product

By disassembling and grouping path fragments of resource maps, combined with tree reorganization and traversal technology, the inefficiency of resource flow path extraction in large-scale resource maps is solved, and efficient and accurate path extraction and analysis are achieved.

CN120512397APending Publication Date: 2025-08-19ALIPAY (HANGZHOU) INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510857590.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-24
Publication Date
2025-08-19

AI Technical Summary

Technical Problem

In the process of extracting resource flow paths in large-scale resource maps, the network IO pressure has increased sharply, computing bottlenecks and long-tail problems, resulting in increased communication costs and inefficient computing efficiency.

Method used

The resource flow path in the resource map is broken down into independent path segments, and group and reorganize based on the path segment identification information. The resource flow path is extracted through traversal and tree reorganization, avoiding the duplicate transmission of upstream path information, isolating irrelevant paths, and building a clear node connection sequence.

Benefits of technology

It significantly reduces network IO load, improves the extraction efficiency and accuracy of resource flow paths, reduces the computational complexity, supports efficient processing of massive data and complex flow structures, and improves data support for risk control analysis and abnormal detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120512397A_ABST
    Figure CN120512397A_ABST
Patent Text Reader

Abstract

One or more embodiments of the invention provide a resource flow path extraction method and device, a storage medium and a program product. The extraction method comprises the following steps: acquiring a resource map comprising nodes and directed edges; directed edges in the resource map are traversed, path fragments corresponding to the directed edges are obtained, and the path fragments comprise starting nodes and ending nodes of the directed edges, root path fragment identifiers representing path starting points, parent path fragment identifiers representing upstream sources and current path fragment identifiers of the path fragments; grouping the extracted path fragments according to root path fragment identifiers, so that the path fragments with the same root path fragment identifier are classified into the same group; and carrying out resource flow path extraction operation on the at least one group of path fragments, and the extraction operation comprises the steps of determining a node connection sequence in the resource flow path based on a corresponding relationship between a parent path fragment identifier of the path fragments in the group and a current path fragment identifier, and obtaining the resource flow path.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] One or more embodiments of this specification relate to the field of graph data processing technology, and in particular, to a method for extracting resource flow paths, an electronic device, a computer-readable storage medium, and a computer program product. Background Art

[0002] In modern resource management systems, a vast amount of resources are transferred daily. For example, in payment systems, hundreds of billions of yuan in transactions may occur daily, involving multiple participants such as individuals, merchants, and institutions, forming a complex and densely connected resource flow network. By structurally modeling this resource change information, a resource graph can be formed. Extracting and analyzing resource flow paths in the resource graph provides critical support for risk control assessment, anomaly detection, path tracing, and graph structure analysis.

[0003] In a resource graph processing method of related technology, the resource flow path is extracted through step-by-step message passing and accumulation. For example, in the process of calculating the path b→c based on the resource graph, if node b receives the message a→b from the upstream node a, it will generate the path a→b→c on this basis, and continue to pass the path information to the downstream node c in the resource graph. On this basis, if node f is the downstream node of node c, then when calculating the path c→f, the path a→b→c→f will be obtained and continued to be passed on; if the path reaches the end node, the calculation result will be temporarily stored.

[0004] The above-mentioned path-accumulating propagation method, as the scale of the resource map increases and the flow path deepens, will cause a large amount of intermediate path information to be redundantly transmitted between networks, resulting in a sharp increase in network IO pressure and a significant increase in communication costs between nodes, which in turn causes computing bottlenecks and long-tail problems. Summary of the Invention

[0005] In view of this, one or more embodiments of this specification provide a method for extracting a resource flow path, an electronic device, a computer-readable storage medium, and a computer program product.

[0006] To achieve the above objectives, one or more embodiments of this specification provide the following technical solutions:

[0007] According to a first aspect of one or more embodiments of this specification, a method for extracting a resource flow path is proposed, including:

[0008] Obtain a resource graph, wherein the resource graph includes nodes and directed edges, wherein the nodes represent entities related to the resources, and the directed edges represent the flow direction of the resources;

[0009] Traversing the directed edges in the resource graph to obtain path segments corresponding to the directed edges, the path segments including: the starting node and ending node of the directed edge, a root path segment identifier indicating the starting point of the resource flow path, a parent path segment identifier indicating the upstream source of the path segment, and a current path segment identifier of the path segment itself;

[0010] Grouping the extracted path segments according to the root path segment identifiers so that the path segments with the same root path segment identifier are grouped into the same group;

[0011] A resource flow path extraction operation is performed on at least one group of path segments, the extraction operation including: determining a node connection order in the resource flow path based on a correspondence between a parent path segment identifier and a current path segment identifier of the path segments in the group, and obtaining the resource flow path.

[0012] According to a second aspect of the embodiments of this specification, an electronic device is provided, including:

[0013] processor;

[0014] a memory for storing processor-executable instructions;

[0015] Wherein, when the processor executes the executable instructions, it is used to implement the method described in the first aspect.

[0016] According to a third aspect of the embodiments of this specification, a computer-readable storage medium is provided, on which a computer program is stored, and when the program is executed by a processor, the steps of the method described in the first aspect are implemented.

[0017] According to a fourth aspect of the embodiments of this specification, a computer program product is provided, comprising a computer program, which implements the steps of the method described in the first aspect when executed by a processor.

[0018] The technical solutions provided by the embodiments of this specification may have the following beneficial effects:

[0019] In the embodiments of this specification, efficient extraction of resource flow paths is achieved by decomposing the resource flow paths in the resource map into independent path segments, and grouping and reorganizing them based on the path segment identification information. During the path segment acquisition process, only the key information of the path segments corresponding to the directed edges is obtained, avoiding the repeated transmission of upstream path information and significantly reducing the network IO load; by grouping the path segments according to the root path identification, the resource flow paths of each group are restored, irrelevant paths are isolated, and cross-interference is avoided; during the path restoration process, the correspondence between the parent path segment identification of the path segment and the path segment identification is referenced to make the path construction logic clear and controllable.

[0020] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] Figure 1 This is a schematic diagram of a knowledge graph involving capital flow provided by an exemplary embodiment.

[0022] Figure 2 It is a schematic diagram of extracting resource flow paths through step-by-step message passing and accumulation in related technologies.

[0023] Figure 3 This is a flowchart of a method for extracting a resource flow path provided by an exemplary embodiment.

[0024] Figure 4 A schematic diagram of traversing directed edges in a resource graph to obtain path segments corresponding to the directed edges is provided by an exemplary embodiment.

[0025] Figure 5 This is a schematic diagram of grouping extracted path segments according to root path segment identifiers, provided by an exemplary embodiment.

[0026] Figure 6 It is a schematic diagram of tree reorganization and resource flow path extraction provided by an exemplary embodiment.

[0027] Figure 7 It is a schematic diagram of a resource flow path provided by an exemplary embodiment.

[0028] Figure 8 It is a schematic diagram of a partitioned resource transfer tree provided by an exemplary embodiment.

[0029] Figure 9 It is a structural diagram of an electronic device provided by an exemplary embodiment. DETAILED DESCRIPTION

[0030] Exemplary embodiments will be described in detail herein, with examples illustrated in the accompanying drawings. In the following description, when referring to the drawings, identical numerals in different figures represent identical or similar elements, unless otherwise indicated. The implementations described in the following exemplary embodiments are not intended to represent all implementations consistent with one or more embodiments of this specification. Rather, they are merely examples of apparatuses and methods consistent with certain aspects of one or more embodiments of this specification, as detailed in the appended claims.

[0031] It should be noted that in other embodiments, the steps of the corresponding method are not necessarily performed in the order shown and described in this specification. In some other embodiments, the method may include more or fewer steps than those described in this specification. In addition, a single step described in this specification may be broken down into multiple steps for description in other embodiments, and multiple steps described in this specification may be combined into a single step for description in other embodiments.

[0032] The user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this manual are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions, and corresponding operation entrances are provided for users to choose to authorize or refuse.

[0033] Explanation of relevant terms:

[0034] (1) Knowledge graph: The knowledge graph aims to describe various entities or concepts and their relationships in the real world. It constitutes a huge semantic network graph, where nodes represent entities or concepts and edges are composed of attributes or relationships.

[0035] (2) Hot nodes: In large-scale graphs, some nodes have much higher number of connections than other nodes. These nodes need to process more information during the calculation process, resulting in high consumption of computing / storage resources or becoming a performance bottleneck, which significantly affects the efficiency and scalability of graph construction / analysis.

[0036] (3) Funds flow path: refers to the complete chain or trajectory of funds transferred from one account, entity, or economic participant to another during economic activities or financial transactions. This path describes in detail the direction, path, and conversion relationship between various points of fund flow, covering the entire process from the initial source, through a series of links that may include banks, financial markets, enterprises, individual consumers, or other financial institutions, to the final destination.

[0037] In modern resource management systems, a large amount of resource transfer occurs every day. By modeling these resource change information, a resource map can be formed. Figure 1The knowledge graph involving fund flow is shown by extracting nodes, edges and corresponding attributes from transaction data: the payment account is the starting point, the receiving account is the end point, and the transaction is a directed edge pointing from the starting node to the ending node. Node attributes include: account ID, account type (merchant / personal account), account information (name, phone number and other real-name information), etc. Directed edge attributes include: transaction amount, transaction time, transaction scenario, etc. A transaction is constructed as an edge in the knowledge graph, and multiple edges are allowed between two nodes (multiple transactions between users). All edges are directed edges, including information such as payer, payee, transaction information and transaction time. In this way, you can construct something like Figure 1 The knowledge graph involving capital flow is shown. Figure 1 edgeId represents the transaction ID, amt represents the amount, and time represents the transaction time. Figure 1 The knowledge graph shown includes the following transactions:

[0038] Transaction 1: a→b (starting point a, ending point b, transaction ID: 1001, time: 1, amount: 1,000,030 yuan);

[0039] Transaction 2: b→c (starting point b, ending point c, transaction ID: 1002, time: 2, amount: 20 yuan);

[0040] Transaction 3: b→d (starting point b, ending point d, transaction ID: 1003, time: 3, amount: 10 yuan);

[0041] Transaction 4: b→e (starting point b, ending point e, transaction ID: 1004, time: 4, amount: 1,000,000 yuan);

[0042] Transaction 5: c→f (starting point c, ending point f, transaction ID: 1005, time: 5, amount: 5 yuan);

[0043] Transaction 6: c→h (starting point c, ending point h, transaction ID: 1006, time: 6, amount: 15 yuan);

[0044] Transaction 7: e→m1 (starting point e, ending point m1, transaction ID: 1007, time: 7, amount: 1 yuan);

[0045] Transaction 8: e→m2 (starting point e, ending point m2, transaction ID: 1008, time: 8, amount: 1 yuan);

[0046] ...;

[0047] Transaction 1000036: e→m1000000 (starting point e, ending point m1000000, transaction ID: 1000036, time: 1000036, amount: 1 yuan);

[0048] Other transactions...

[0049] In getting Figure 1 After the knowledge graph shown, in a resource graph processing method of the related technology, the resource flow path is extracted through step-by-step message passing and accumulation. Figure 2 As shown, when calculating b→c, the message received from b contains (a→b), and the capital flow link (a→b→c) is obtained, and the message is continued to be sent to c. Similarly, when calculating c→f, the result a→b→c→f is obtained. If f has a downstream, it will be continuously transmitted downstream; if not, it will be temporarily saved locally. When calculating d, m1, m2...m1000000, the accumulated message paths from the upstream will also be received. After calculating the current edge, the calculation result will be output. As the resource graph scales and the flow paths deepen, this path-accumulation propagation method will cause a large amount of intermediate path information to be redundantly transmitted across the network. This will lead to a sharp increase in network IO pressure and a significant increase in communication costs between nodes, which will in turn cause computational bottlenecks and long-tail problems.

[0050] Based on this, see Figure 3 The embodiments of this specification provide a method for extracting resource flow paths. The method can be performed by an electronic device, including but not limited to a physical server, a virtual server, a smart phone / mobile phone, a tablet computer, a personal digital assistant (PDA), a laptop computer, a desktop computer, a wearable device, or any other type of device. The method includes:

[0051] In S301 , a resource graph is obtained. The resource graph includes nodes and directed edges. The nodes represent entities related to the resources, and the directed edges represent the flow direction of the resources.

[0052] For example, a resource map is a structured expression of the resource flow process, which is constructed based on resource change information (such as transaction records, transfer records, migration logs, etc.).

[0053] Nodes represent various entities in the resource flow process, such as users, devices, organizations, departments, system modules, and asset units. They can be configured based on specific application scenarios. Node attributes include, but are not limited to, entity type, entity ID, organization, resource holding period, geographic location, risk level, and status ID.

[0054] Directed edges represent the flow of resources between entities. Edge attributes include, but are not limited to, resource type, flow time, resource flow volume, flow method (such as transfer, migration, and aggregation), flow order number, trigger source, operator, and risk indicator. These attributes can be customized based on the specific application scenario.

[0055] For example, the resources mentioned in the embodiments of this specification include but are not limited to:

[0056] (1) Financial resources. Financial resources mainly involve the flow, allocation, and utilization of funds. For example, in a bank or financial institution, the flow path of funds ranges from deposits and borrowing to loans and repayments. By tracking these flow paths, we can analyze the flow direction of funds and optimize the allocation and risk management of funds.

[0057] (2) Goods. On e-commerce platforms, the flow path of goods from merchants to consumers can be tracked. Through the process of clicking, browsing, purchasing, and delivery of goods, the flow path of goods can be constructed to help merchants optimize the supply chain and improve inventory management efficiency.

[0058] (3) Supply chain resources. In the manufacturing and logistics industries, the flow paths of raw materials, parts, products, and other items are very important. By tracking the flow paths of each link, companies can improve production efficiency, reduce inventory costs, and optimize logistics.

[0059] (4) Computing resources. The flow path of computing resources involves the allocation and use of computing power, such as the allocation of resources from servers and computers to cloud computing platforms. The flow path of computing resources is often closely related to task scheduling and load balancing. By analyzing the flow path of computing resources, enterprises can improve the utilization efficiency of computing resources, optimize data center operations, reduce hardware expenses, and enhance overall computing power.

[0060] (5) Human Resources. The human resource flow path refers to the entire process of employee recruitment, training, work arrangement, performance appraisal, and resignation. It involves the acquisition, allocation, use, and management of human resources. Companies can improve employee work efficiency, improve employee training, optimize work arrangements, and reduce turnover by optimizing the human resource flow path.

[0061] (6) Energy. The energy flow path refers to the entire process of energy from production, transmission, storage to consumption. For example, the path of electricity from power plants to transmission grids and then to end consumers.

[0062] Each resource flow path has its specific links and key nodes. By extracting these resource flow paths and finely managing and analyzing them, it can help enterprises or organizations improve efficiency, reduce costs, and enhance decision-making capabilities.

[0063] In S302, the directed edges in the resource graph are traversed to obtain the path segments corresponding to the directed edges. The path segments include: the starting node and the ending node of the directed edge, the root path segment identifier indicating the starting point of the resource flow path, the parent path segment identifier indicating the upstream source of the path segment, and the current path segment identifier of the path segment itself.

[0064] In this step, every directed edge in the resource graph is traversed to form basic path segments. Each path segment represents an atomic resource transfer event. During the path segment acquisition process, only the key information of the current path segment and the root path segment identifier are transmitted, avoiding the repeated transmission of upstream path information and significantly reducing network I / O load.

[0065] Optionally, in addition to the above attributes, the path segment may also carry other attribute information, such as resource transfer time, resource quantity, statistical information of the transferred resources, and other metadata, which is not limited in this embodiment.

[0066] See for example Figure 4 The knowledge graph involving capital flow shown in the figure only needs to determine the path segments corresponding to the directed edges and their related attribute information. When passing messages downward, only the root path segment identifier is passed, and other accumulated path information is no longer passed downward. This can reduce the pressure of network IO and computing, improve computing performance, and basically eliminate the transmission of duplicate content messages. Figure 4 The path segments corresponding to directed edges obtained in include:

[0067] Segment a→b: start node a, end node b, rootId: 2001, trace_amt: 1000030, uuid: 2001, parent_id: -1;

[0068] b→c segment: starting node b, ending node c, rootId: 2001, trace_amt: 20, uuid: 2002, parent_id: 2001;

[0069] c→f segment: start node c, end node f, rootId: 2001, trace_amt: 5, uuid: 2003, parent_id: 2002;

[0070] c→h segment: start node c, end node h, rootId: 2001, trace_amt: 15, uuid: 2004, parent_id: 2002;

[0071] b→d segment: start node b, end node d, rootId: 2001, trace_amt: 10, uuid: 2002, parent_id: 2005;

[0072] b→e segment: start node b, end node e, rootId: 2001, trace_amt: 1000000, uuid: 2006, parent_id: 2001;

[0073] e→m1 segment: starting node e, ending node m1, rootId: 2001, trace_amt: 1, uuid: 2000007, parent_id: 2006;

[0074] e→m2 segment: start node e, end node m2, rootId: 2001, trace_amt: 1, uuid: 2000008, parent_id: 2006;

[0075] e→m3 segment: start node e, end node m3, rootId: 2001, trace_amt: 1, uuid: 2000009, parent_id: 2006;

[0076] ...;

[0077] e→m1000000: start node e, end node m1000000, rootId: 2001, trace_amt: 1, uuid: 3000006, parent_id: 2006.

[0078] Among them, rootId represents the root path segment identifier, uuid represents the current path segment identifier, parent_id represents the parent path segment identifier (-1 represents no parent path segment), and trace_amt represents the flow resource statistics (such as the flow amount). RootId and uuid are both globally unique identifiers that can uniquely identify a path or a path segment.

[0079] In S303 , the extracted path segments are grouped according to the root path segment identifiers, so that the path segments with the same root path segment identifier are grouped into the same group.

[0080] In this step, see Figure 5 Based on the root path segment identifier (rootId), all path segments are divided into several groups, representing multiple independent resource flow links. Each group represents a collection of all resource flow path segments starting from the same starting point. By clarifying the starting point of the resource flow path, irrelevant paths are isolated and cross-interference is avoided.

[0081] In S304, a resource flow path extraction operation is performed on at least one group of path segments. The extraction operation includes: determining the node connection order in the resource flow path based on the correspondence between the parent path segment identifier and the current path segment identifier of the path segments in the group, and obtaining the resource flow path.

[0082] Within each group of path segments, starting from the root path segment, the node connection order is constructed based on the relationship of "parent path segment identifier → current path segment identifier" to accurately restore the resource flow path.

[0083] Exemplarily, when resource transfer path extraction is performed on at least two groups of path segments, the electronic device may perform resource transfer path extraction operations on the at least two groups of path segments in parallel, thereby improving processing throughput and resource utilization.

[0084] The resource flow path extraction method provided in this embodiment only obtains key information about the path segments corresponding to the directed edges during the path segment acquisition process, avoiding repeated transmission of upstream path information and significantly reducing network I / O load. By grouping path segments according to their root path identifiers, the resource flow paths of each group are restored, isolating unrelated paths and avoiding cross-interference. During the path restoration process, the correspondence between the parent path segment identifier and the path segment identifier of the referenced path segment is referenced, making the path construction logic clear and controllable. This method has excellent scalability and computing performance, and can adapt to scenarios with massive data and complex flow structures, thereby improving the accuracy and processing efficiency of resource flow tracking and providing reliable data support for applications such as risk control analysis, anomaly detection, and audit tracing.

[0085] In some embodiments, see Figure 6 , when performing the resource flow path extraction operation on each group of path segments, the electronic device can reorganize the group of path segments based on the corresponding relationship between the root path segment identifier, the parent path segment identifier and the current path segment identifier of the group of path segments, and construct a resource flow tree with the root path segment as the starting point and clear parent-child connection relationships between nodes; the resource flow tree can restore the structured link relationship of layer-by-layer flow in the resource graph; then perform a depth-first traversal operation on the resource flow tree, starting from the root node, and searching downward for each complete flow path in turn until reaching the leaf node. Through this traversal operation, all resource flow paths from the starting point to the end point in the resource flow tree can be extracted. Figure 7 As shown, the following resource flow paths can be finally obtained: [Path 1] a→b→c→f; [Path 2] a→b→c→h; [Path 3] a→b→d; [Path 4] a→b→e→m1; [Path 5] a→b→e→m2; [Path 6] a→b→e→m3; ...; [Path 1000036] a→b→e→m1000000.

[0086] This embodiment uses tree reorganization followed by depth-first traversal to organize the originally flat path segment relationships into a clearly hierarchical tree structure, facilitating efficient path extraction operations. This approach also supports concurrent processing of multiple groups, offering excellent parallel scalability and processing performance. Furthermore, compared to performing recursive searches directly on the original graph, this structured reorganization + traversal approach significantly reduces repetitive computations and memory overhead, thereby improving accuracy and system efficiency in complex resource flow scenarios.

[0087] It is understandable that other traversal methods may be used for the resource flow tree, such as breadth-first traversal or hierarchical traversal, etc. This embodiment does not impose any restrictions on this, and specific settings may be made according to actual application scenarios.

[0088] Exemplarily, the directed edges in the resource graph and the path segments corresponding to the directed edges all carry resource flow times. During the tree reorganization process, the electronic device can perform tree reorganization based on the correspondence between the root path segment identifier, the parent path segment identifier, and the current path segment identifier of the group of path segments, and in the order of the resource flow times carried by each path segment, so that path segments with earlier resource flow times are preferentially included in the tree reorganization process. In this embodiment, by gradually reorganizing the path segments into a tree in chronological order, it is possible to ensure that the generated resource flow path conforms to the actual resource flow timeline, thereby improving the accuracy and reliability of the path analysis.

[0089] Exemplarily, directed edges and path segments corresponding to directed edges carry statistical information of circulating resources. The essence of statistical information of circulating resources is a quantitative description of the quantity, value, frequency or security of "circulated resources". In different resource scenarios, "circulation resource statistical information" can be customized according to different resource types, and this embodiment does not impose any restrictions on this. For example, in financial scenarios, statistical information of circulating resources includes but is not limited to the amount of circulating funds (such as the amount of a single transfer, the total transaction amount), transaction fees, etc.; in logistics supply chain scenarios, statistical information of circulating resources includes but is not limited to the number of goods (number of pieces, tonnage, etc.), value of goods, inventory occupancy, transportation costs between logistics nodes, etc.; in data asset circulation scenarios, statistical information of circulating resources includes but is not limited to the number of data entries, data file size, data access frequency, data value score, etc.

[0090] Exemplarily, after obtaining the resource transfer path, the electronic device may update the flow resource statistics of the other path segments except the last path segment in the resource transfer path to the flow resource statistics of the last path segment in the resource transfer path, such as Figure 7As shown, the trace_amt in each resource flow path is the same and is the trace_amt of the last path segment. In this embodiment, considering that resources may have different distributions or losses in each segment of the path during the flow process, the final path segment (i.e., leaf node) usually represents the final ownership or flow result of the resource. The statistical information it carries reflects the "final state" or "aggregated amount" of resource flow on the entire path. By backfilling this final state to each segment of the entire path, each path segment has "representative statistics" in the overall sense, which is convenient for reading and understanding.

[0091] In some embodiments, considering that some nodes are hot nodes, for example, node e in any of the above examples has 1,000,000 downstream outgoing edges, the entire tree becomes very large during tree reorganization. To further improve computational efficiency, the tree with hot nodes can be split.

[0092] In one possible implementation, see Figure 8 When extracting resource flow paths from each group of path segments, the electronic device can reorganize the group of path segments based on the corresponding relationship between the root path segment identifier, the parent path segment identifier, and the current path segment identifier to obtain a resource flow tree corresponding to the group of path segments. After the resource flow tree is reorganized, the electronic device can detect whether the size of the resource flow tree exceeds a preset size threshold. This avoids memory overflow or inefficient traversal caused by an excessive number of nodes or excessive depth, laying the foundation for subsequent tree segmentation and parallel computing.

[0093] Exemplarily, the scale of a resource flow tree exceeding a preset scale threshold includes: the number of nodes in the resource flow tree exceeding a preset threshold; wherein the number of nodes in the resource flow tree is the product of the depth of the resource flow tree plus one and the number of leaf nodes in the resource flow tree. This definition multiplies the "depth + 1" of the resource flow tree by the "number of leaf nodes" to define the tree's node scale, taking into account both the length (depth) and width (number of branches) of the resource flow chain. This allows for a more accurate assessment of the computational and storage costs of a resource flow tree, providing a basis for reasonable segmentation.

[0094] When the scale of the resource flow tree exceeds the preset scale threshold, the resource flow subtree obtained by segmentation is split into at least two resource flow subtrees, such as Figure 8 As shown, at least two resource flow subtrees both use the root node of the resource flow tree as the starting node, such as Figure 8As shown, the multiple resource flow subtrees that have been split all have node a as their root node. The electronic device then extracts the resource flow paths from the resource flow subtree. This splitting method ensures that each resource flow path extracted from the resource flow subtree is a complete path. This embodiment decomposes a complex resource flow structure into multiple independent resource flow subtrees, allowing each resource flow subtree to be processed within a controllable scale. This reduces peak resource consumption during the overall computing process and improves system stability.

[0095] Exemplarily, the electronic device may extract resource flow paths from at least two resource flow subtrees in parallel to achieve efficient batch path extraction, thereby improving computing efficiency.

[0096] Exemplarily, the electronic device performs a depth-first traversal operation on the resource flow subtree, starting from the root node and searching downward for each complete flow path in turn until reaching a leaf node, thereby extracting all resource flow paths corresponding to the resource flow subtree.

[0097] The above implementation method ensures the integrity and accuracy of resource flow path extraction by constructing a resource flow tree, detecting the tree scale, timely splitting and parallel processing of subtree paths, and improves processing efficiency and system stability in large-scale data environments. It is suitable for efficient graph computing and path analysis tasks in complex resource flow scenarios.

[0098] In another possible implementation, when extracting resource transfer paths for each group of path segments, the electronic device reorganizes the group of path segments into a tree based on the corresponding relationship between the root path segment identifier of the group, the parent path segment identifier of each path segment, and the path segment identifier. During the tree reorganization process, the electronic device detects in real time whether the scale of the resource transfer tree being reorganized exceeds a preset scale threshold. Real-time monitoring of the scale of the resource transfer tree during the tree reorganization process effectively prevents excessive computing resource usage and performance degradation caused by excessive nodes, deep structures, or complex branches, thereby improving system robustness and controllability.

[0099] Exemplarily, the scale of a resource flow tree exceeding a preset scale threshold includes: the number of nodes in the resource flow tree exceeding a preset threshold; wherein the number of nodes in the resource flow tree is the product of the depth of the resource flow tree plus one and the number of leaf nodes in the resource flow tree. This definition multiplies the "depth + 1" of the resource flow tree by the "number of leaf nodes" to define the tree's node scale, taking into account both the length (depth) and width (number of branches) of the resource flow chain. This allows for a more accurate assessment of the computational and storage costs of a resource flow tree, providing a basis for reasonable segmentation.

[0100] If the scale of the resource flow tree in the reorganization exceeds the preset scale threshold, the electronic device will retain the resource flow tree in the reorganization as a resource flow sub-tree, and delete the specified path segment related to the resource flow sub-tree. Exemplarily, the electronic device can delete the path segment corresponding to the leaf node of the resource flow sub-tree; then determine whether the path segment corresponding to the parent node of the leaf node has an undeleted downstream path segment, and the parent path segment identifier of the downstream path segment is the current path segment identifier of the path segment corresponding to the parent node; if not, it indicates that the parent node of the leaf node is an isolated node in the subsequent tree reorganization process. In order to avoid misjudging the isolated parent node as a leaf node of a new round of tree reorganization, the path segment corresponding to the parent node is deleted to avoid forming a "false leaf" in the subsequent tree reorganization process, and continue to perform judgment operations on the upstream node of the parent node until there is a downstream path segment corresponding to the upstream node that still has an undeleted downstream path segment. When this embodiment detects excessive size, it immediately saves the currently constructed resource flow tree as an independent subtree and deletes leaf nodes and their unbranched upstream path segments within the subtree. This effectively ensures the subtree's structural integrity and stability, preventing duplication in subsequent reorganizations and thus avoiding redundant computations. For upstream path segments that no longer connect to any unprocessed downstream paths, the system recursively purges them upwards, eliminating "isolated nodes" that can no longer connect to remaining path segments, further reducing memory usage and improving the efficiency of subsequent tree reorganizations.

[0101] In this example, assume the following path segments: A→B, B→C, B→D, and D→E. During a tree reorganization, due to scale limitations, the resource flow subtree constructed is A→B→C. The path segment of leaf node C is then deleted. This is the leaf node of the currently retained subtree, and the corresponding path segment B→C is deleted. Determine whether the path segment of parent node B has any downstream path segments: B also has a downstream path segment B→D (which has not yet been constructed into the current subtree and has not yet been deleted), so the path segment corresponding to B cannot be deleted. Therefore, B is not a "false leaf" and will continue to participate in the construction as a non-leaf node in subsequent tree reorganizations and should not be deleted.

[0102] In another example, suppose there are the following path segments A→B and B→C. During a tree reorganization, due to scale limitations, the constructed resource flow subtree is A→B→C, and the path segment corresponding to C is deleted. Since B has no other downstream path segments, B also needs to be deleted. Then, it is determined whether A has any downstream path segments. Since A has no other downstream path segments, A also needs to be deleted. Finally, the path segment set is cleared.

[0103] The electronic device then re-performs tree reorganization and scale detection based on the remaining path fragments. If the size of the resource flow tree in the reorganization exceeds a preset size threshold, it can be processed in the same manner as described above until all path fragments in the group are processed. Through gradual reorganization, segmentation, and path fragment removal, a very large set of path fragments can be disassembled into multiple well-structured and scalable resource flow subtrees, which facilitates efficient processing in distributed or parallel environments and supports larger-scale graph analysis tasks.

[0104] Finally, the electronic device can extract resource flow paths from each resource flow subtree. Exemplarily, when the number of resource flow subtrees is greater than one, the electronic device can extract resource flow paths from at least two resource flow subtrees in parallel, achieving efficient batch path extraction to improve computing efficiency. Exemplarily, the electronic device performs a depth-first traversal operation on the resource flow subtree, starting from the root node and sequentially searching downward for each complete flow path until reaching a leaf node, thereby extracting all resource flow paths corresponding to the resource flow subtree.

[0105] The above implementation method realizes efficient, controllable and complete path extraction of complex resource flow graphs through the processing flow of "tree reorganization + real-time detection + dynamic segmentation + local cleaning + path extraction". It is suitable for scenarios with large resource path data scale, complex structure and high analysis efficiency requirements.

[0106] Optionally, each node and edge in the resource flow path can inherit and carry the original attribute information of the corresponding node and edge in the resource graph.

[0107] The various technical features in the above embodiments can be combined arbitrarily as long as there is no conflict or contradiction between the combinations of features. However, due to space limitations, they are not described one by one. Therefore, the arbitrary combination of the various technical features in the above embodiments also falls within the scope of disclosure of this specification.

[0108] In some embodiments, an embodiment of this specification further provides an electronic device, comprising: a processor; a memory for storing processor-executable instructions; wherein the processor implements any of the above methods by running the executable instructions.

[0109] Figure 9 This is a schematic structural diagram of a device provided by an exemplary embodiment. Figure 9At the hardware level, the device includes a processor 902, an internal bus 904, a network interface 906, a memory 908, and a non-volatile memory 910. Of course, it may also include hardware required for other functions. One or more embodiments of this specification can be implemented based on software, such as the processor 902 reading the corresponding computer program from the non-volatile memory 910 into the memory 908 and then running it. Of course, in addition to software implementation, one or more embodiments of this specification do not exclude other implementation methods, such as logic devices or a combination of software and hardware, etc., that is, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.

[0110] In some embodiments, the resource transfer path extraction device can be applied to Figure 9 The device shown in the figure is used to implement the technical solution of this specification. The resource flow path extraction device may include:

[0111] The acquisition module is used to obtain a resource map, where the resource map includes nodes and directed edges. The nodes represent entities related to the resources, and the directed edges represent the flow direction of the resources.

[0112] A traversal module is used to traverse the directed edges in the resource graph and obtain the path segments corresponding to the directed edges. The path segments include: the starting node and ending node of the directed edge, the root path segment identifier indicating the starting point of the resource flow path, the parent path segment identifier indicating the upstream source of the path segment, and the current path segment identifier of the path segment itself.

[0113] The grouping module is configured to group the extracted path segments according to the root path segment identifiers so that the path segments with the same root path segment identifier are grouped into the same group.

[0114] The resource flow path extraction module is used to perform a resource flow path extraction operation on at least one group of path segments. The extraction operation includes: based on the correspondence between the parent path segment identifier of the path segment in the group and the current path segment identifier, determining the node connection order in the resource flow path to obtain the resource flow path.

[0115] In one implementation, the resource flow path extraction module is specifically configured to perform resource flow path extraction operations on at least two groups of path segments in parallel.

[0116] In one implementation, the resource flow path extraction module is specifically used to perform a tree reorganization on the group of path segments based on the correspondence between the root path segment identifier, the parent path segment identifier and the current path segment identifier of the group of path segments to obtain a resource flow tree corresponding to the group of path segments; and perform a depth-first traversal operation on the resource flow tree to obtain a resource flow path corresponding to the group of path segments.

[0117] In one implementation, the resource flow path extraction module is specifically used to perform tree reorganization on the group of path segments based on the correspondence between the root path segment identifier, the parent path segment identifier and the current path segment identifier of the group of path segments to obtain the resource flow tree corresponding to the group of path segments; after the resource flow tree reorganization is completed, detect whether the scale of the resource flow tree exceeds the preset scale threshold; if the scale of the resource flow tree exceeds the preset scale threshold, with the goal of ensuring that the resource flow subtree obtained by splitting meets the preset scale threshold, split the resource flow tree into at least two resource flow subtrees, and the at least two resource flow subtrees both use the root node of the resource flow tree as the starting node; and extract the resource flow path from the resource flow subtree.

[0118] In one implementation, the resource flow path extraction module is specifically used to perform tree reorganization on the group of path segments based on the correspondence between the root path segment identifier of the group of path segments, the parent path segment identifier of each path segment and the path segment identifier, and during the tree reorganization process, detect in real time whether the scale of the resource flow tree in the reorganization exceeds a preset scale threshold; if the scale of the resource flow tree in the reorganization exceeds the preset scale threshold, retain the resource flow tree in the reorganization as a resource flow sub-tree, delete the specified path segment related to the resource flow sub-tree, and re-execute the tree reorganization and scale detection based on the remaining path segments until all path segments in the group are processed; and extract the resource flow path from the resource flow sub-tree.

[0119] In one implementation, the resource flow path extraction module is specifically used to delete the path segment corresponding to the leaf node of the resource flow subtree; determine whether there is an undeleted downstream path segment in the path segment corresponding to the parent node of the leaf node, and the parent path segment identifier of the downstream path segment is the current path segment identifier of the path segment corresponding to the parent node; if not, delete the path segment corresponding to the parent node, and continue to perform judgment operations on the upstream node of the parent node until there is an undeleted downstream path segment in the path segment corresponding to the upstream node.

[0120] In one implementation, the scale of the resource flow tree exceeds a preset scale threshold, including: the number of nodes of the resource flow tree exceeds a preset number threshold; wherein, the number of nodes of the resource flow tree is: the product of the depth of the resource flow tree plus one and the number of leaf nodes of the resource flow tree.

[0121] In one implementation, the resource flow path extraction module is specifically configured to extract resource flow paths from at least two resource flow subtrees in parallel when the number of the resource flow subtrees is greater than one.

[0122] In one implementation, the resource flow path extraction module is specifically configured to perform a depth-first traversal operation on the resource flow subtree to extract the resource flow path corresponding to the resource flow subtree.

[0123] In one implementation, the directed edges and the path segments corresponding to the directed edges both carry resource transfer times. The resource transfer path extraction module is specifically configured to perform tree reorganization based on the correspondence between the root path segment identifier, the parent path segment identifier, and the current path segment identifier of the group of path segments, and in the order of the resource transfer times carried by each path segment, so that path segments with earlier resource transfer times are preferentially included in the tree reorganization process.

[0124] In one implementation, the directed edge and the path segment corresponding to the directed edge both carry flow resource statistics information. The resource flow path extraction module is specifically configured to, after obtaining the resource flow path, update the flow resource statistics of path segments other than the last path segment in the resource flow path with the flow resource statistics of the last path segment in the resource flow path.

[0125] The implementation process of the functions and effects of each module in the above-mentioned device is specifically described in the implementation process of the corresponding steps in the above-mentioned method, and will not be repeated here.

[0126] Based on the same concept as the above method, this specification also provides a computer-readable storage medium on which computer instructions are stored. When the instructions are executed by a processor, the steps of the method described in any of the above embodiments are implemented.

[0127] Computer-readable media include permanent and non-permanent, removable and non-removable media that can be used to store information using any method or technology. Information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, disk storage, quantum memory, graphene-based storage media or other magnetic storage devices, or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include transitory media such as modulated data signals and carrier waves.

[0128] Based on the same concept as the above method, this specification also provides a computer program product, including a computer program / instruction, which implements the steps of the method described in any of the above embodiments when executed by a processor.

[0129] The above description is merely a preferred embodiment of one or more embodiments of this specification and is not intended to limit one or more embodiments of this specification. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of one or more embodiments of this specification shall be included in the scope of protection of one or more embodiments of this specification.

Claims

1. A method for extracting a resource flow path, comprising: Obtain a resource graph, wherein the resource graph includes nodes and directed edges, wherein the nodes represent entities related to the resources, and the directed edges represent the flow direction of the resources; Traversing the directed edges in the resource graph to obtain path segments corresponding to the directed edges, the path segments including: the starting node and ending node of the directed edge, a root path segment identifier indicating the starting point of the resource flow path, a parent path segment identifier indicating the upstream source of the path segment, and a current path segment identifier of the path segment itself; Grouping the extracted path segments according to the root path segment identifiers so that the path segments with the same root path segment identifier are grouped into the same group; A resource flow path extraction operation is performed on at least one group of path segments, the extraction operation including: determining a node connection order in the resource flow path based on a correspondence between a parent path segment identifier and a current path segment identifier of the path segments in the group, and obtaining the resource flow path.

2. The method according to claim 1, wherein extracting the resource transfer path from at least one group of path segments comprises: The resource transfer path extraction operation is performed on at least two groups of path segments in parallel.

3. The method according to claim 1, wherein determining the node connection order in the resource transfer path based on the correspondence between the parent path segment identifier and the current path segment identifier of the path segment in the group to obtain the resource transfer path comprises: Based on the correspondence between the root path segment identifier, the parent path segment identifier, and the current path segment identifier of the group of path segments, the group of path segments is tree reorganized to obtain a resource flow tree corresponding to the group of path segments; A depth-first traversal operation is performed on the resource flow tree to obtain the resource flow paths corresponding to the group of path segments.

4. The method according to claim 1, wherein determining the node connection order in the resource transfer path based on the correspondence between the parent path segment identifier and the current path segment identifier of the path segment in the group to obtain the resource transfer path comprises: Based on the correspondence between the root path segment identifier, the parent path segment identifier, and the current path segment identifier of the group of path segments, the group of path segments is tree reorganized to obtain a resource flow tree corresponding to the group of path segments; After the resource transfer tree is reorganized, detecting whether the scale of the resource transfer tree exceeds a preset scale threshold; When the scale of the resource flow tree exceeds a preset scale threshold, the resource flow tree is split into at least two resource flow subtrees with the goal of ensuring that the resource flow subtree obtained by splitting meets the preset scale threshold, and each of the at least two resource flow subtrees uses the root node of the resource flow tree as a starting node; A resource flow path is extracted from the resource flow subtree.

5. The method according to claim 1, wherein determining the node connection order in the resource transfer path based on the correspondence between the parent path segment identifier of the path segment in the group and the current path segment identifier to obtain the resource transfer path comprises: Based on the correspondence between the root path segment identifier of the group of path segments, the parent path segment identifier of each path segment, and the path segment identifier, the group of path segments is reorganized into a tree, and during the tree reorganization process, whether the scale of the resource flow tree being reorganized exceeds a preset scale threshold is detected in real time; If the size of the resource flow tree in the reorganization exceeds a preset size threshold, retain the resource flow tree in the reorganization as a resource flow subtree, delete the specified path segments associated with the resource flow subtree, and re-execute tree reorganization and size detection based on the remaining path segments until all path segments in the group are processed; A resource flow path is extracted from the resource flow subtree.

6. The method according to claim 5, wherein deleting the specified path segment related to the resource flow subtree comprises: Delete the path segment corresponding to the leaf node of the resource flow subtree; Determine whether the path segment corresponding to the parent node of the leaf node has any undeleted downstream path segment, where the parent path segment identifier of the downstream path segment is the current path segment identifier of the path segment corresponding to the parent node; If not, the path segment corresponding to the parent node is deleted, and the judgment operation is continued on the upstream node of the parent node until there is a downstream path segment corresponding to the upstream node and it has not been deleted.

7. The method according to claim 4 or 5, wherein the scale of the resource transfer tree exceeds a preset scale threshold, comprising: The number of nodes in the resource transfer tree exceeds a preset threshold; The number of nodes in the resource flow tree is: the product of the depth of the resource flow tree plus one and the number of leaf nodes in the resource flow tree.

8. The method according to claim 4 or 5, wherein extracting the resource flow path from the resource flow subtree comprises: When the number of the resource flow subtrees is greater than 1, resource flow paths are extracted from at least two resource flow subtrees in parallel.

9. The method according to claim 4 or 5, wherein extracting the resource flow path from the resource flow subtree comprises: A depth-first traversal operation is performed on the resource flow subtree to extract a resource flow path corresponding to the resource flow subtree.

10. The method according to any one of claims 2 to 5, wherein the directed edge and the path segment corresponding to the directed edge both carry resource flow time; The step of performing tree reorganization on the group of path segments based on the correspondence between the root path segment identifier, the parent path segment identifier, and the current path segment identifier of the group of path segments to obtain a resource transfer tree corresponding to the group of path segments includes: Based on the correspondence between the root path segment identifier, parent path segment identifier and current path segment identifier of the group of path segments, and in the order of resource flow time carried by each path segment, the tree reorganization is performed so that the path segments with earlier resource flow time are preferentially included in the tree reorganization process.

11. The method according to any one of claims 2 to 5, wherein the directed edge and the path segment corresponding to the directed edge both carry flow resource statistics information; The method further comprises: After the resource flow path is obtained, the flow resource statistics information of the path segments other than the last path segment in the resource flow path is updated to the flow resource statistics information of the last path segment in the resource flow path.

12. An electronic device comprising: processor; A memory for storing processor-executable instructions; wherein the processor implements the steps of the method according to any one of claims 1 to 11 by running the executable instructions.

13. A computer-readable storage medium having computer instructions stored thereon, wherein when the instructions are executed by a processor, the steps of the method according to any one of claims 1 to 11 are implemented.

14. A computer program product comprising a computer program / instruction, which, when executed by a processor, implements the steps of the method according to any one of claims 1 to 11.