WO2022111380A1 - 信息处理方法、装置和存储介质 - Google Patents
信息处理方法、装置和存储介质 Download PDFInfo
- Publication number
- WO2022111380A1 WO2022111380A1 PCT/CN2021/131618 CN2021131618W WO2022111380A1 WO 2022111380 A1 WO2022111380 A1 WO 2022111380A1 CN 2021131618 W CN2021131618 W CN 2021131618W WO 2022111380 A1 WO2022111380 A1 WO 2022111380A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- node
- degree
- array
- information
- processed
- Prior art date
Links
- 230000010365 information processing Effects 0.000 title claims abstract description 54
- 238000003672 processing method Methods 0.000 title claims abstract description 29
- 238000012545 processing Methods 0.000 claims description 73
- 238000000034 method Methods 0.000 claims description 40
- 230000008569 process Effects 0.000 claims description 17
- 238000012217 deletion Methods 0.000 claims description 14
- 230000037430 deletion Effects 0.000 claims description 14
- 238000004590 computer program Methods 0.000 claims description 13
- 238000010586 diagram Methods 0.000 description 27
- 238000007726 management method Methods 0.000 description 14
- 101150110971 CIN7 gene Proteins 0.000 description 9
- 101150110298 INV1 gene Proteins 0.000 description 9
- 101100397044 Xenopus laevis invs-a gene Proteins 0.000 description 9
- 101100286980 Daucus carota INV2 gene Proteins 0.000 description 8
- 101100508840 Daucus carota INV3 gene Proteins 0.000 description 8
- 101100397045 Xenopus laevis invs-b gene Proteins 0.000 description 8
- 238000003491 array Methods 0.000 description 7
- 230000009286 beneficial effect Effects 0.000 description 6
- 238000005516 engineering process Methods 0.000 description 6
- 101150070189 CIN3 gene Proteins 0.000 description 5
- 230000008878 coupling Effects 0.000 description 4
- 238000010168 coupling process Methods 0.000 description 4
- 238000005859 coupling reaction Methods 0.000 description 4
- 230000001105 regulatory effect Effects 0.000 description 4
- 238000004891 communication Methods 0.000 description 3
- 238000011010 flushing procedure Methods 0.000 description 3
- 230000008859 change Effects 0.000 description 2
- 230000006870 function Effects 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 238000013473 artificial intelligence Methods 0.000 description 1
- 230000010267 cellular communication Effects 0.000 description 1
- 230000001413 cellular effect Effects 0.000 description 1
- 238000010276 construction Methods 0.000 description 1
- 238000013500 data storage Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 238000003780 insertion Methods 0.000 description 1
- 230000037431 insertion Effects 0.000 description 1
- 239000011159 matrix material Substances 0.000 description 1
- 230000006855 networking Effects 0.000 description 1
- 230000002093 peripheral effect Effects 0.000 description 1
- 230000002085 persistent effect Effects 0.000 description 1
- 238000000638 solvent extraction Methods 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
- 230000001131 transforming effect Effects 0.000 description 1
- 239000002699 waste material Substances 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/90—Details of database functions independent of the retrieved data types
- G06F16/901—Indexing; Data structures therefor; Storage structures
- G06F16/9024—Graphs; Linked lists
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/24—Querying
- G06F16/245—Query processing
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q30/00—Commerce
- G06Q30/04—Billing or invoicing
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q40/00—Finance; Insurance; Tax strategies; Processing of corporate or income taxes
- G06Q40/04—Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Definitions
- the present application relates to data processing technology, and in particular, to an information processing method, device and storage medium.
- the tax bureau in order to prevent false invoicing, the tax bureau requires that the issuance of VAT invoices must provide real transaction flow.
- the transaction flow and the invoice are not a simple one-to-one relationship, but are determined by the actual business scenario.
- a customer may need to split multiple invoices for a transaction flow;
- the amount of transaction flow may correspond to multiple categories and need to be invoiced by classification; or, multiple transactions of the same customer may need to be invoiced together.
- the splitting or merging of the transaction flow only involves the change of the amount, the transaction flow itself also needs to be changed such as reversal and reconciliation, and the invoices also have status changes such as red flushing and invalidation.
- the structure of a graph object can be used to describe the relationship between the transaction flow and the invoice.
- the root node in the graph object is used to represent the transaction serial number
- the leaf node is used to represent the invoice.
- the structure information will be stored in the linked list, so that the whole process of invoice management can be realized by using the linked list.
- the embodiments of the present application provide an information processing method, device, and storage medium, which improve information processing efficiency.
- an embodiment of the present application provides an information processing method, and the information processing method may include:
- An operation instruction sent by the terminal device is received, where the operation instruction includes the node identifier of the node to be processed.
- the node to be processed is determined from the pre-built graph information; wherein, the graph information includes multiple nodes and multiple edges, the identification information of the multiple nodes and all The attribute information of the multiple edges is stored in an array; in the graph information, all out-degree nodes corresponding to the same in-degree node are stored in the same array; or, all in-degree nodes corresponding to the same out-degree node are stored in the same array; Degree nodes are stored in the same array.
- Processing the nodes to be processed wherein, the processing includes query processing, merge processing, or deletion processing.
- the operation instruction is a query instruction
- the processing of the node to be processed includes:
- the target node related to the node to be processed is queried from the pre-built graph information.
- the attribute information includes the node type of the in-degree node of the edge, the out-degree node and in-degree node corresponding to the edge, and the weight of the edge; wherein , the node type is stored in the type array, the out-degree node is stored in the out-degree array, the in-degree node is stored in the in-degree array, and the weight of the edge is stored in the weight array.
- the querying the target node related to the node to be processed from the pre-built graph information includes:
- the out-degree node and/or the in-degree node of the node to be processed is searched from the out-degree array and/or the in-degree array.
- the target node is determined from the out-degree nodes and/or the in-degree nodes according to the weight value.
- the method before querying the target node related to the node to be processed from the pre-built graph information, the method further includes:
- a first message sent by the terminal device is received, where the first message includes identification information and attribute values of at least one original node.
- the identification information and type information of at least one first child node corresponding to the original node are determined according to the attribute value of the original node.
- the identification information of the at least one first child node is stored in the identification array, and the type information is stored in the type array.
- Second child nodes corresponding to each of the at least one first child node are generated, and identification information and type information of the second child node are determined.
- the identification information of the second child node is stored in the identification array, and the type information of the second child node is stored in the type array.
- the weight value of the directed edge between the two nodes in the graph information to be constructed is determined, and the graph information is constructed.
- the weight values are stored in the weights array.
- determining the identification information and type information of at least one first child node corresponding to the original node according to the attribute value of the original node includes:
- At least two first child nodes corresponding to the original node are determined according to the preset value, wherein the attribute value of each first child node is less than the preset value.
- the operation instruction is a merge instruction
- the number of the nodes to be processed is at least two
- the processing of the nodes to be processed includes:
- a merge node is determined.
- the identification information of the merged node is added to the identification array.
- the operation instruction is a deletion instruction
- the processing of the node to be processed includes:
- Both the node to be processed and the out-degree node of the node to be processed are determined as invalid nodes.
- an embodiment of the present application further provides an information processing apparatus, and the information processing apparatus may include:
- the receiving unit is configured to receive an operation instruction sent by the terminal device, where the operation instruction includes the node identifier of the node to be processed.
- a processing unit configured to determine the to-be-processed node from pre-built graph information according to the node identifier of the to-be-processed node; wherein the graph information includes multiple nodes and multiple edges, and the multiple nodes
- the identification information and the attribute information of the multiple edges are stored in an array; in the graph information, all out-degree nodes corresponding to the same in-degree node are stored in the same array; or, the same out-degree node is stored in the same array; All in-degree nodes corresponding to a node are stored in the same array.
- the processing unit is further configured to process the nodes to be processed; wherein, the processing includes query processing, merge processing, or deletion processing.
- the operation instruction is a query instruction
- the processing unit is specifically configured to query a target node related to the node to be processed from pre-built graph information.
- the attribute information includes the node type of the in-degree node of the edge, the out-degree node and in-degree node corresponding to the edge, and the weight of the edge; wherein , the node type is stored in the type array, the out-degree node is stored in the out-degree array, the in-degree node is stored in the in-degree array, and the weight of the edge is stored in the weight array.
- the processing unit is specifically configured to find the node type of the node to be processed from the type array; according to the node type, from the out-degree array and/or the in-degree array, find the out-degree array and/or the in-degree array. processing the out-degree node and/or in-degree node of the node; searching for the weight value of the edge corresponding to the out-degree node and/or the in-degree node from the weight array; The target node is determined from an out-degree node and/or the in-degree node.
- the receiving unit is further configured to receive a first message sent by the terminal device, where the first message includes identification information and an attribute value of at least one original node.
- the processing unit is further configured to, for each original node, determine the identification information and type information of at least one first child node corresponding to the original node according to the attribute value of the original node;
- the identification information of the first child node is stored in the identification array, and the type information is stored in the type array;
- the second child node corresponding to each of the at least one first child node is generated, and the second child node is determined
- the identification information and type information of the second child node; the identification information of the second child node is stored in the identification array, and the type information of the second child node is stored in the type array; according to the original node,
- the first child node and the second child node determine the weight value of the directed edge between the two nodes in the graph information to be constructed, and construct the graph information, and the weight value of the edge is stored in the weight array. middle.
- the processing unit is specifically configured to, if the attribute value of the original node is greater than a preset value, determine at least two first corresponding to the original node according to the preset value child nodes, wherein the attribute value of each first child node is smaller than the preset value.
- the operation instruction is a merge instruction
- the number of the nodes to be processed is at least two
- the processing unit is specifically configured to determine the merge node according to the at least two nodes to be processed
- the identification information of the merged node is added to the identification array; the weight value of the directed edge between the node to be processed and the merged node is determined, and the weight value is added to the weight array.
- the operation instruction is a deletion instruction
- the processing unit is specifically configured to determine both the node to be processed and the out-degree node of the node to be processed as invalid nodes.
- an embodiment of the present application further provides a server, where the server may include a memory and a processor; wherein,
- the memory is used to store computer programs.
- the processor is configured to read the computer program stored in the memory, and execute the information processing method described in any possible implementation manner of the first aspect according to the computer program in the memory.
- an embodiment of the present application further provides a computer-readable storage medium, where the computer-readable storage medium stores a computer program, and the computer program enables the server to execute any of the possible implementations of the first aspect above.
- the described information processing method is not limited to:
- the node identifier of the node to be processed is determined from the pre-built graph information.
- the graph information includes the identification information of multiple nodes and the attribute information of multiple edges are stored in an array mode, so that the nodes to be processed can be directly determined from the array, and there is no need to, as in the prior art, because the graph
- the structure information of the object is stored in the linked list, so that it is necessary to traverse each node in the linked list in order to determine the node to be processed, and because all the out-degree nodes corresponding to the same in-degree node are stored in the same array; or, the same out-degree node All in-degree nodes corresponding to a node are stored in the same array, so that all out-degree nodes corresponding to in-degree nodes or all in-degree nodes corresponding to out-degree nodes can be determined in the array, which improves the efficiency of node determination.
- the information processing efficiency is improved.
- FIG. 1 is a schematic diagram of an application scenario provided by the present application.
- FIG. 2 is a schematic diagram of a split transaction flow provided by the application
- FIG. 3 is a schematic diagram of a merged transaction flow provided by the application.
- FIG. 4 is a schematic flowchart of an information processing method provided by an embodiment of the present application.
- FIG. 5 is a schematic diagram for representing the relationship between transaction flow and invoice provided by an embodiment of the present application.
- FIG. 6 is another schematic diagram for representing the relationship between the transaction flow and the invoice provided by the embodiment of the present application.
- FIG. 7 is another schematic diagram for representing the relationship between the transaction flow and the invoice provided by the embodiment of the present application.
- FIG. 8 is a schematic diagram for representing the relationship between a transaction flow and an invoice provided by an embodiment of the present application.
- FIG. 9 is another schematic diagram for representing the relationship between the transaction flow and the invoice provided by the embodiment of the present application.
- FIG. 10 is another schematic diagram for representing the relationship between the transaction flow and the invoice provided by the embodiment of the present application.
- FIG. 11 is a schematic structural diagram of an information processing apparatus provided by an embodiment of the application.
- FIG. 12 is a schematic structural diagram of a server according to an embodiment of the present application.
- FIG. 1 is a schematic diagram of an application scenario provided by the present application.
- the information processing system shown in FIG. 1 includes information processing Various subjects, such as users 101, enterprises 102, regulatory agencies 103, etc., these subjects can request the information management platform 104 for information processing of one or some enterprises, such as transaction flow and invoice processing.
- the three subjects mentioned above are only for illustration, in fact, there are other subjects that can initiate processing, for example, the information management platform 104 automatically initiates processing, or regulators such as regulators can also initiate processing, which will not be exemplified here. .
- the processing requests from each subject are provided to the information management platform 104 through the network, and the information management platform 104 is used to perform information processing operations.
- the information management platform 104 includes: an information processing triggering The flow of information processing; the information database is used to store various calculated information; the information processing module is used to process relevant information in the information database according to the data source.
- the data source may be a server of a regulatory agency that provides data of various dimensions to the information management platform 104 for information processing. It should be understood that the number of users 101 , enterprises 102 , regulatory agencies 103 , and data sources in the example environment is merely exemplary, and greater or lesser numbers are within the scope of the present disclosure.
- the user 101 can use various devices to access the network, such as a personal computer, a server, a tablet, a mobile phone, a PDA, a notebook or any other computing device with networking capabilities.
- the enterprise 102, the regulatory agency 103, the information management platform 104, and various data sources can be implemented by using a server or server group with more powerful processing power and higher security.
- the networks used between them can include various types of wired and wireless networks, such as but not limited to: Internet, local area network, WIFI, WLAN, cellular communication networks (GPRS, CDMA, 2G/3G/4G/5G cellular networks) ), satellite communication networks, etc.
- transaction flow and invoice are not simply one-to-one, but are determined by the actual business scenario.
- a customer may need to split multiple invoices for a transaction flow.
- the transaction flow D1 can be split into two virtual transaction flows V1 and V2 as required, and for these two transactions
- the virtual transaction flow V1 and V2 are billed, and the corresponding invoices can be INV1 and INV2, as shown in FIG. 2, which is a schematic diagram of a split transaction flow provided by this application; or, multiple transactions of the same customer may be Invoices need to be combined.
- the transaction flows D1 and D2 can be combined into one virtual transaction flow V1 as required, and the two virtual transaction flows V1 are billed, and the corresponding invoices It can be INV1, as shown in FIG. 3 , which is a schematic diagram of a merged transaction flow provided by the present application.
- the structure of the graph object can be used to describe the relationship between the transaction flow and the invoice.
- the root node in the graph object is used to represent the transaction serial number
- the leaf node is used to represent the invoice.
- the structure information of these graph objects will be stored in the In the linked list, the whole process management of the invoice can be realized by using the linked list.
- the linked list is a non-consecutive, non-sequential storage structure on a physical storage unit, the logical order of data elements is achieved through the linking order of pointers in the linked list.
- the linked list consists of a series of nodes (each element in the linked list is called Each node consists of two parts: one is the data field that stores the data element, and the other is the pointer field that stores the address of the next node. Therefore, when a linked list is used for management, if a transaction needs to be processed Flow, you need to first determine the transaction flow in the structure information of the graph object according to the transaction serial number. Since the structure information of the graph object is stored in the linked list, it is necessary to traverse each node in the linked list in order to determine the transaction flow. Only after the transaction flow is determined, can the transaction flow be flown, which will result in low information processing efficiency.
- an embodiment of the present application provides an information processing method, which receives an operation instruction sent by a terminal device, and the operation instruction includes the node identifier of the node to be processed; Determine the node to be processed; wherein, the graph information includes multiple nodes and multiple edges, and the identification information of multiple nodes and the attribute information of multiple edges are stored in the form of arrays; in the graph information, the same in-degree node corresponds to All out-degree nodes are stored in the same array; or, all in-degree nodes corresponding to the same out-degree node are stored in the same array; the nodes to be processed are processed; the processing includes query processing, merge processing, or deletion deal with.
- the graph may be a directed acyclic graph.
- the attribute information of the edge includes the node type of the in-degree node of the edge, the out-degree node and in-degree node corresponding to the edge, and the weight of the edge; the node type is stored in the type array, and the out-degree node Nodes are stored in out-degree arrays, in-degree nodes are stored in in-degree arrays, and edge weights are stored in weights arrays. It can be understood that, in the graph information, all out-degree nodes corresponding to the same in-degree node are stored in the same array; or, all in-degree nodes corresponding to the same out-degree node are stored in the same array.
- All out-degree nodes corresponding to the same in-degree node in the same array or, by storing all in-degree nodes corresponding to the same out-degree node in the same array, by performing a search operation in the array, it can be determined All out-degree nodes corresponding to the in- and out-degree nodes, or all in-degree nodes corresponding to the out-degree nodes are determined, which improves information query efficiency.
- the out-degree nodes corresponding to the same in-degree node in the same array or, by storing all the in-degree nodes corresponding to the same out-degree node in the same array, the corresponding in-degree nodes in the prior art are stored in the same array. All out-degree nodes are stored separately, or compared with all in-degree nodes corresponding to out-degree nodes, storage space can be effectively saved.
- the node to be processed is determined from the pre-built graph information according to the node identifier of the node to be processed. Since the graph information includes the identification information of multiple nodes and the attribute information of multiple edges are stored in an array, so that the nodes to be processed can be directly determined from the array, and there is no need for the structure information of the graph object to be stored in the linked list as in the prior art.
- FIG. 4 is a schematic flowchart of an information processing method provided by an embodiment of the present application.
- the information processing method may be executed by software and/or a hardware device, and the hardware device may be a server.
- the information processing method may include:
- the operation instruction includes the node identifier of the node to be processed.
- S402. Determine the node to be processed from pre-built graph information according to the node identifier of the node to be processed.
- the graph information includes multiple nodes and multiple edges, and the identification information of multiple nodes and the attribute information of multiple edges are stored in an array; in the graph information, all out-degree nodes corresponding to the same in-degree node are stored in the same array; alternatively, all in-degree nodes corresponding to the same out-degree node are stored in the same array.
- the attribute information of the edge includes the node type of the in-degree node of the edge, the out-degree node and in-degree node corresponding to the edge, and the weight of the edge; wherein, the node type is stored in the type array.
- out-degree nodes are stored in out-degree arrays
- in-degree nodes are stored in in-degree arrays
- edge weights are stored in weights arrays.
- the node type can be understood as the level of the node in the directed acyclic graph.
- its node type It can be 1.
- the node is the next-level child node of the root node, its node type can be 2.
- the node type of each node in the directed acyclic graph can be obtained.
- the root node is the top-level node, the root node has no in-degree nodes, and similarly, since the bottom-level leaf nodes are the bottom-level nodes, the bottom-level leaf nodes have no out-degree nodes.
- the graph information Before determining the node to be processed from the pre-built graph information according to the node identifier, the graph information may be pre-constructed.
- the first message sent by the terminal device may be received first, and the first message includes the identification information and attribute value of at least one original node; for each original node, if the attribute value of the original node is greater than If the preset value is set, at least two first child nodes corresponding to the original node are determined according to the preset value, and the attribute value of each first child node is smaller than the preset value; the identification information of the at least one first child node is stored.
- the identification array and store the type information in the type array; generate at least one second child node corresponding to each of the first child nodes, and determine the identification information and type information of the second child node;
- the information is stored in the identification array, and the type information of the second child node is stored in the type array; according to the original node, the first child node and the second child node, it is determined that there is a direction between the two nodes in the graph information to be constructed
- the weight value of the edge, and build the graph information, the weight value of the edge is stored in the weight array.
- each edge of the edge set table is used as a row of data. storage, which can effectively reduce the space complexity.
- the space complexity of the graph storage node table is O(m)
- the space complexity of the edge table is O(m+e )
- the space complexity of the graph storage node table is O(m)
- the space complexity of the edge table is O(m).
- the original node can be understood as the node representing the transaction flow, and each transaction flow corresponds to an original node;
- the first child node can be understood as the virtual flow corresponding to the transaction flow, an original node.
- the indicated transaction flow can be split or merged to obtain one or more virtual flows corresponding to the transaction flow;
- the second sub-node can be understood as an invoice corresponding to the virtual flow, and each virtual flow corresponds to an invoice.
- the node to be processed can be understood as a node used to describe the transaction flow
- the target node corresponding to the node to be processed can be understood as a node used to describe the invoice corresponding to the transaction flow, that is, the target node is a node in the second child node.
- the node to be processed can be determined from the pre-built graph information according to the node identifier, and the node to be processed is processed, that is, the following S403 is performed:
- processing the node to be processed may include: querying target nodes related to the node to be processed from pre-built graph information. For example, when querying the target node related to the node to be processed from the pre-built graph information, you can first find the node type of the node to be processed from the type array according to the node identifier; and according to the node type, from the out-degree array and/or Or in the in-degree array, find the out-degree node and/or in-degree node of the node to be processed; then find the weight value of the edge corresponding to the out-degree node and/or in-degree node from the weight array; The target node is determined in the degree node and/or the in-degree node, so that the target node related to the node to be processed is obtained by query.
- the graph information includes the identification information of multiple nodes and the attribute information of multiple edges, both of which are stored in an array, it is possible to directly query and wait for the information from the pre-built graph information.
- the target node associated with the processing node since the structure information of the graph object is stored in the linked list, it is necessary to traverse each node in turn in the linked list to query the target node related to the node to be processed, thereby improving the information query efficiency.
- the edge corresponding to the out-degree node refers to the edge connecting one end to the out-degree node and the other end to the upper layer node of the out-degree node
- the edge corresponding to the in-degree node refers to one end connecting the in-degree node and one end connecting to the in-degree node.
- the edge of the next level node of this in-degree node refers to the edge connecting one end to the out-degree node and the other end to the upper layer node of the out-degree node
- the edge corresponding to the in-degree node refers to one end connecting the in-degree node and one end connecting to the in-degree node.
- the weight value of the edge corresponding to a certain out-degree node of the node to be processed is a preset value, such as 0, it means that the out-degree node corresponds to The edge of is an invalid edge, correspondingly, the out-degree node is also an invalid node. Therefore, the out-degree node will not be determined as the target node; on the contrary, it is assumed that the weight value of the edge corresponding to a certain out-degree node of the node to be processed If it is not the default value, it means that the edge corresponding to the out-degree node is a valid edge.
- the out-degree node is also a valid node. Therefore, the out-degree node will be determined as the target node. It can be understood that when the target node is determined from the in-degree nodes according to the weight value, the method is similar to the above-mentioned method of determining the target node from the out-degree nodes. Please refer to the relevant description of determining the target node from the out-degree nodes. Here, how to determine the target node from the in-degree nodes is not repeated in this embodiment of the present application.
- processing the nodes to be processed may include: determining the merged node according to the at least two nodes to be processed; The identification information of the merged node is added to the identification array; the weight value of the directed edge between the node to be processed and the merged node is determined, and the weight value is added to the weight array.
- processing the node to be processed may include: determining both the node to be processed and the out-degree node of the node to be processed as invalid nodes.
- the node to be processed is determined from the pre-built graph information according to the node identifier of the node to be processed. Since the graph information includes the identification information of multiple nodes and the attribute information of multiple edges are stored in an array, so that the nodes to be processed can be directly determined from the array, and there is no need for the structure information of the graph object to be stored in the linked list as in the prior art.
- transaction flow and invoices can be managed in the form of graphs.
- Transaction flow, virtual flow, and invoice information are all abstracted as nodes in the graph.
- a transaction flow node refers to an in-degree of 0 and an out-degree of A node of n;
- a virtual flow node refers to a node with non-zero in-degree and out-degree;
- an invoice node refers to a node with in-degree n and out-degree 0.
- the virtual flow does not actually exist.
- the customer is concerned about which invoices are actually generated by a transaction flow, and which transaction flows correspond to the back of an invoice. For example, refer to FIG.
- FIG. 5 is a schematic diagram for representing the relationship between transaction flow and invoice provided by the embodiment of the present application.
- the three transaction flows are D1 and D2 respectively. and D3
- the transaction flow D1 is split into two virtual flows
- the two virtual flows are V1 and V2 respectively
- the transaction flow D2 is split into two virtual flows
- the two virtual flows are V3 and V4, respectively
- the virtual flow V2 and V3 are combined into a new virtual flow V5, then the virtual flow corresponds to an invoice INV1, the virtual flow V5 corresponds to an invoice INV2, and the transaction flow D3 and virtual flow V4 corresponds to an invoice INV3. .
- the transaction flow, virtual flow and invoice information are stored in the node table as node information, and the unique identifier is used as the index field and the node identifier in the graph information.
- the virtual flow is just a new flow generated by the change in the amount of the transaction flow, and only the basic customer information needed to record the amount and billing needs to be recorded in the attribute.
- the storage of the graph is generally divided into two parts, the storage of the nodes and the storage of the edges corresponding to the nodes.
- the storage of nodes usually adopts one-dimensional node table, and the storage method of edges usually adopts adjacency matrix, adjacency list, cross-linked list and edge set array. For graph information that needs to be persisted, it also needs to be stored in the database.
- Edges are inserted frequently, and edge weights are modified infrequently.
- Frequent query According to the node with in-degree of 0, query all nodes with out-degree of 0 that can be reached in the graph information. According to the node with out-degree 0, find all nodes with in-degree 0 that can reach the node.
- Infrequent queries other traversals of the graph. The insertion of edges may lead to graph merging, and the invalidation of edges may lead to graph splitting.
- a new way is adopted to store graph information and manage graph objects.
- the storage of graph information is divided into two parts: database, persistent storage in text files and graph object storage in memory.
- the point table is stored in the same way as the traditional graph, and different types of nodes are stored in separate tables to avoid the waste of resources caused by field redundancy.
- For the edge set table since all edges under the same in-degree node have the same weight and are inserted and modified at the same time, we can use ⁇ in-degree node, ⁇ out-degree node 1, out-degree node 2, out-degree node 3... ⁇ >
- the mapped form of grouping stores the set of edges. Taking the in-degree node D1 as an example, the records stored in the edge set table are described in Table 1:
- V1 and V2 are the virtual flow corresponding to the transaction flow.
- the space complexity of the graph storage node table is O(m)
- the space complexity of the edge table is O(m+e )
- the space complexity of the graph storage node table is O(m)
- the space complexity of the edge table is O(m).
- FIG. 6 is another schematic diagram for representing the relationship between the transaction flow and the invoice provided by the embodiment of the present application. It is assumed that there are four transaction flows, and the four transaction flows are D1 respectively.
- FIG. 7 is another embodiment of the present application for representing the relationship between the transaction flow and the invoice.
- the invoices corresponding to transaction flow 2 are INV2, INV3, and INV5, the invoices corresponding to transaction flow 3 are INV23, and the invoices corresponding to transaction flow 4 are INV4 and INV5.
- the target nodes corresponding to the node D1 obtained from the query are INV1 and INV2.
- nodePrestige[i] when storing, for any node X in the graph information, its node identifier is stored in nodePrestige[i], and the node type can be stored in a type array, which can be stored in nodeType[i].
- i] represents; the out-degree node is stored in the out-degree array, and the out-degree array can be represented by nodeOutDeg[i]; the in-degree node is stored in the in-degree array, and the in-degree array can be represented by adjacentNode[i];
- the weights are stored in the weights array, which can be represented by edgeW[i].
- the graph information may include multiple nodes and multiple edges, identification information of multiple nodes and attribute information of multiple edges through data storage.
- the time complexity of finding all real virtual pipeline nodes or invoice nodes reachable by an original transaction pipeline in the graph instance is O(1), and the time complexity of finding the target node is generally less than O(e).
- the invoice corresponding to each transaction flow can be queried, and since the transaction information is stored in the array, the invoice related to the transaction flow can be directly searched from the array, without the need to sequentially Only by traversing each node can the query result be obtained, thereby improving the information query efficiency.
- each transaction flow can generate a single-node graph.
- the node identifier and edge attributes of the graph corresponding to the transaction flow are also stored.
- FIG. 1 expands from a minimal graph to a three-node graph.
- the graph information is stored in memory in the form of a GraphMetrics object.
- the GraphMetrics object of Figure G1 is as follows:
- the instantiation of the graph object is similar to the instantiation of the graph G1, and the GraphMetrics object of G2 can be obtained.
- FIG. 8 is a schematic diagram for representing the relationship between transaction flow and invoice provided by this embodiment of the present application. Two GraphMetrics objects are merged into one, and the specific process is as follows:
- FIG. 9 is another schematic diagram for representing the relationship between the transaction flow and the invoice provided by the embodiment of the present application.
- the process of splitting the graph is as follows:
- Figure 10 is another schematic diagram for representing the relationship between the transaction flow and the invoice provided by this embodiment of the application, so that the Merge or delete nodes in graph information.
- FIG. 11 is a schematic structural diagram of an information processing apparatus 110 provided by an embodiment of the present application.
- the information processing apparatus 110 may include:
- the receiving unit 1101 is configured to receive an operation instruction sent by the terminal device, where the operation instruction includes the node identifier of the node to be processed.
- the processing unit 1102 is configured to determine the node to be processed from the pre-built graph information according to the node identifier of the node to be processed; wherein the graph information includes multiple nodes and multiple edges, and the identification information of multiple nodes and multiple edges
- the attribute information is stored as an array; in the graph information, all out-degree nodes corresponding to the same in-degree node are stored in the same array; or, all in-degree nodes corresponding to the same out-degree node are stored in the same array.
- the processing unit 1102 is further configured to process the node to be processed, wherein the processing includes query processing, merge processing, or deletion processing.
- the operation instruction is a query instruction
- the processing unit 1102 is specifically configured to query the target node related to the node to be processed from the pre-built graph information.
- the attribute information includes the node type of the in-degree node of the edge, the out-degree node and in-degree node corresponding to the edge, and the weight of the edge; wherein, the node type is stored in the type array, and the out-degree node stores In the out-degree array, the in-degree nodes are stored in the in-degree array, and the weights of the edges are stored in the weights array.
- the processing unit 1102 is specifically used to find the node type of the node to be processed from the type array; according to the node type, from the out-degree array and/or the in-degree array, find the out-degree node and/or the in-degree node of the node to be processed; Find the weight value of the edge corresponding to the out-degree node and/or the in-degree node from the weight array; according to the weight value, determine the target node from the out-degree node and/or the in-degree node.
- the receiving unit 1101 is further configured to receive a first message sent by the terminal device, where the first message includes identification information and an attribute value of at least one original node.
- the processing unit 1102 is further configured to, for each original node, determine the identification information and type information of at least one first child node corresponding to the original node according to the attribute value of the original node; store the identification information of the at least one first child node in the identification array, and store the type information in the type array; generate at least one second child node corresponding to each of the first child nodes, and determine the identification information and type information of the second child node; Store in the identity array, and store the type information of the second child node in the type array; according to the original node, the first child node and the second child node, determine the directed edge between the two nodes in the graph information to be constructed
- the weight value of , and build the graph information, the weight value of the edge is stored in the weight array.
- the processing unit 1102 is specifically configured to, if the attribute value of the original node is greater than the preset value, determine at least two first child nodes corresponding to the original node according to the preset value, wherein the attribute value of each first child node is The attribute values are all smaller than the default value.
- the operation instruction is a merge instruction
- the number of nodes to be processed is at least two
- the processing unit 1102 is specifically configured to determine the merged node according to the at least two nodes to be processed; and add the identification information of the merged node to the identification array. ; Determine the weight value of the directed edge between the node to be processed and the merged node, and add the weight value to the weight array.
- the operation instruction is a deletion instruction
- the processing unit 1102 is specifically configured to determine both the node to be processed and the out-degree node of the node to be processed as invalid nodes.
- the information processing apparatus 110 shown in this embodiment of the present application can execute the information processing method shown in any of the above embodiments, and its implementation principle and beneficial effects are similar to those of the information processing method. The realization principle and beneficial effects will not be repeated here.
- FIG. 12 is a schematic structural diagram of a server 120 provided by an embodiment of the present application.
- the server 120 includes a memory 1202 and a processor 1201; wherein,
- the memory 1202 is used to store computer programs.
- the processor 1201 is used to read the computer program stored in the memory 1202, and execute the information processing method shown in any of the above embodiments according to the computer program in the memory 1202, its implementation principle, beneficial effects and information
- the implementation principle and beneficial effects of the processing method are similar, and are not repeated here.
- the embodiments of the present application also provide a readable storage medium for storing instructions, when the instructions are executed, the information processing method shown in any of the above embodiments is implemented, the implementation principle, beneficial effects and information The implementation principle and beneficial effects of the processing method are similar, and are not repeated here.
- the disclosed apparatus and method may be implemented in other manners.
- the apparatus embodiments described above are only illustrative.
- the division of the units is only a logical function division. In actual implementation, there may be other division methods.
- multiple units or components may be combined or Can be integrated into another system, or some features can be ignored, or not implemented.
- the shown or discussed mutual coupling or direct coupling or communication connection may be through some interfaces, indirect coupling or communication connection of devices or units, and may be in electrical, mechanical or other forms.
- each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit.
- the above-mentioned integrated unit may be implemented in the form of hardware, or may be implemented in the form of hardware plus software functional units.
- the above-mentioned integrated modules implemented in the form of software functional modules may be stored in a computer-readable storage medium.
- the above-mentioned software function modules are stored in a storage medium, and include several instructions to enable a computer device (which may be a personal computer, a server, or a network device, etc.) or a processor (English: processor) to execute the methods of the various embodiments of the present application. some steps.
- processor may be a central processing unit (English: Central Processing Unit, referred to as: CPU), or other general-purpose processors, digital signal processors (English: Digital Signal Processor, referred to as: DSP), dedicated Integrated circuit (English: Application Specific Integrated Circuit, referred to as: ASIC) and so on.
- a general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of the method disclosed in conjunction with the invention can be directly embodied as executed by a hardware processor, or executed by a combination of hardware and software modules in the processor.
- the memory may include high-speed RAM memory, and may also include non-volatile storage NVM, such as at least one magnetic disk memory, and may also be a U disk, a removable hard disk, a read-only memory, a magnetic disk or an optical disk, and the like.
- NVM non-volatile storage
- the bus may be an Industry Standard Architecture (ISA) bus, a Peripheral Component (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, or the like.
- ISA Industry Standard Architecture
- PCI Peripheral Component
- EISA Extended Industry Standard Architecture
- the bus can be divided into address bus, data bus, control bus and so on.
- the buses in the drawings of the present application are not limited to only one bus or one type of bus.
- the above computer-readable storage medium can be implemented by any type of volatile or non-volatile storage device or combination thereof, such as Static Random Access Memory (SRAM), Electrically Erasable Programmable Read-Only Memory (EEPROM) , Erasable Programmable Read Only Memory (EPROM), Programmable Read Only Memory (PROM), Read Only Memory (ROM), Magnetic Memory, Flash Memory, Magnetic Disk or Optical Disk.
- SRAM Static Random Access Memory
- EEPROM Electrically Erasable Programmable Read-Only Memory
- EPROM Erasable Programmable Read Only Memory
- PROM Programmable Read Only Memory
- ROM Read Only Memory
- Magnetic Memory Flash Memory
- Magnetic Disk Magnetic Disk or Optical Disk.
- a storage medium can be any available medium that can be accessed by a general purpose or special purpose computer.
Landscapes
- Engineering & Computer Science (AREA)
- Business, Economics & Management (AREA)
- Theoretical Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Physics & Mathematics (AREA)
- Development Economics (AREA)
- Databases & Information Systems (AREA)
- Finance (AREA)
- Accounting & Taxation (AREA)
- Strategic Management (AREA)
- Data Mining & Analysis (AREA)
- Economics (AREA)
- Marketing (AREA)
- General Engineering & Computer Science (AREA)
- General Business, Economics & Management (AREA)
- Computational Linguistics (AREA)
- Software Systems (AREA)
- Technology Law (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
一种信息处理方法、装置和存储介质,在接收到包括待处理节点的节点表示的操作指令后,根据待处理节点的节点标识,从预先构建的图信息中确定待处理节点,由于图信息中包括多个节点的标识信息和多条边的属性信息均按照数组方式进行存储,可以直接从数组中确定待处理节点,无需在链表中依次遍历每一个节点才能确定待处理节点,而且由于同一入度节点对应的所有出度节点存储在同一个数组中;或者,同一出度节点对应的所有入度节点存储在同一个数组中,使得可以在数组中确定出入度节点对应的所有出度节点或者与出度节点对应的所有入度节点,提高了节点的确定效率,这样在对确定出的待处理节点进行处理时,提高了信息处理效率。
Description
本申请基于申请号为202011328205.4,申请日为2020年11月24日,申请名称为“信息处理方法、装置和存储介质”的中国专利申请提出,并要求该中国专利申请的优先权,该中国专利申请的全部内容在此引入本申请作为参考。
本申请涉及数据处理技术,尤其涉及一种信息处理方法、装置和存储介质。
随着计算机技术的发展,越来越多的技术(大数据、分布式、人工智能等)应用在金融领域,传统金融业正在逐步向金融科技(Fintech)转变,但由于金融行业的安全性、实时性要求,也对服务请求技术提出了更高的要求。
目前,在金融科技领域,为了防止虚开发票,税务局要求开具增值税发票必须提供真实的交易流水。但在实际开票场景中,交易流水与发票并非简单的一对一关系,而是由实际的业务场景决定的,例如,客户可能需要对一笔交易流水拆分开多张发票;或者,一笔交易流水的金额可能对应了多个类目需要分类开票;或者,同一个客户的多次交易可能需要合并开票。对交易流水的拆分或者合并虽然只涉及金额的变动,但交易流水本身还有冲销、调账等变动需求,发票也有红冲、作废等状态变更问题。因此,现有技术中,可以采用图对象的结构描述交易流水和发票之间的关联关系,例如,图对象中的根节点用于表示交易流水号,叶节点用于表示发票,这些图对象的结构信息会被存储在链表中,从而利用链表实现发票的全流程管理。
但是,采用链表进行管理时,若要处理某一个交易流水,需要先根据交易流水号在图对象的结构信息中确定该交易流水,由于图对象的结构信息被存储在链表中,因此,需要在链表中依次遍历每一个节点才能确定该交易流水,在确定出该交易流水后,才能对该交易流水进行流水,这样会导致信息 处理效率较低。
发明内容
本申请实施例提供了一种信息处理方法、装置和存储介质,提高了信息处理效率。
第一方面,本申请实施例提供了一种信息处理方法,该信息处理方法可以包括:
接收终端设备发送的操作指令,所述操作指令中包括待处理节点的节点标识。
根据所述待处理节点的节点标识,从预先构建的图信息中确定所述待处理节点;其中,所述图信息中包括多个节点以及多条边,所述多个节点的标识信息和所述多条边的属性信息均按照数组方式进行存储;在所述图信息中,同一入度节点对应的所有出度节点存储在同一个数组中;或者,所述同一出度节点对应的所有入度节点存储在同一个数组中。
对所述待处理节点进行处理;其中,所述处理包括查询处理、合并处理、或者删除处理。
在一种可能的实现方式中,所述操作指令为查询指令,所述对所述待处理节点进行处理,包括:
从预先构建的图信息中查询与所述待处理节点相关的目标节点。
在一种可能的实现方式中,针对每条边,所述属性信息包括所述边的入度节点的节点类型、所述边对应的出度节点和入度节点以及所述边的权重;其中,所述节点类型存储在类型数组中,所述出度节点存储在出度数组中,所述入度节点存储在入度数组中,所述边的权重存储在权重数组中。
所述从预先构建的图信息中查询与所述待处理节点相关的目标节点,包括:
从所述类型数组中查找所述待处理节点的节点类型。
根据所述节点类型,从所述出度数组和/或所述入度数组中,查找所述待处理节点的出度节点和/或入度节点。
从所述权重数组中查找与所述出度节点和/或所述入度节点对应的边的权重值。
根据所述权重值,从所述出度节点和/或所述入度节点中确定所述目标节点。
在一种可能的实现方式中,所述从预先构建的图信息中查询与所述待处理节点相关的目标节点之前,所述方法还包括:
接收所述终端设备发送的第一消息,所述第一消息中包括有至少一个原始节点的标识信息和属性值。
针对每个所述原始节点,根据所述原始节点的属性值,确定所述原始节点对应的至少一个第一子节点的标识信息和类型信息。
将所述至少一个第一子节点的标识信息存储在标识数组中,并将所述类型信息存储在类型数组中。
生成所述至少一个第一子节点各自对应的第二子节点,并确定所述第二子节点的标识信息和类型信息。
将所述第二子节点的标识信息存储在所述标识数组中,并将所述第二子节点的类型信息存储在所述类型数组中。
根据所述原始节点、所述第一子节点和所述第二子节点,确定待构建的图信息中两个节点之间有向边的权重值,并构建所述图信息,所述边的权重值存储在权重数组中。
在一种可能的实现方式中,所述根据所述原始节点的属性值,确定所述原始节点对应的至少一个第一子节点的标识信息和类型信息,包括:
若所述原始节点的属性值大于预设值,则按照所述预设值,确定所述原始节点对应的至少两个第一子节点,其中,所述每个第一子节点的属性值均小于所述预设值。
在一种可能的实现方式中,所述操作指令为合并指令,所述待处理节点的数量为至少两个,所述对所述待处理节点进行处理,包括:
根据至少两个待处理节点,确定合并节点。
将所述合并节点的标识信息加入到所述标识数组中。
确定所述待处理节点与所述合并节点之间有向边的权重值,并将所述权重值加入到所述权重数组中。
在一种可能的实现方式中,所述操作指令为删除指令,所述对所述待处理节点进行处理,包括:
将所述待处理节点和所述待处理节点的出度节点均确定为无效节点。
第二方面,本申请实施例还提供了一种信息处理装置,该信息处理装置可以包括:
接收单元,用于接收终端设备发送的操作指令,所述操作指令中包括待处理节点的节点标识。
处理单元,用于根据所述待处理节点的节点标识,从预先构建的图信息中确定所述待处理节点;其中,所述图信息中包括多个节点以及多条边,所述多个节点的标识信息和所述多条边的属性信息均按照数组方式进行存储;在所述图信息中,同一入度节点对应的所有出度节点存储在同一个数组中;或者,所述同一出度节点对应的所有入度节点存储在同一个数组中。
所述处理单元,还用于对所述待处理节点进行处理;其中,所述处理包括查询处理、合并处理、或者删除处理。
在一种可能的实现方式中,所述操作指令为查询指令,所述处理单元,具体用于从预先构建的图信息中查询与所述待处理节点相关的目标节点。
在一种可能的实现方式中,针对每条边,所述属性信息包括所述边的入度节点的节点类型、所述边对应的出度节点和入度节点以及所述边的权重;其中,所述节点类型存储在类型数组中,所述出度节点存储在出度数组中,所述入度节点存储在入度数组中,所述边的权重存储在权重数组中。
所述处理单元,具体用于从所述类型数组中查找所述待处理节点的节点类型;根据所述节点类型,从所述出度数组和/或所述入度数组中,查找所述待处理节点的出度节点和/或入度节点;从所述权重数组中查找与所述出度节点和/或所述入度节点对应的边的权重值;根据所述权重值,从所述出度节点和/或所述入度节点中确定所述目标节点。
在一种可能的实现方式中,所述接收单元,还用于接收所述终端设备发送的第一消息,所述第一消息中包括有至少一个原始节点的标识信息和属性值。
所述处理单元,还用于针对每个所述原始节点,根据所述原始节点的属性值,确定所述原始节点对应的至少一个第一子节点的标识信息和类型信息;将所述至少一个第一子节点的标识信息存储在标识数组中,并将所述类型信息存储在类型数组中;生成所述至少一个第一子节点各自对应的第二子节点,并确定所述第二子节点的标识信息和类型信息;将所述第二子节点的标识信息存储在所述标识数组中,并将所述第二子节点的类型信息存储在所述类型 数组中;根据所述原始节点、所述第一子节点和所述第二子节点,确定待构建的图信息中两个节点之间有向边的权重值,并构建所述图信息,所述边的权重值存储在权重数组中。
在一种可能的实现方式中,所述处理单元,具体用于若所述原始节点的属性值大于预设值,则按照所述预设值,确定所述原始节点对应的至少两个第一子节点,其中,所述每个第一子节点的属性值均小于所述预设值。
在一种可能的实现方式中,所述操作指令为合并指令,所述待处理节点的数量为至少两个,所述处理单元,具体用于根据至少两个待处理节点,确定合并节点;将所述合并节点的标识信息加入到所述标识数组中;确定所述待处理节点与所述合并节点之间有向边的权重值,并将所述权重值加入到所述权重数组中。
在一种可能的实现方式中,所述操作指令为删除指令,所述处理单元,具体用于将所述待处理节点和所述待处理节点的出度节点均确定为无效节点。
第三方面,本申请实施例还提供了一种服务器,该服务器可以包括存储器和处理器;其中,
所述存储器,用于存储计算机程序。
所述处理器,用于读取所述存储器存储的计算机程序,并根据所述存储器中的计算机程序执行上述第一方面任一种可能的实现方式中所述的信息处理方法。
第四方面,本申请实施例还提供了一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,所述计算机程序使得服务器执行上述第一方面任一种可能的实现方式中所述的信息处理方法。
由此可见,本申请实施例提供的信息处理方法、装置和存储介质,在接收到包括待处理节点的节点表示的操作指令后,根据待处理节点的节点标识,从预先构建的图信息中确定待处理节点,由于图信息中包括多个节点的标识信息和多条边的属性信息均按照数组方式进行存储,使得可以直接从数组中确定待处理节点,无需像现有技术中那样,由于图对象的结构信息被存储在链表中,使得需要在链表中依次遍历每一个节点才能确定待处理节点,而且由于同一入度节点对应的所有出度节点存储在同一个数组中;或者,同一出度节点对应的所有入度节点存储在同一个数组中,使得可以在数组中确定出入度节点对应的所有出度节点或者与出度节点对应的所有入度节点,提高了 节点的确定效率,这样在对确定出的待处理节点进行处理时,提高了信息处理效率。
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。
图1为本申请提供的一种应用场景的示意图;
图2为本申请提供的一种拆分交易流水的示意图;
图3为本申请提供的一种合并交易流水的示意图;
图4为本申请实施例提供的一种信息处理方法的流程示意图交易流水的示意图;
图5为本申请实施例提供的一种用于表示交易流水和发票之间的关系示意图;
图6为本申请实施例提供的另一种用于表示交易流水和发票之间的关系示意图;
图7为本申请实施例提供的又一种用于表示交易流水和发票之间的关系示意图;
图8为本申请实施例提供的一种用于表示交易流水和发票之间的关系示意图;
图9为本申请实施例提供的另一种用于表示交易流水和发票之间的关系示意图;
图10为本申请实施例提供的又一种用于表示交易流水和发票之间的关系示意图;
图11为本申请实施例提供的一种信息处理装置的结构示意图;
图12为本申请实施例提供的一种服务器的结构示意图。
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而 不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。
本发明的说明书和权利要求书及上述附图中的术语“第一”、“第二”、“第三”及“第四”等(如果存在)是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便这里描述的本发明的实施例能够以除了在这里图示或描述的那些以外的顺序实施。此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或单元的过程、方法、系统、产品或设备不必限于清楚地列出的那些步骤或单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或单元。
本申请实施例提供的信息处理方法可以应用于信息处理系统中,可参见图1所示,图1为本申请提供的一种应用场景的示意图,图1所示的信息处理系统中包括信息处理的各种主体,例如用户101、企业102、监管机构103等等,这些主体可以根据需要向信息管理平台104请求对某个或某些企业的信息处理,例如交易流水和发票的处理。当然,所述三种主体仅仅是为了示例说明,实际上还有其他主体可以发起处理,例如信息管理平台104自动发起处理,或者诸如监管机构也可以启动所述处理,在此不再一一举例。来自各个主体的处理请求通过网络被提供给信息管理平台104,该信息管理平台104用于执行信息的处理操作,所述信息管理平台104包括:信息处理触发模块,用于根据触发条件发起对指定信息处理的流程;信息数据库,用于存储经计算的各种信息;信息处理模块,用于根据数据源在信息数据库中处理相关信息。所述数据源可以是监管机构的服务器向信息管理平台104提供各个维度的数据以用于进行信息处理。应该理解,在示例环境中的用户101、企业102、监管机构103以及数据源的数目仅仅是示例性的,更多或更少的数量都属于本公开的保护范畴。并且,在上述示例运行场景中,所述用户101可以使用各种设备访问所述网络,例如个人计算机、服务器、平板、手机、PDA、笔记本或其它任何具有联网功能的计算设备。而所述企业102、监管机构103、信息管理平台104、各种数据源则可以利用具有更强大处理能力和更高安全性的一个服务器或服务器组来实现。而它们之间所使用的网络可以包括各种类型的有线和无线网络,例如但不局限于:互联网、局域网、WIFI、WLAN、蜂窝通信网络(GPRS、CDMA、2G/3G/4G/5G蜂窝网络)、卫星通信网络等等。
以处理交易流水和发票为例,在实际开票场景中,交易流水与发票并非简单的一对一关系,而是由实际的业务场景决定的。例如,客户可能需要对一笔交易流水拆分开多张发票,例如,对于一笔交易流水D1,可以根据需要将交易流水D1拆分为两笔虚拟交易流水V1和V2,并针对这两笔虚拟交易流水V1和V2开票,对应的发票可为INV1和INV2,可参见图2所示,图2为本申请提供的一种拆分交易流水的示意图;或者,同一个客户的多次交易可能需要合并开票,例如,对于某两笔交易流水D1和D2,可以根据需要将交易流水D1和交易流水D2合并为一笔虚拟交易流水V1,并针对这两笔虚拟交易流水V1开票,对应的发票可为INV1,可参见图3所示,图3为本申请提供的一种合并交易流水的示意图。
可以看出,对交易流水的拆分或者合并虽然只涉及金额的变动,但交易流水本身还有冲销、调账等变动需求,发票也有红冲、作废等状态变更问题,因此,现有技术中,可以采用图对象的结构描述交易流水和发票之间的关联关系,例如,图对象中的根节点用于表示交易流水号,叶节点用于表示发票,这些图对象的结构信息会被存储在链表中,从而利用链表实现发票的全流程管理。
但是,由于链表是一种物理存储单元上非连续、非顺序的存储结构,数据元素的逻辑顺序是通过链表中的指针链接次序实现的,链表由一系列结点(链表中每一个元素称为结点)组成,每个结点包括两个部分:一个是存储数据元素的数据域,另一个是存储下一个结点地址的指针域,因此,采用链表进行管理时,若要处理某一个交易流水,需要先根据交易流水号在图对象的结构信息中确定该交易流水,由于图对象的结构信息被存储在链表中,因此,需要在链表中依次遍历每一个节点才能确定该交易流水,在确定出该交易流水后,才能对该交易流水进行流水,这样会导致信息处理效率较低。
为了提高信息处理的效率,可以尝试在存储时解除各节点的数据域和指针域之间的耦合关系,即不再采用链表的实现发票的全流程管理,以避免在进行信息处理时,因需要在链表中依次遍历每一个节点才能确定该交易流水,导致信息处理效率较低的问题,从而提高信息处理效率。
基于上述构思,本申请实施例提供了一种信息处理方法,接收终端设备发送的操作指令,操作指令中包括待处理节点的节点标识;根据待处理节点的节点标识,从预先构建的图信息中确定待处理节点;其中,图信息中包括 多个节点以及多条边,多个节点的标识信息和多条边的属性信息均按照数组方式进行存储;在图信息中,同一入度节点对应的所有出度节点存储在同一个数组中;或者,同一出度节点对应的所有入度节点存储在同一个数组中;对与待处理节点进行处理;其中,处理包括查询处理、合并处理、或者删除处理。
示例的,图可以为有向无环图。针对图信息中的每条边,边的属性信息包括边的入度节点的节点类型、边对应的出度节点和入度节点以及边的权重;其中,节点类型存储在类型数组中,出度节点存储在出度数组中,入度节点存储在入度数组中,边的权重存储在权重数组中。可以理解的是,在图信息中,同一入度节点对应的所有出度节点存储在同一个数组中;或者,同一出度节点对应的所有入度节点存储在同一个数组中。
通过将同一入度节点对应的所有出度节点存储在同一个数组中;或者,同一出度节点对应的所有入度节点存储在同一个数组中,通过在数组中执行一次查找操作,就可以确定出入度节点对应的所有出度节点,或者,确定出出度节点对应的所有入度节点,提高了信息的查询效率。此外,通过将同一入度节点对应的所有出度节点存储在同一个数组中;或者,同一出度节点对应的所有入度节点存储在同一个数组中,与现有技术中入度节点对应的所有出度节点各自存储、或者与出度节点对应的所有入度节点各自存储相比,可以有效地节省存储空间。
可以看出,在接收到包括待处理节点的节点表示的操作指令后,根据待处理节点的节点标识,从预先构建的图信息中确定待处理节点,由于图信息中包括多个节点的标识信息和多条边的属性信息均按照数组方式进行存储,使得可以直接从数组中确定待处理节点,无需像现有技术中那样,由于图对象的结构信息被存储在链表中,使得需要在链表中依次遍历每一个节点才能确定待处理节点,而且由于同一入度节点对应的所有出度节点存储在同一个数组中;或者,同一出度节点对应的所有入度节点存储在同一个数组中,使得可以在数组中确定出入度节点对应的所有出度节点或者与出度节点对应的所有入度节点,提高了节点的确定效率,这样在对确定出的待处理节点进行处理时,提高了信息处理效率。
下面,将通过具体的实施例,对本申请实施例提供的信息处理方法进行详细的说明。可以理解的是,在本申请实施例中,下面这几个具体的实施例 可以相互结合,对于相同或相似的概念或过程可能在某些实施例中不再赘述。
图4为本申请实施例提供的一种信息处理方法的流程示意图,该信息处理方法可以由软件和/或硬件装置执行,该硬件装置可以为服务器。示例的,请参见图4所示,该信息处理方法可以包括:
S401、接收终端设备发送的操作指令。
其中,操作指令中包括待处理节点的节点标识。
S402、根据待处理节点的节点标识,从预先构建的图信息中确定待处理节点。
其中,图信息中包括多个节点以及多条边,多个节点的标识信息和多条边的属性信息均按照数组方式进行存储;在图信息中,同一入度节点对应的所有出度节点存储在同一个数组中;或者,同一出度节点对应的所有入度节点存储在同一个数组中。
示例的,针对图信息中的每条边,边的属性信息包括边的入度节点的节点类型、边对应的出度节点和入度节点以及边的权重;其中,节点类型存储在类型数组中,出度节点存储在出度数组中,入度节点存储在入度数组中,边的权重存储在权重数组中。
需要说明的是,以图为有向无环图为例,节点类型可以理解为节点在有向无环图中的层级,例如,当节点为有向无环图的根节点时,其节点类型可以为1,当节点为根节点的下一级子节点时,其节点类型可以为2,依次类推,可以得到有向无环图中每一个节点的节点类型。此外,鉴于根节点是最上层的节点,根节点并无入度节点,同理,鉴于最下层的叶节点是最下层的节点,最下层的叶节点并无出度节点。
在根据节点标识,从预先构建的图信息中确定待处理节点之前,可以预先构建该图信息。示例的,在构建图信息时,可以先接收终端设备发送的第一消息,第一消息中包括有至少一个原始节点的标识信息和属性值;针对每个原始节点,若原始节点的属性值大于预设值,则按照预设值,确定原始节点对应的至少两个第一子节点,且每个第一子节点的属性值均小于预设值;将至少一个第一子节点的标识信息存储在标识数组中,并将类型信息存储在类型数组中;生成至少一个第一子节点各自对应的第二子节点,并确定第二子节点的标识信息和类型信息;将第二子节点的标识信息存储在标识数组中,并将第二子节点的类型信息存储在类型数组中;根据原始节点、第一子节点 和第二子节点,确定待构建的图信息中两个节点之间有向边的权重值,并构建图信息,边的权重值存储在权重数组中。
可以看出,通过将标识信息存储在标识数组中、将类型信息存储在类型数组中、以及将边的权重值存储在权重数组中,与现有技术中将边集表每条边作为一行数据存储,可以有效地降低空间复杂度。假设一个图G具有m个节点和e条边,采用传统的存储方法存储该图G时,图存储节点表的空间复杂度为O(m),边表的空间复杂度为O(m+e),而采用本申请中涉及的存储方法存储该图G时,图存储节点表的空间复杂度为O(m),边表的空间复杂度为O(m)。
以应用于查询交易流水和发票为例,原始节点可以理解为表示交易流水的节点,每一笔交易流水对应一个原始节点;第一子节点可以理解为交易流水最终对应的虚拟流水,一个原始节点表示的交易流水可以通过拆分或者合并得到该交易流水对应一个或者多个虚拟流水;第二子节点可以理解为虚拟流水对应的发票,每一个虚拟流水对应一个发票。待处理节点可以理解为用于描述交易流水的节点,待处理节点对应的目标节点可以理解为用于描述该交易流水对应的发票的节点,即目标节点为第二子节点中的节点。
在构建得到图信息后,就可以根据节点标识,从预先构建的图信息中确定待处理节点,并对待处理节点进行处理,即执行下述S403:
S403、对待处理节点进行处理;其中,处理包括查询处理、合并处理、或者删除处理。
示例的,在一种可能的场景中,若操作指令为查询指令,则对待处理节点进行处理可以包括:从预先构建的图信息中查询与待处理节点相关的目标节点。示例的,从预先构建的图信息中查询与待处理节点相关的目标节点时,可以先根据节点标识,从类型数组中查找待处理节点的节点类型;并根据节点类型,从出度数组和/或入度数组中,查找待处理节点的出度节点和/或入度节点;再从权重数组中查找与出度节点和/或入度节点对应的边的权重值;根据权重值,从出度节点和/或入度节点中确定目标节点,从而查询得到与待处理节点相关的目标节点。可以看出,在该种可能的场景中,由于图信息中包括多个节点的标识信息和多条边的属性信息均按照数组方式进行存储,使得可以直接从预先构建的图信息中查询与待处理节点相关的目标节点。无需像现有技术中那样,由于图对象的结构信息被存储在链表中,使得需要在链表 中依次遍历每一个节点才能查询与待处理节点相关的目标节点,从而提高了信息查询效率。
其中,与出度节点对应的边是指一端连接该出度节点,一端连接该出度节点的上一层节点的边,与入度节点对应的边是指一端连接该入度节点,一端连接该入度节点的下一层节点的边。示例的,在根据权重值,从出度节点中确定目标节点时,假设若待处理节点的某一个出度节点对应的边的权重值为预设值,例如0时,说明该出度节点对应的边为无效边,对应的,该出度节点也为无效节点,因此,该出度节点不会被确定目标节点;相反的,假设待处理节点的某一个出度节点对应的边的权重值不为预设值,说明该出度节点对应的边为有效边,对应的,该出度节点也为有效节点,因此,该出度节点会被确定为目标节点。可以理解的是,在根据权重值,从入度节点中确定目标节点时,其方法与上述从出度节点中确定目标节点的方法类似,可参见从出度节点中确定目标节点的相关描述,在此,对于如何从入度节点中确定目标节点,本申请实施例不再进行赘述。
示例的,在另一种可能的场景中,若操作指令为合并指令,待处理节点的数量为至少两个,则对待处理节点进行处理可以包括:根据至少两个待处理节点,确定合并节点;将合并节点的标识信息加入到标识数组中;确定待处理节点与合并节点之间有向边的权重值,并将权重值加入到权重数组中。
示例的,在又一种可能的场景中,若操作指令为删除指令,则对待处理节点进行处理可以包括:将待处理节点和待处理节点的出度节点均确定为无效节点。
可以看出,在接收到包括待处理节点的节点表示的操作指令后,根据待处理节点的节点标识,从预先构建的图信息中确定待处理节点,由于图信息中包括多个节点的标识信息和多条边的属性信息均按照数组方式进行存储,使得可以直接从数组中确定待处理节点,无需像现有技术中那样,由于图对象的结构信息被存储在链表中,使得需要在链表中依次遍历每一个节点才能确定待处理节点,而且由于同一入度节点对应的所有出度节点存储在同一个数组中;或者,同一出度节点对应的所有入度节点存储在同一个数组中,使得可以在数组中确定出入度节点对应的所有出度节点或者与出度节点对应的所有入度节点,提高了节点的确定效率,这样在对确定出的待处理节点进行处理时,提高了信息处理效率。
为了便于理解本申请实施例提供的信息处理方法,下面,将以应用于查询交易流水和发票为例,对本申请实施例提供的信息处理方法进行详细的描述。
在对交易流水和发票进行管理时,可以以图的形式管理交易流水和发票,交易流水、虚拟流水、发票信息均被抽象为图的节点,交易流水节点是指入度为0,出度为n的节点;虚拟流水节点是指入度和出度非0的节点;发票节点是指入度为n,出度为0的节点。其中,虚拟流水对于客户而言,虚拟流水实际是不存在的,客户关注的是一条交易流水实际生成了哪些发票,一张发票背后对应的是哪些交易流水。示例的,可参见图5所示,图5为本申请实施例提供的一种用于表示交易流水和发票之间的关系示意图,假设有三笔交易流水,该三笔交易流水分别为D1、D2以及D3,且将交易流水D1拆分为两笔虚拟流水,该两笔虚拟流水分别为V1和V2,将交易流水D2拆分为两笔虚拟流水,该两笔虚拟流水分别为V3和V4,并根据实际需求,将虚拟流水V2和V3合并为一个新的虚拟流水V5,则虚拟流水对应有一个发票INV1,虚拟流水V5对应有一个发票INV2,交易流水D3和虚拟流水V4对应有一个发票INV3。
其中,交易流水、虚拟流水和发票信息作为节点信息存储在节点表中,以唯一标识作为索引字段和图信息中的节点标识。虚拟流水只是对交易流水的金额变动产生的新流水,属性中只需要记录金额和开票所需的基本客户信息。图的存储一般分为两部分,节点的存储和节点对应的边的存储。节点的存储通常采用一维节点表,边的存储方法通常采用邻接矩阵、邻接表、十字链表和边集数组。对于信息需要持久化的图信息,还需要存储到数据库中,现在已有针对图存储开发的NOSQL型图数据库。发票场景中的业务数据虽然可以抽象为图,但由于图的规模较小、数量多,除了图的管理,服务商还需要处理开票、红冲请求以及税务管理的其他业务。为保留所有原始操作记录,即使对图信息中的节点进行了无效,该无效节点对应的边也不做删除处理,各节点间边的有效性用边的权重来表示,1为有效,0为无效。无效边仍做持久化存储,但在图的划分中不再考虑。发票场景中的图具有以下特点:拥有同一个入度节点的边,权重始终保持一致。拥有同一个出度节点的边,权重始终保持一致。边的插入频繁,边权重的修改不频繁。频繁查询:根据入度为0的节点,查询图信息中能到达的所有出度为0的节点。根据出度为0的 节点,查找能到达该节点的所有入度为0的节点。低频次查询:图的其他遍历。边的插入可能带来图合并,边的无效带来图的拆分。
基于以上特点,在本申请实施例中,采用一种新的方式存储图信息和管理图对象。图信息的存储分为数据库、文本文件中持久化存储和内存中的图对象存储两部分。点表与传统图的存储相同,不同类型的节点分表存储,避免字段冗余带来的资源浪费。对于边集表,由于同一入度节点下的所有边权重相同,同时插入同时修改,因此,可以以<入度节点,{出度节点1,出度节点2,出度节点3……}>的映射形式分组存储边集。以入度节点D1为例,边集表中存储记录为通过表1描述:
表1
边ID | D1 | V1,V2 | 1 |
其中,V1和V2均为交易流水对应的虚拟流水。
假设一个图G具有m个节点和e条边,采用传统的存储方法存储该图G时,图存储节点表的空间复杂度为O(m),边表的空间复杂度为O(m+e),而采用本申请中涉及的存储方法存储该图G时,图存储节点表的空间复杂度为O(m),边表的空间复杂度为O(m)。
可以理解的是,在存储用于交易流水和发票之间的关系的图信息时,既可以存储原始图的完整结构,又可以存储原始图对应的简化图,使得可以满足多数搜索场景的快速查找。示例的,可参见图6所示,图6为本申请实施例提供的另一种用于表示交易流水和发票之间的关系示意图,假设有四笔交易流水,该四笔交易流水分别为D1、D2、D3以及D4,且将交易流水D1拆分为两笔虚拟流水,该两笔虚拟流水分别为V1和V2,将交易流水D2拆分为两笔虚拟流水,该两笔虚拟流水分别为V3和V4,将交易流水D4拆分为两笔虚拟流水,该两笔虚拟流水分别为V5和V6,并根据实际需求,将虚拟流水V2中的一部分金额和虚拟流水V3中的一部分金额合并为一个新的虚拟流水V5,则虚拟流水V1对应有一个发票INV1,虚拟流水V5对应有一个发票INV2,虚拟流水V4和交易流水D3对应有一个发票INV3,虚拟流水V2中的另一部分金额和虚拟流水V5对应有一个发票INV4,虚拟流水V3中的另一部分金额和虚拟流水V6对应有一个发票INV5。可以对图6所示的G8关系进行简化,得到图G8对应的简化图,可参见图7所示,图7为本申请实施例提供的又一种用于表示交易流水和发票之间的关系示意图,在图7所示 的关系中,仅包括交易流水节点和其对应的发票节点,即不再包括交易流水和发票之间的处理过程,最终得到交易流水D1对应的发票为INV1和INV2,交易流水2对应的发票为INV2、INV3和INV5,交易流水3对应的发票为INV23,交易流水4对应的发票为INV4和INV5。示例的,当查询消息中包括待处理节点的节点标识为D1时,则基于上述图4所示的信息处理方法,查询得到的节点D1对应的目标节点即为INV1和INV2。
针对于上述图6所示的关系,在存储时,对于图信息中的任意节点X,其节点标识存储在nodePrestige[i]中,节点类型可以存储在类型数组中,该类型数组可以用nodeType[i]表示;出度节点存储在出度数组中,该出度数组可以用nodeOutDeg[i]表示;入度节点存储在入度数组中,该入度数组可以用adjacentNode[i]表示;边的权重存储在权重数组中,该权重数组可以用edgeW[i]表示。从adjacentNodeOffset[i]开始,共nodeOutDeg[i]个节点,即adjacentNode[adjacentNodeOffset[i]~adjacentNodeOffset[i]+nodeOutDeg[i]-1],具体可参见表2所示:
表2
下标 | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
nodePrestige | D1 | D2 | D3 | D4 | V1 | V2 | V3 | V4 | V5 | V6 | INV1 | INV2 | INV3 | INV4 | INV5 |
nodeType | 1 | 1 | 1 | 1 | 2 | 2 | 2 | 2 | 2 | 2 | 3 | 3 | 3 | 3 | 3 |
nodeOutdeg | 2 | 2 | 1 | 2 | 1 | 2 | 2 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 |
adiacentNodeOffset | 0 | 2 | 4 | 5 | 7 | 8 | 10 | 12 | 13 | 14 | 15 | 15 | 15 | 15 | 15 |
adiacentNode | V1 | V2 | V3 | V4 | INV3 | V5 | V6 | INV1 | V5 | INV4 | V5 | INV3 | NV3 | NV2 | INV5 |
edgeW | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 1 | 0 | 1 | 1 | 0 | 1 |
由于虚拟流水是业务为了不同开票场景对实际交易流水做出的修改,对客户而言,虚拟流水实际是不存在的,客户关注的是一条交易流水实际生成了哪些发票,一张发票背后对应的是哪些交易流水。因此,可以对前述的图G8进行修改,得到图G8的简化图。
通过对图G8关系进行简化,得到图G8关简化图,图G8的简化图可以参见表3所示:
表3
下标 | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
nodePrestige | D1 | D2 | D3 | D4 | V1 | V2 | V3 | V4 | V5 |
nodeType | 1 | 1 | 1 | 1 | 2 | 2 | 2 | 2 | 2 |
nodeOutdeg | 2 | 2 | 1 | 2 | 1 | 2 | 2 | 1 | 1 |
adjacentNodeOffset | 0 | 2 | 4 | 5 | 7 | 8 | 10 | 12 | 13 |
adjacentNode | V1 | V2 | V3 | V4 | INV3 | V5 | V6 | INV1 | V5 |
参见上述表2和表3所示,可以通过数据存储图信息中包括多个节点以及多条边,多个节点的标识信息和多条边的属性信息。
在通过数组存储图信息后,后续在查询某一个节点对应的目标节点时,可以通过下述方式进行快速查询:
可以看出,在图实例中查找一个原始交易流水可到达的全部真实虚拟流水节点或发票节点的时间复杂度为O(1),查找目标节点的时间复杂度一般小于O(e)。
通过上述方法,可以查询出每一笔交易流水对应的发票,且由于交易信息是存储在数组中,使得可以直接从数组中查找与交易流水相关的发票,无需像现有技术中那样,需要依次遍历每一个节点才能得到查询结果,从而提高了信息查询效率。
在接收上传需要开发票的交易流水时,需要先查询图信息中是否包括了该交易流水,若已经包括该交易流水,则忽略该交易流水;相反的,若未包括该交易流水,说明该交易流水为新的交易流水,则需要该新的交易流水进行处理。每一笔交易流水均可生成一个单节点的图,对应的,交易流水对应的图的节点标识和边的属性也会进行存储。
为了便于理解对节点的合并和删除,下面,将以应用于交易流水和发票场景为例,对本申请实施例提供的节点的合并和删除进行详细的描述。假设交易流水D1被拆分为虚拟流水V1和V2,可以根据交易流水D1的graph_id查找出D1所在图的所有数据库记录,并实例化图对象。图G1从最小图扩展为三节点的图,图信息以GraphMetrics对象的形式存储在内存中,图G1的GraphMetrics对象如下:
图对象的实例化具体流程如下:
i.根据graph_id查找所有的交易流水节点,生成trand_list列表;ii.根据grand_id查找所有虚拟流水节点,生成vir_trand_list列表;iii.根据grand_id查找所有发票流水节点,生成invoice_list列表;iv.根据上述三个节点列表,查找每个节点对应的边集表记录,形成图信息GraphMetrics。
假设交易流水D2被拆分为虚拟流水V3和V4,图G2从最小图扩展为三节点的图,图对象的实例化与图G1的实例化类似,可以得到G2的GraphMetrics对象。
假设根据实际业务需求将虚拟流水V2和V3进行合并生成虚拟流水V5,不同图上的节点的出度节点为同一节点时,多个子图进行合并,生成新的图G3。可参见图8所示,图8为本申请实施例提供的一种用于表示交易流水和发票之间的关系示意图,两个GraphMetrics对象合并为一个,具体流程如下:
两个GraphMetrics对象的合并流程如下:
i.为新图生成新的图标识;ii.将原图的节点信息拷贝到新GraphMetrics 对象中;iii.将合并后的新节点写入新的GraphMetrics对象;iv.根据新增的边信息,依次更新出度节点的pro_node_ids属性。
假设虚拟流水V4与交易流水D3合并开发票INV3,图G3与D3合并,生成新的图G4。
假设对发票INV2进行红冲/作废后,取消虚拟流水V2和V3的合并,虚拟流水V5失效,同时虚拟流水V2和V3被释放,则图G4重新被拆分为两个子图G5和G6,可参见图9所示,图9为本申请实施例提供的另一种用于表示交易流水和发票之间的关系示意图。图的拆分处理流程如下:
i.将被撤销的节点和边信息从原GraphMetrics对象中删除;
ii.遍历GraphMetrics中node_type为1的node_info;
iii.对每个node_info,创建一个新的GraphMetrics。对新的GraphMetrics对象,根据节点的pro_node_ids指向深度遍历该节点可到达的全部节点并加入新的GraphMetrics。已迁入新GraphMetrics的节点从原GraphMetrics中删除。
iv.实时将数据库中对应的节点信息和边信息更新为无效。
假设再V2与虚拟流水V5合并,开出发票INV4,V3与虚拟流水V6合并,开出发票INV5。使图G5、G6、G7合并为新的图G8,可参见图10所示,图10为本申请实施例提供的又一种用于表示交易流水和发票之间的关系示意图,从而可以实现对图信息中节点的合并或者删除。
图11为本申请实施例提供的一种信息处理装置110的结构示意图,示例的,请参见图11所示,该信息处理装置110可以包括:
接收单元1101,用于接收终端设备发送的操作指令,操作指令中包括待处理节点的节点标识。
处理单元1102,用于根据待处理节点的节点标识,从预先构建的图信息中确定待处理节点;其中,图信息中包括多个节点以及多条边,多个节点的标识信息和多条边的属性信息均按照数组方式进行存储;在图信息中,同一入度节点对应的所有出度节点存储在同一个数组中;或者,同一出度节点对应的所有入度节点存储在同一个数组中。
处理单元1102,还用于对与待处理节点进行处理;其中,处理包括查询处理、合并处理、或者删除处理。
可选的,操作指令为查询指令,处理单元1102,具体用于从预先构建的 图信息中查询与待处理节点相关的目标节点。
可选的,针对每条边,属性信息包括边的入度节点的节点类型、边对应的出度节点和入度节点以及边的权重;其中,节点类型存储在类型数组中,出度节点存储在出度数组中,入度节点存储在入度数组中,边的权重存储在权重数组中。
处理单元1102,具体用于从类型数组中查找待处理节点的节点类型;根据节点类型,从出度数组和/或入度数组中,查找待处理节点的出度节点和/或入度节点;从权重数组中查找与出度节点和/或入度节点对应的边的权重值;根据权重值,从出度节点和/或入度节点中确定目标节点。
可选的,接收单元1101,还用于接收终端设备发送的第一消息,第一消息中包括有至少一个原始节点的标识信息和属性值。
处理单元1102,还用于针对每个原始节点,根据原始节点的属性值,确定原始节点对应的至少一个第一子节点的标识信息和类型信息;将至少一个第一子节点的标识信息存储在标识数组中,并将类型信息存储在类型数组中;生成至少一个第一子节点各自对应的第二子节点,并确定第二子节点的标识信息和类型信息;将第二子节点的标识信息存储在标识数组中,并将第二子节点的类型信息存储在类型数组中;根据原始节点、第一子节点和第二子节点,确定待构建的图信息中两个节点之间有向边的权重值,并构建图信息,边的权重值存储在权重数组中。
可选的,处理单元1102,具体用于若原始节点的属性值大于预设值,则按照预设值,确定原始节点对应的至少两个第一子节点,其中,每个第一子节点的属性值均小于预设值。
可选的,操作指令为合并指令,待处理节点的数量为至少两个,处理单元1102,具体用于根据至少两个待处理节点,确定合并节点;将合并节点的标识信息加入到标识数组中;确定待处理节点与合并节点之间有向边的权重值,并将权重值加入到权重数组中。
可选的,操作指令为删除指令,处理单元1102,具体用于将待处理节点和待处理节点的出度节点均确定为无效节点。
本申请实施例所示的信息处理装置110,可以执行上述任一实施例所示的信息处理方法,其实现原理以及有益效果与信息处理方法的实现原理及有益效果类似,可参见信息处理方法的实现原理及有益效果,此处不再进行赘述。
图12为本申请实施例提供的一种服务器120的结构示意图,示例的,请参见图12所示,该服务器120包括存储器1202和处理器1201;其中,
所述存储器1202,用于存储计算机程序。
所述处理器1201,用于读取所述存储器1202存储的计算机程序,并根据所述存储器1202中的计算机程序执行上述任一实施例所示的信息处理方法,其实现原理以及有益效果与信息处理方法的实现原理及有益效果类似,此处不再进行赘述。
本申请实施例还提供了一种可读存储介质,用于存储指令,当所述指令被执行时,使上述任一实施例所示的信息处理方法被实现,其实现原理以及有益效果与信息处理方法的实现原理及有益效果类似,此处不再进行赘述。
在本申请所提供的几个实施例中,应该理解到,所揭露的装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所展示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元展示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用硬件加软件功能单元的形式实现。
上述以软件功能模块的形式实现的集成的模块,可以存储在一个计算机可读取存储介质中。上述软件功能模块存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)或处理器(英文:processor)执行本申请各个实施例方法的部分步骤。
应理解的是,上述处理器可以是中央处理单元(英文:Central Processing Unit,简称:CPU),还可以是其他通用处理器、数字信号处理器(英文:Digital Signal Processor,简称:DSP)、专用集成电路(英文:Application Specific Integrated Circuit,简称:ASIC)等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。结合发明所公开的方法的步骤可以直接体现为硬件处理器执行完成,或者用处理器中的硬件及软件模块组合执行完成。
存储器可能包含高速RAM存储器,也可能还包括非易失性存储NVM,例如至少一个磁盘存储器,还可以为U盘、移动硬盘、只读存储器、磁盘或光盘等。
总线可以是工业标准体系结构(Industry Standard Architecture,ISA)总线、外部设备互连(Peripheral Component,PCI)总线或扩展工业标准体系结构(Extended Industry Standard Architecture,EISA)总线等。总线可以分为地址总线、数据总线、控制总线等。为便于表示,本申请附图中的总线并不限定仅有一根总线或一种类型的总线。
上述计算机可读存储介质可以是由任何类型的易失性或非易失性存储设备或者它们的组合实现,如静态随机存取存储器(SRAM),电可擦除可编程只读存储器(EEPROM),可擦除可编程只读存储器(EPROM),可编程只读存储器(PROM),只读存储器(ROM),磁存储器,快闪存储器,磁盘或光盘。存储介质可以是通用或专用计算机能够存取的任何可用介质。
最后应说明的是:以上各实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述各实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分或者全部技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的范围。
Claims (10)
- 一种信息处理方法,其特征在于,包括:接收终端设备发送的操作指令,所述操作指令中包括待处理节点的节点标识;根据所述待处理节点的节点标识,从预先构建的图信息中确定所述待处理节点;其中,所述图信息中包括多个节点以及多条边,所述多个节点的标识信息和所述多条边的属性信息均按照数组方式进行存储;在所述图信息中,同一入度节点对应的所有出度节点存储在同一个数组中;或者,所述同一出度节点对应的所有入度节点存储在同一个数组中;对所述待处理节点进行处理;其中,所述处理包括查询处理、合并处理、或者删除处理。
- 根据权利要求1所述的方法,其特征在于,所述操作指令为查询指令,所述对所述待处理节点进行处理,包括:从预先构建的图信息中查询与所述待处理节点相关的目标节点。
- 根据权利要求2所述的方法,其特征在于,针对每条边,所述属性信息包括所述边的入度节点的节点类型、所述边对应的出度节点和入度节点以及所述边的权重;其中,所述节点类型存储在类型数组中,所述出度节点存储在出度数组中,所述入度节点存储在入度数组中,所述边的权重存储在权重数组中;所述从预先构建的图信息中查询与所述待处理节点相关的目标节点,包括:从所述类型数组中查找所述待处理节点的节点类型;根据所述节点类型,从所述出度数组和/或所述入度数组中,查找所述待处理节点的出度节点和/或入度节点;从所述权重数组中查找与所述出度节点和/或所述入度节点对应的边的权重值;根据所述权重值,从所述出度节点和/或所述入度节点中确定所述目标节点。
- 根据权利要求2或3所述的方法,其特征在于,所述从预先构建的图信息中查询与所述待处理节点相关的目标节点之前,所述方法还包括:接收所述终端设备发送的第一消息,所述第一消息中包括有至少一个原始节点的标识信息和属性值;针对每个所述原始节点,根据所述原始节点的属性值,确定所述原始节点对应的至少一个第一子节点的标识信息和类型信息;将所述至少一个第一子节点的标识信息存储在标识数组中,并将所述类型信息存储在类型数组中;生成所述至少一个第一子节点各自对应的第二子节点,并确定所述第二子节点的标识信息和类型信息;将所述第二子节点的标识信息存储在所述标识数组中,并将所述第二子节点的类型信息存储在所述类型数组中;根据所述原始节点、所述第一子节点和所述第二子节点,确定待构建的图信息中两个节点之间有向边的权重值,并构建所述图信息,所述边的权重值存储在权重数组中。
- 根据权利要求4所述的方法,其特征在于,所述根据所述原始节点的属性值,确定所述原始节点对应的至少一个第一子节点的标识信息和类型信息,包括:若所述原始节点的属性值大于预设值,则按照所述预设值,确定所述原始节点对应的至少两个第一子节点,其中,所述每个第一子节点的属性值均小于所述预设值。
- 根据权利要求1所述的方法,其特征在于,所述操作指令为合并指令,所述待处理节点的数量为至少两个,所述对所述待处理节点进行处理,包括:根据至少两个待处理节点,确定合并节点;将所述合并节点的标识信息加入到所述标识数组中;确定所述待处理节点与所述合并节点之间有向边的权重值,并将所述权重值加入到所述权重数组中。
- 根据权利要求1所述的方法,其特征在于,所述操作指令为删除指令,所述对所述待处理节点进行处理,包括:将所述待处理节点和所述待处理节点的出度节点均确定为无效节点。
- 一种信息处理装置,其特征在于,包括:接收单元,用于接收终端设备发送的操作指令,所述操作指令中包括待处理节点的节点标识;处理单元,用于根据所述待处理节点的节点标识,从预先构建的图信息中确定所述待处理节点;其中,所述图信息中包括多个节点以及多条边,所述多个节点的标识信息和所述多条边的属性信息均按照数组方式进行存储;在所述图信息中,同一入度节点对应的所有出度节点存储在同一个数组中;或者,所述同一出度节点对应的所有入度节点存储在同一个数组中;所述处理单元,还用于对所述待处理节点进行处理;其中,所述处理包括查询处理、合并处理、或者删除处理。
- 一种服务器,其特征在于,包括存储器和处理器;其中,所述存储器,用于存储计算机程序;所述处理器,用于读取所述存储器存储的计算机程序,并根据所述存储器中的计算机程序执行上述权利要求1-7任一项所述的信息处理方法。
- 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质存储有计算机程序,所述计算机程序使得服务器执行权利要求1-7任一项所述的信息处理方法。
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011328205.4 | 2020-11-24 | ||
CN202011328205.4A CN112241474B (zh) | 2020-11-24 | 2020-11-24 | 信息处理方法、装置和存储介质 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2022111380A1 true WO2022111380A1 (zh) | 2022-06-02 |
Family
ID=74175343
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2021/131618 WO2022111380A1 (zh) | 2020-11-24 | 2021-11-19 | 信息处理方法、装置和存储介质 |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN112241474B (zh) |
WO (1) | WO2022111380A1 (zh) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112241474B (zh) * | 2020-11-24 | 2023-08-15 | 深圳前海微众银行股份有限公司 | 信息处理方法、装置和存储介质 |
CN115994244B (zh) * | 2021-10-18 | 2024-03-19 | 广州南天电脑系统有限公司 | 基于大数据的有向图数据处理方法、装置、计算机设备 |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108932348A (zh) * | 2018-08-16 | 2018-12-04 | 北京京东尚科信息技术有限公司 | 区块链的合并处理方法、装置、区块链节点及存储介质 |
CN110110153A (zh) * | 2018-01-24 | 2019-08-09 | 北京京东尚科信息技术有限公司 | 一种节点搜索的方法和装置 |
CN111090651A (zh) * | 2019-12-18 | 2020-05-01 | 深圳前海微众银行股份有限公司 | 数据源的处理方法、装置、设备及可读存储介质 |
CN112241474A (zh) * | 2020-11-24 | 2021-01-19 | 深圳前海微众银行股份有限公司 | 信息处理方法、装置和存储介质 |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111814002B (zh) * | 2019-04-12 | 2024-06-04 | 阿里巴巴集团控股有限公司 | 一种有向图识别方法及系统和服务器 |
-
2020
- 2020-11-24 CN CN202011328205.4A patent/CN112241474B/zh active Active
-
2021
- 2021-11-19 WO PCT/CN2021/131618 patent/WO2022111380A1/zh active Application Filing
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110110153A (zh) * | 2018-01-24 | 2019-08-09 | 北京京东尚科信息技术有限公司 | 一种节点搜索的方法和装置 |
CN108932348A (zh) * | 2018-08-16 | 2018-12-04 | 北京京东尚科信息技术有限公司 | 区块链的合并处理方法、装置、区块链节点及存储介质 |
CN111090651A (zh) * | 2019-12-18 | 2020-05-01 | 深圳前海微众银行股份有限公司 | 数据源的处理方法、装置、设备及可读存储介质 |
CN112241474A (zh) * | 2020-11-24 | 2021-01-19 | 深圳前海微众银行股份有限公司 | 信息处理方法、装置和存储介质 |
Non-Patent Citations (1)
Title |
---|
XIANGQUDEYUANFANG: "Implementation of Graphics Array (Adjacency Matrix) Storage (Chapter 7, P161, Algorithms 7.1, 7.2, 7.4-7.6)", HTTPS://BLOG.CSDN.NET/QQ_42185999/ARTICLE/DETAILS/105634699?OPS_REQUEST_MISC=%257B%2522REQUEST%255FID%2522%253A%2522164277500016780271941027%2522%252C%2522SCM%2522%253A%252220140713.130102334..%2522%257D&REQUEST_ID=164277500016780271941027&BIZ_ID=0&U, 20 April 2020 (2020-04-20) * |
Also Published As
Publication number | Publication date |
---|---|
CN112241474A (zh) | 2021-01-19 |
CN112241474B (zh) | 2023-08-15 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP7221975B2 (ja) | マルチマスタ分散データ管理システムにおけるトランザクション処理 | |
JP6188732B2 (ja) | マルチテナント環境におけるテナント固有のデータ・セットを管理するための、コンピュータで実施される方法、コンピュータ・プログラム製品、およびシステム | |
US11977532B2 (en) | Log record identification using aggregated log indexes | |
US20150278295A1 (en) | Aggregation framework system architecture and method | |
WO2022111380A1 (zh) | 信息处理方法、装置和存储介质 | |
US8856068B2 (en) | Replicating modifications of a directory | |
US9742860B2 (en) | Bi-temporal key value cache system | |
JP2006107446A (ja) | ネットワーク・ドキュメントのバッチ索引付けのためのシステムおよび方法 | |
US20150261798A1 (en) | Maintaining and using a cache of child-to-parent mappings in a content-addressable storage system | |
US10642530B2 (en) | Global occupancy aggregator for global garbage collection scheduling | |
US20080270352A1 (en) | Modifying entry names in directory server | |
US11829814B2 (en) | Resolving data location for queries in a multi-system instance landscape | |
US11100129B1 (en) | Providing a consistent view of associations between independently replicated data objects | |
US10783073B2 (en) | Chronologically ordered out-of-place update key-value storage system | |
CN112434015A (zh) | 数据存储的方法、装置、电子设备及介质 | |
US10606805B2 (en) | Object-level image query and retrieval | |
US11892992B2 (en) | Unique identification management | |
CN111753141B (zh) | 一种数据管理方法及相关设备 | |
US20130041887A1 (en) | Adding entries to an index based on use of the index | |
US9081578B1 (en) | System and method for graph conditioning with non-overlapping orderable values for efficient graph evaluation | |
US20230153300A1 (en) | Building cross table index in relational database | |
US11416468B2 (en) | Active-active system index management | |
US12072868B1 (en) | Data retention management for partitioned datasets | |
US11514016B2 (en) | Paging row-based data stored as objects | |
US20230401174A1 (en) | Extending metadata-driven capabilities in a metadata-centric filesystem |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 21896881 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
32PN | Ep: public notification in the ep bulletin as address of the adressee cannot be established |
Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 120923) |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 21896881 Country of ref document: EP Kind code of ref document: A1 |