CN106354703A - Method and device for determining computation sequence of formulas - Google Patents

Method and device for determining computation sequence of formulas Download PDF

Info

Publication number
CN106354703A
CN106354703A CN201610682600.XA CN201610682600A CN106354703A CN 106354703 A CN106354703 A CN 106354703A CN 201610682600 A CN201610682600 A CN 201610682600A CN 106354703 A CN106354703 A CN 106354703A
Authority
CN
China
Prior art keywords
cell
formula
node
target formula
directed graph
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201610682600.XA
Other languages
Chinese (zh)
Inventor
李桢
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Inspur General Software Co Ltd
Original Assignee
Inspur General Software Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Inspur General Software Co Ltd filed Critical Inspur General Software Co Ltd
Priority to CN201610682600.XA priority Critical patent/CN106354703A/en
Publication of CN106354703A publication Critical patent/CN106354703A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/166Editing, e.g. inserting or deleting
    • G06F40/174Form filling; Merging

Abstract

The invention provides a method and device for determining the computation sequence of formulas. The method comprises the steps that data selection cells and result cells which correspond to all target formulas are determined, wherein the data selection cells are used for storing source data, and the result cells are used for storing computation results; the target formulas are converted into formula directed graphs according to the data selection cells and the result cells which correspond to the target formulas respectively; the formula directed graphs are combined into at least one total directed graph according to same cells in the data selection cells and the result cells which correspond to the target formulas; in each total directed graph, the longest path corresponding to the result cell of each target formula is determined; the computation sequence of all the target formulas corresponding to each total directed graph is determined according to the longest path corresponding to the result cell of each target formula. According to the method and device for determining the computation sequence of the formulas, the processing efficiency can be improved.

Description

A kind of method and device of the computation sequence determining formula
Technical field
The present invention relates to field of computer technology, particularly to a kind of method and device of the computation sequence determining formula.
Background technology
Form is a kind of means of conventional tissue disposal data, and people divide in communication exchanges, scientific research and data Widely used various forms in the middle of analysis.Data processing for convenience, usually can use formula to carry out data in form Calculate.For example, the data of the cell of c row is the data of cell and the data sum of the cell of b row of a row, is The data of the cell of filling c row, can arrange formula one, for example: formula one is c=a+b in the cell of c row.Class Often it is applied at aspects such as the forms of form like this formula.In the formula of form, also often there is dependence, with As a example above-mentioned formula, if the Data Source of the cell of a row is in formula two, formula two is a=d-e, then, public affairs to be carried out The calculating of formula one is accomplished by first computing formula two, and otherwise, the data of the cell of a row in formula one is not originated, Ke Yihui Lead to the error in data of the cell of c row.How to determine the computation sequence of formula in form in the data processing of form very Important.
In prior art, in determining form during the computation sequence of formula, the mode generally by Manual definition is come in fact Existing.That is, in a form, by manually coming to analyze the formula in form one by one, sorting out the calculating of these formula Sequentially, computation sequence is arranged in form so that each formula in form when processing according to this computation sequence at Reason.
Visible by foregoing description, the scheme of the computation sequence of determination formula of prior art is by manually analyzing one by one Logical order between the separate equations, and then determine computation sequence, in the case that formula is more, treatment effeciency is relatively for this scheme Low.
Content of the invention
Embodiments provide a kind of method and device of the computation sequence determining formula, it is possible to increase process effect Rate.
On the one hand, embodiments provide a kind of method of the computation sequence determining formula, comprising:
Determine each target formula corresponding peek cell and result cell, wherein, described peek cell is used for Deposit source data, described result cell is used for depositing result of calculation;
According to each target formula described corresponding peek cell and result cell, each target formula described is divided Be not converted to formula directed graph;
According to identical cell in each described target formula corresponding peek cell and result cell, by each Described formula directed graph merges at least one total directed graph;
In each described total directed graph, determine the corresponding longest path of result cell of each described target formula;
According to the corresponding described longest path of result cell of each target formula described, determine that each is described always oriented Scheme the computation sequence between each described target formula corresponding.
Further, the corresponding peek cell of each target formula described in described basis and result cell, will be described Each target formula is respectively converted into formula directed graph, comprising:
Using corresponding for each target formula described peek cell as source node;
Using each target formula described corresponding result cell as destination node;
According to each corresponding source node of target formula described and destination node, generate each target formula described corresponding Formula directed graph.
Further, identical in described corresponding peek cell and result cell according to each described target formula Cell, each described formula directed graph is merged at least one total directed graph, comprising:
Determine that each cell in described each target formula corresponding peek cell and result cell is corresponding The node of formula directed graph;
Node corresponding to identical cell in corresponding for each described target formula unit lattice is defined as phase Same node;
The formula directed graph that any two in each described formula directed graph is had identical node passes through described identical Node merge, generate at least one total directed graph.
Further, described in each described total directed graph, determine the result cell pair of each described target formula The longest path answered, comprising:
In each described total directed graph, using the corresponding node of result cell of each target formula described as termination Node, determines from bottom node to the path of terminal node each described;
Determine the longest path in the corresponding path of result cell of each target formula described.
Further, the corresponding described longest path of the result cell of each target formula described in described basis, determines Computation sequence between each described total directed graph each described target formula corresponding, comprising:
Determine the path of the corresponding described longest path of result cell of each target formula described;
In each described total directed graph, by the road of the corresponding longest path of result cell of each target formula described Electrical path length order from small to large is as the sequencing of the calculating between target formula each described.
On the other hand, embodiments provide a kind of device of the computation sequence determining formula, comprising:
Cell determining unit, for determining each target formula corresponding peek cell and result cell, wherein, Described peek cell is used for depositing source data, and described result cell is used for depositing result of calculation;
Converting unit, for according to each target formula described corresponding peek cell and result cell, will be described Each target formula is respectively converted into formula directed graph;
Combining unit, for according to identical in each described target formula corresponding peek cell and result cell Cell, each described formula directed graph is merged at least one total directed graph;
Longest path determining unit, for, in each described total directed graph, determining the result of each described target formula The corresponding longest path of cell;
Computation sequence determining unit, for the corresponding described longest path of result cell according to each target formula described Footpath, determines the computation sequence between each described total directed graph each described target formula corresponding.
Further, described converting unit, for saving corresponding for each target formula described peek cell as source Point, using each target formula described corresponding result cell as destination node, corresponding according to each target formula described Source node and destination node, generate described each target formula corresponding formula directed graph.
Further, described combining unit, for determining described each target formula corresponding peek cell and result The node of each cell corresponding formula directed graph in cell, by corresponding for each described target formula unit lattice Node corresponding to middle identical cell is defined as identical node, and any two in each described formula directed graph is had The formula directed graph of identical node is merged by described identical node, generates at least one total directed graph.
Further, described longest path determining unit, in each described total directed graph, by each target described The corresponding node of result cell of formula, as terminal node, determines from bottom node to the road of terminal node each described Footpath, determines the longest path in the corresponding path of result cell of each target formula described.
Further, described computation sequence determining unit, for determining the result cell pair of each target formula described The path of the described longest path answered, in each described total directed graph, by the result unit of each target formula described The path of the corresponding longest path of lattice order from small to large is as the priority of the calculating between target formula each described Sequentially.
In embodiments of the present invention, each target formula is converted to formula directed graph, formula directed graph is merged, Obtain at least one total directed graph, according to the corresponding longest path of result cell of each target formula in total directed graph, really Computation sequence between the corresponding target formula of fixed each total directed graph, the logical relation between target formula by directed graph Lai Represent, need not manually come to analyze one by one, determine the computation sequence between target formula by the longest path in directed graph, no Need to manually arrange and arrange, improve treatment effeciency.
Brief description
In order to be illustrated more clearly that the embodiment of the present invention or technical scheme of the prior art, below will be to embodiment or existing Have technology description in required use accompanying drawing be briefly described it should be apparent that, drawings in the following description are the present invention Some embodiments, for those of ordinary skill in the art, on the premise of not paying creative work, can also basis These accompanying drawings obtain other accompanying drawings.
Fig. 1 is the flow chart of a kind of method of computation sequence of determination formula that one embodiment of the invention provides;
Fig. 2 is the corresponding formula directed graph of a kind of target formula one that one embodiment of the invention provides;
Fig. 3 is the corresponding formula directed graph of a kind of target formula two that one embodiment of the invention provides;
Fig. 4 is a kind of total directed graph that one embodiment of the invention provides;
Fig. 5 is the flow chart of another kind of method of computation sequence determining formula that one embodiment of the invention provides;
Fig. 6 is the corresponding formula directed graph of a kind of target formula three that one embodiment of the invention provides;
Fig. 7 is the corresponding formula directed graph of a kind of target formula four that one embodiment of the invention provides;
Fig. 8 is the corresponding formula directed graph of a kind of target formula five that one embodiment of the invention provides;
Fig. 9 is another kind of total directed graph that one embodiment of the invention provides;
Figure 10 is a kind of schematic diagram of the device of computation sequence of determination formula that one embodiment of the invention provides.
Specific embodiment
Purpose, technical scheme and advantage for making the embodiment of the present invention are clearer, below in conjunction with the embodiment of the present invention In accompanying drawing, the technical scheme in the embodiment of the present invention is clearly and completely described it is clear that described embodiment is The a part of embodiment of the present invention, rather than whole embodiments, based on the embodiment in the present invention, those of ordinary skill in the art The every other embodiment being obtained on the premise of not making creative work, broadly falls into the scope of protection of the invention.
As shown in figure 1, embodiments providing a kind of method of the computation sequence determining formula, the method can be wrapped Include following steps:
Step 101: determine each target formula corresponding peek cell and result cell, wherein, described peek is single First lattice are used for depositing source data, and described result cell is used for depositing result of calculation;
Step 102: according to each target formula described corresponding peek cell and result cell, by each mesh described Mark formula is respectively converted into formula directed graph;
Step 103: according to identical unit in each described target formula corresponding peek cell and result cell Lattice, each described formula directed graph is merged at least one total directed graph;
Step 104: in each described total directed graph, determine that the result cell of each described target formula is corresponding Long path;
Step 105: according to the corresponding described longest path of result cell of each target formula described, determine each institute State the computation sequence between total directed graph each described target formula corresponding.
In embodiments of the present invention, each target formula is converted to formula directed graph, formula directed graph is merged, Obtain at least one total directed graph, according to the corresponding longest path of result cell of each target formula in total directed graph, really Computation sequence between the corresponding target formula of fixed each total directed graph, the logical relation between target formula by directed graph Lai Represent, need not manually come to analyze one by one, determine the computation sequence between target formula by the longest path in directed graph, no Need to manually arrange and arrange, improve treatment effeciency.
In an embodiment of the present invention, the corresponding peek cell of each target formula described in described basis and result unit Lattice, each target formula described is respectively converted into formula directed graph, comprising:
Using corresponding for each target formula described peek cell as source node;
Using each target formula described corresponding result cell as destination node;
According to each corresponding source node of target formula described and destination node, generate each target formula described corresponding Formula directed graph.
In embodiments of the present invention it is achieved that conversion from target formula to formula directed graph.In formula directed graph, including Destination node and source node, here using corresponding for target formula peek cell as source node, using result cell as mesh Node, each source node is all connected with destination node, each source node is directed to destination node.For example, target is public Formula one is a1=a2+a3, and a1 is result cell, a2 and a3 is peek cell, using cell a1 as destination node a1, Using cell a2 and cell a3 as source node a21 and source node a31, by node a21 and node a31 all with node a1 It is connected, and node a21 and node a31 is directed to node a1, generate the corresponding formula directed graph of target formula one, this formula is oriented Figure is as shown in Fig. 2 in figure includes: node a1, node a21, node a31, node here includes: destination node, source node.
In an embodiment of the present invention, described according to each described target formula corresponding peek cell and result unit Identical cell in lattice, each described formula directed graph is merged at least one total directed graph, comprising:
Determine that each cell in described each target formula corresponding peek cell and result cell is corresponding The node of formula directed graph;
Node corresponding to identical cell in corresponding for each described target formula unit lattice is defined as phase Same node;
The formula directed graph that any two in each described formula directed graph is had identical node passes through described identical Node merge, generate at least one total directed graph.
In embodiments of the present invention, each target formula may correspond to multiple cells, and cell here includes: peek Cell, result cell, each cell corresponds to one of formula directed graph node, and any two target formula corresponds to Cell in there may be identical cell, at this moment corresponding for identical cell node is defined as identical node, That is, the corresponding node of identical cell is also identical, identical node is merged, generates at least one total directed graph. For example, target formula two is a2=b2*c2, and in this target formula two, a2 is result cell, b2 and c2 is peek Cell, using cell a2 as destination node a22, using cell b2 and cell c2 as source node b2, source node C2, node b2 is all connected with node a22 with node c2, and node b2 and node c2 is directed to node a22, generates this target public The corresponding formula directed graph of formula two, this formula directed graph is as shown in Figure 3.The target formula in target formula one and Fig. 3 in Fig. 2 There is cell a2, in fig. 2, the corresponding node of cell a2 is node a21, in figure 3, the corresponding section of cell a2 in two Point is node a22, due to there being identical cell a2 in target formula one and target formula two, then by corresponding for cell a2 section Point a21 and a22 is defined as identical node, and node a21 and node a22 merges into a node, represented with node a2, generates such as Total directed graph shown in Fig. 4.
In an embodiment of the present invention, described in each described total directed graph, determine the knot of each described target formula The corresponding longest path of fruit cell, comprising:
In each described total directed graph, using the corresponding node of result cell of each target formula described as termination Node, determines from bottom node to the path of terminal node each described;
Determine the longest path in the corresponding path of result cell of each target formula described.
Total directed graph embodies the logical relation between target formula, when total directed graph is merged by least two formula directed graphs When forming, illustrate to there is identical node between this at least two formula directed graph that is to say, that corresponding target formula shares Data in same cell, as a example the total directed graph shown in by Fig. 4, the total directed graph shown in Fig. 4 is that had by the formula of Fig. 2 Merge to the formula directed graph of figure and Fig. 3 and form, there is identical node a2 between the formula directed graph of Fig. 2 and Fig. 3, to Fig. 2 For Fig. 3, node a2 equal corresponding unit lattice a2, for target formula one, cell a2 is peek cell, calculate Go out the result of calculation of cell a1, need to obtain source data from cell a2;For target formula two, cell a2 is Result cell, is calculated by the source data in cell b2 and c2.In total directed graph of Fig. 4, the knot of target formula one The node a1 of fruit cell a1 is terminal node, and the node a2 of the result cell a2 of target formula two is terminal node, bottom Node layer includes: node b2, node c2, node a31, and the low one-level of these nodes does not have other nodes, so being lowermost layer section Point.For node a2, include from the path of bottom node-to-node a2: node b2 → node a2, node c2 → node A2, this two paths be longest path.For node a1, include from the path of bottom node-to-node a1: section Point b2 → node a2 → node a1, node c2 → node a2 → node a1, node a31 → node a1, longest path is node b2 → node a2 → node a1, node c2 → node a2 → node a1.
In an embodiment of the present invention, the result cell of each target formula described in described basis is corresponding described the longest Path, determines the computation sequence between each described total directed graph each described target formula corresponding, comprising:
Determine the path of the corresponding described longest path of result cell of each target formula described;
In each described total directed graph, by the road of the corresponding longest path of result cell of each target formula described Electrical path length order from small to large is as the sequencing of the calculating between target formula each described.
When calculating path, can define the path between any two node is 1, public for each target For formula, the path of longest path, more than 1, illustrates that this target formula needs to use the result of calculation of other target formula, It is, needing the data in the result cell use other target formula.In same total directed graph, longest path is got over Long, illustrate that other target formula that this target formula is related to are more, then, other targets such as this target formula needs are public After the completion of formula calculates, then calculated., in Fig. 4, it is related to target formula one and target formula taking the total directed graph in Fig. 4 as a example Two, the path of the corresponding longest path of result cell a1 of target formula one is 2, the result cell of target formula two The path of the corresponding longest path of a2 is 1, then, according to order from small to large, first calculate target formula two, then calculate By the logical relation of this two target formula, target formula one, can also verify that this computation sequence is correct.
The target formula of the computation sequence to be determined in the embodiment of the present invention can be the formula in same form, lead to Cross the embodiment of the present invention and can determine the computation sequence between all formula in same form.
As shown in figure 5, embodiments providing a kind of method of the computation sequence determining formula, calculating to be determined is suitable The target formula of sequence is the formula in form, and the method may comprise steps of:
Step 501: determine each target formula corresponding peek cell and result cell, wherein, cell of peeking For depositing source data, result cell is used for depositing result of calculation.
In the table, the cell that target formula is located is result cell, and other cells in target formula are to take Counting unit lattice.
Assume that there are two target formula in form is target formula one and target formula two respectively.Determine target formula one Peek cell be cell a2 and cell a3, result cell be cell a1.Determine the peek list of target formula two First lattice are cell b2 and cell c2, and result cell is cell a2.
In addition, for each target formula, peek can be determined by parsing the operative symbol in target formula Cell and result cell.Specifically, when only one of which cell in one end in equal sign two ends, the other end has Unit at least two During lattice, by this cell cell as a result, using this at least two cell as peek cell.
Step 502: using corresponding for each target formula peek cell as source node.
For target formula one, using cell a2 and cell a3 as source node a21 and source node a31.
For target formula two, using cell b2 and cell c2 as source node b2 and source node c2.
Step 503: using each target formula corresponding result cell as destination node.
For target formula one, using cell a1 as destination node a1.
For target formula two, using cell a2 as destination node a22.
Step 504: according to each corresponding source node of target formula and destination node, generate each target formula corresponding Formula directed graph.
The corresponding formula directed graph of target formula one is as shown in Fig. 2 target formula two corresponding formula directed graph such as Fig. 3 institute Show.
Step 505: determine each cell pair in each target formula corresponding peek cell and result cell The node of the formula directed graph answered.
Specifically, it is determined that going out target formula one corresponding cell a1, a2 and a3, the formula corresponding in Fig. 2 respectively is oriented The node a1 of figure, node a21 and node a31.
Determine target formula two corresponding cell a2, b2 and c2, correspond to the node of the formula directed graph in Fig. 3 respectively A22, node b2 and node c2.
Step 506: the node corresponding to identical cell in each target formula corresponding unit lattice is determined For identical node.
In target formula one and the corresponding cell of target formula two, identical cell is cell a2, in fig. 2, Cell a2 corresponding node a21, in figure 3, cell a2 corresponding node a22, then node a21 and node a22 is identical section Point.
Step 507: the formula directed graph that any two in the separate equations directed graph is had identical node passes through identical Node merge, generate at least one total directed graph.
Node a22 in the formula directed graph of node a21 and Fig. 3 in the formula directed graph of Fig. 2 is merged, generates Fig. 4 In total directed graph, in the diagram, node a21 and node a22 is all represented with node a2.
For a form, multiple total directed graphs may be generated, only there is formula each other and calculate The target formula of logical relation just can correspond to same total directed graph, such as in target formula one and all corresponding Fig. 4 of target formula two Total directed graph.If there is not the logical relation that formula calculates between target formula, not appearing in same always has To in figure, for example: target formula three is b3=b4+b5-b6, and cell b3, b4, b5 and b6, all with target formula one and target Formula two does not have the logical relation calculating, so not appearing in same total directed graph.For another angle, no There is the target formula of identical cell, there is no identical node, also would not be merged in same total directed graph, example As: target formula three does not all have identical cell with target formula one and target formula two, does not just have identical node yet, presses According to processing scheme provided in an embodiment of the present invention, the corresponding formula directed graph of target formula three will not be in total directed graph of Fig. 4. According to the logical relation between target formula one, target formula two and target formula three, also demonstrating the embodiment of the present invention provides Scheme correctness.
In addition, when generating total directed graph it is also possible to be accomplished by:
Inquire about the node phase that whether there is formula directed graph corresponding with current goal formula in existing formula directed graph Same node, if it is, identical node is merged, generates new directed graph, otherwise, processes next target formula, directly Finish to all of target formula manipulation.
Independent mutually between different total directed graphs, there is not calculating between different total directed graph corresponding target formula Sequencing, how computation sequence not affect on result of calculation.
Step 508: in each total directed graph, using the corresponding node of result cell of each target formula as termination Node, determines from the path of bottom node to each terminal node.
Specifically, the node a1 of the result cell a1 of target formula one is terminal node, the result list of target formula two The node a2 of first lattice a2 is terminal node.
The corresponding path of node a2 is: node b2 → node a2, node c2 → node a2.
The corresponding path of node a1 is: node b2 → node a2 → node a1, node c2 → node a2 → node a1, node A31 → node a1.
Step 509: determine the longest path in the corresponding path of result cell of each target formula.
Specifically, the longest path in the corresponding path of result cell a1 of target formula one includes: node b2 → section Point a2 → node a1, node c2 → node a2 → node a1.
Longest path in the corresponding path of result cell a2 of target formula two includes: node b2 → node a2, section Point c2 → node a2.
Step 510: determine the path of the corresponding longest path of result cell of each target formula.
Specifically, it is determined that the path of the longest path in going out the corresponding path of result cell a1 of target formula one For 2;The path determining longest path in the corresponding path of result cell a2 of target formula two is 1.
Step 511: in each total directed graph, by the road of the corresponding longest path of result cell of each target formula Electrical path length order from small to large is as the sequencing of the calculating between each target formula.
Specifically, the path of the corresponding longest path of result cell a1 of target formula one is 2, target formula two The corresponding longest path of result cell a2 path be 1, then, according to order from small to large, target formula one Computation sequence with target formula two is: first calculates target formula two, then calculates target formula one.When path is identical, Computation sequence does not successively require.
In embodiments of the present invention, target formula refers to comprise the formula of the logic from cell peek calculating.
Each target formula is abstracted into directed graph by the embodiment of the present invention, by the directed graph fusion connection of target formula, raw Become at least one total directed graph, calculate the longest path of each target formula place cell, according to the size of longest path Determine computation sequence, the embodiment of the present invention shortens the time of the computation sequence determining target formula, improve form establishment effect Rate, practical.
In embodiments of the present invention it is assumed that the form shown in Fig. 5 includes target formula one, target formula two, target public affairs Formula three, target formula four and target formula five.Wherein, target formula three is b3=b4+b5-b6, and corresponding cell is unit Lattice b3, b4, b5 and b6, corresponding formula directed graph is as shown in fig. 6, cell b3 corresponding node b31, cell b4 corresponding node B4, cell b5 corresponding node b5, cell b6 corresponding node b6.Target formula four is c3=c4+c5-c6, corresponding unit Lattice are cell c3, c4, c5, c6, and corresponding formula directed graph is as shown in fig. 7, cell c3 corresponding node c31, cell c4 Corresponding node c4, cell c5 corresponding node c5, cell c6 corresponding node c6.Target formula five is a3=b3+c3, corresponding Cell is cell a3, b3, c3, and corresponding formula directed graph is as shown in figure 8, cell a3 corresponding node a32, cell b3 Corresponding node b32, cell c3 corresponding node c32.In target formula one and the corresponding cell of target formula five, identical list First lattice are cell a3, in fig. 2, cell a3 corresponding node a31, and in fig. 8, cell a3 corresponding node a32, then node A31 and node a32 is identical node, is represented with node a3.In target formula three and the corresponding cell of target formula five, phase Same cell is cell b3, in figure 6, cell b3 corresponding node b31, and in fig. 8, cell b3 corresponding node b32, Then node b31 and node b32 is identical node, is represented with node b3.Target formula four and the corresponding unit of target formula five In lattice, identical cell is cell c3, in the figure 7, cell c3 corresponding node c31, in fig. 8, cell c3 corresponds to Node c32, then node c31 and node c32 is identical node, is represented with node c3.By in Fig. 2, Fig. 3, Fig. 6, Fig. 7 and Fig. 8 Formula directed graph in the identical node of any two formula directed graph merge, obtain total directed graph as shown in Figure 9.
In total directed graph shown in Fig. 9, the node a1 of the result cell a1 of target formula one is terminal node, target The node a2 of the result cell a2 of formula two is terminal node, and the node b3 of the result cell b3 of target formula three is to terminate Node, the node c3 of the result cell c3 of target formula four is terminal node, the section of the result cell a3 of target formula five Point a3 is terminal node.The path of the corresponding longest path of node a1 is 3, the path length of the corresponding longest path of node a2 Spend for 1, the path of the corresponding longest path of node b3 is 1, the path of the corresponding longest path of node c3 is 1, section The path of the corresponding longest path of point a3 is 2.According to order from small to large, calculate target formula two, target public affairs at first Formula three and target formula four, then, calculate target formula five, finally calculate target formula one.Wherein, target formula two, target There is no the requirement of sequencing between formula three and target formula four, but, all before target formula five.
As shown in Figure 10, the device of a kind of computation sequence determining formula provided in an embodiment of the present invention, comprising:
Cell determining unit 1001, for determining each target formula corresponding peek cell and result cell, Wherein, described peek cell is used for depositing source data, and described result cell is used for depositing result of calculation;
Converting unit 1002, for according to each target formula described corresponding peek cell and result cell, inciting somebody to action Each target formula described is respectively converted into formula directed graph;
Combining unit 1003, for according to phase in each described target formula corresponding peek cell and result cell Same cell, each described formula directed graph is merged at least one total directed graph;
Longest path determining unit 1004, for, in each described total directed graph, determining each described target formula The corresponding longest path of result cell;
Computation sequence determining unit 1005, for according to the result cell of each target formula described corresponding described Long path, determines the computation sequence between each described total directed graph each described target formula corresponding.
In an embodiment of the present invention, described converting unit, for by each target formula described corresponding peek unit Lattice as source node, using each target formula described corresponding result cell as destination node, according to each target described The corresponding source node of formula and destination node, generate described each target formula corresponding formula directed graph.
In an embodiment of the present invention, described combining unit, single for determining the corresponding peek of each target formula described The node of each cell corresponding formula directed graph in first lattice and result cell, will be corresponding for each described target formula In unit lattice, the node corresponding to identical cell is defined as identical node, will appoint in each described formula directed graph Two formula directed graphs with identical node of meaning are merged by described identical node, generate at least one total directed graph.
In an embodiment of the present invention, described longest path determining unit, in each described total directed graph, by institute The corresponding node of result cell stating each target formula, as terminal node, determines from bottom node to end each described The only path of node, determines the longest path in the corresponding path of result cell of each target formula described.
In an embodiment of the present invention, described computation sequence determining unit, for determining the knot of each target formula described The path of the corresponding described longest path of fruit cell, in each described total directed graph, by each target formula described The corresponding longest path of result cell path order from small to large as each described between target formula The sequencing calculating.
The contents such as the information exchange between each unit in said apparatus, implementation procedure, due to implementing with the inventive method Example is based on same design, and particular content can be found in the narration in the inventive method embodiment, and here is omitted.
Each embodiment of the present invention at least has the advantages that
1st, in embodiments of the present invention, each target formula is converted to formula directed graph, formula directed graph is closed And, obtain at least one total directed graph, according to the corresponding longest path of result cell of each target formula in total directed graph, Determine the computation sequence between the corresponding target formula of each total directed graph, the logical relation between target formula passes through directed graph To represent, need not manually come to analyze one by one, determine the computation sequence between target formula by the longest path in directed graph, Need not manually arrange and arrange, improve treatment effeciency.
2nd, in embodiments of the present invention, each target formula is abstracted into formula directed graph, the formula of target formula is had To figure fusion connection, generate at least one total directed graph, calculate the longest path of each target formula place cell, foundation The size of longest path determines computation sequence, and the embodiment of the present invention shortens the time of the computation sequence determining target formula, carries High form establishment efficiency, practical.
It should be noted that herein, such as first and second etc relational terms are used merely to an entity Or operation is made a distinction with another entity or operation, and not necessarily requires or imply exist between these entities or operation Any this actual relation or order.And, term " inclusion ", "comprising" or its any other variant are intended to non- The comprising of exclusiveness, so that including a series of process of key elements, method, article or equipment not only include those key elements, But also include other key elements being not expressly set out, or also include being consolidated by this process, method, article or equipment Some key elements.In the absence of more restrictions, the key element being limited by sentence " including a 〃 ", does not arrange Remove and also there is other same factor in the process including described key element, method, article or equipment.
One of ordinary skill in the art will appreciate that: all or part of step realizing said method embodiment can be passed through Completing, aforesaid program can be stored in the storage medium of embodied on computer readable the related hardware of programmed instruction, this program Upon execution, execute the step including said method embodiment;And aforesaid storage medium includes: rom, ram, magnetic disc or light Disk etc. is various can be with the medium of store program codes.
Finally it should be understood that the foregoing is only presently preferred embodiments of the present invention, it is merely to illustrate the skill of the present invention Art scheme, is not intended to limit protection scope of the present invention.All any modifications made within the spirit and principles in the present invention, Equivalent, improvement etc., are all contained in protection scope of the present invention.

Claims (10)

1. a kind of method of the computation sequence determining formula is it is characterised in that include:
Determine each target formula corresponding peek cell and result cell, wherein, described peek cell is used for depositing Source data, described result cell is used for depositing result of calculation;
According to each target formula described corresponding peek cell and result cell, each target formula described is turned respectively It is changed to formula directed graph;
According to identical cell in each described target formula corresponding peek cell and result cell, by described in each Formula directed graph merges at least one total directed graph;
In each described total directed graph, determine the corresponding longest path of result cell of each described target formula;
According to the corresponding described longest path of result cell of each target formula described, determine each described total directed graph pair Computation sequence between each the described target formula answered.
2. method according to claim 1 it is characterised in that
The corresponding peek cell of each target formula described in described basis and result cell, each target formula described is divided Be not converted to formula directed graph, comprising:
Using corresponding for each target formula described peek cell as source node;
Using each target formula described corresponding result cell as destination node;
According to each corresponding source node of target formula described and destination node, generate each corresponding formula of target formula described Directed graph.
3. method according to claim 1 it is characterised in that
Identical cell in described corresponding peek cell and result cell according to each described target formula, by each Described formula directed graph merges at least one total directed graph, comprising:
Determine the corresponding formula of each cell in described each target formula corresponding peek cell and result cell The node of directed graph;
Node corresponding to identical cell in corresponding for each described target formula unit lattice is defined as identical Node;
Any two in each described formula directed graph had the formula directed graph of identical node by described identical section Point merges, and generates at least one total directed graph.
4. method according to claim 1 it is characterised in that
Described determine the corresponding longest path of result cell of each described target formula in each described total directed graph, Including:
In each described total directed graph, using the corresponding node of result cell of each target formula described as terminal node Point, determines from bottom node to the path of terminal node each described;
Determine the longest path in the corresponding path of result cell of each target formula described.
5. according to described method arbitrary in claim 1-4 it is characterised in that
The corresponding described longest path of result cell of each target formula described in described basis, determines that each is described always oriented Scheme the computation sequence between each described target formula corresponding, comprising:
Determine the path of the corresponding described longest path of result cell of each target formula described;
In each described total directed graph, by the path length of the corresponding longest path of result cell of each target formula described Degree order from small to large is as the sequencing of the calculating between target formula each described.
6. a kind of device of the computation sequence determining formula is it is characterised in that include:
Cell determining unit, for determining each target formula corresponding peek cell and result cell, wherein, described Peek cell is used for depositing source data, and described result cell is used for depositing result of calculation;
Converting unit, for according to each target formula described corresponding peek cell and result cell, by described each Target formula is respectively converted into formula directed graph;
Combining unit, for according to identical unit in each described target formula corresponding peek cell and result cell Lattice, each described formula directed graph is merged at least one total directed graph;
Longest path determining unit, for, in each described total directed graph, determining the result unit of each described target formula The corresponding longest path of lattice;
Computation sequence determining unit, for the corresponding described longest path of result cell according to each target formula described, Determine the computation sequence between each described total directed graph each described target formula corresponding.
7. device according to claim 6 it is characterised in that
Described converting unit, for using corresponding for each target formula described peek cell as source node, by described each Target formula corresponding result cell as destination node, according to each corresponding source node of target formula described and purpose section Point, generates described each target formula corresponding formula directed graph.
8. device according to claim 6 it is characterised in that
Described combining unit, for determining each in described each target formula corresponding peek cell and result cell The node of cell corresponding formula directed graph, by identical cell in corresponding for each described target formula unit lattice Corresponding node is defined as identical node, any two in each described formula directed graph is had the public affairs of identical node Formula directed graph is merged by described identical node, generates at least one total directed graph.
9. device according to claim 6 it is characterised in that
Described longest path determining unit, in each described total directed graph, by the result list of each target formula described The corresponding node of first lattice, as terminal node, determines from bottom node to the path of terminal node each described, determines described Longest path in the corresponding path of result cell of each target formula.
10. according to described device arbitrary in claim 6-9 it is characterised in that
Described computation sequence determining unit, for determining the corresponding described longest path of result cell of each target formula described The path in footpath, in each described total directed graph, by the corresponding longest path of result cell of each target formula described The path in footpath order from small to large is as the sequencing of the calculating between target formula each described.
CN201610682600.XA 2016-08-17 2016-08-17 Method and device for determining computation sequence of formulas Pending CN106354703A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610682600.XA CN106354703A (en) 2016-08-17 2016-08-17 Method and device for determining computation sequence of formulas

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610682600.XA CN106354703A (en) 2016-08-17 2016-08-17 Method and device for determining computation sequence of formulas

Publications (1)

Publication Number Publication Date
CN106354703A true CN106354703A (en) 2017-01-25

Family

ID=57844171

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610682600.XA Pending CN106354703A (en) 2016-08-17 2016-08-17 Method and device for determining computation sequence of formulas

Country Status (1)

Country Link
CN (1) CN106354703A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113569184A (en) * 2021-07-16 2021-10-29 众安在线财产保险股份有限公司 Configurable data calculation method, device, equipment and computer readable medium
CN113886459A (en) * 2021-09-24 2022-01-04 深圳市云网万店电子商务有限公司 Method, system and storage medium for processing custom formula based on directed graph

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070033519A1 (en) * 2005-02-18 2007-02-08 Zdenek Andrew J Method and system for the graphical modeling of data and calculations of a spreadsheet
CN103678635A (en) * 2013-12-19 2014-03-26 中国传媒大学 Network music aggregation recommendation method based on label digraphs

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070033519A1 (en) * 2005-02-18 2007-02-08 Zdenek Andrew J Method and system for the graphical modeling of data and calculations of a spreadsheet
CN103678635A (en) * 2013-12-19 2014-03-26 中国传媒大学 Network music aggregation recommendation method based on label digraphs

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
赵立永 等: "半监督二次划分聚类算法及其报表系统应用", 《小型微型计算机系统》 *
马伟勤 等: "报表系统中依赖表格的重新计算算法", 《计算机工程》 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113569184A (en) * 2021-07-16 2021-10-29 众安在线财产保险股份有限公司 Configurable data calculation method, device, equipment and computer readable medium
CN113886459A (en) * 2021-09-24 2022-01-04 深圳市云网万店电子商务有限公司 Method, system and storage medium for processing custom formula based on directed graph

Similar Documents

Publication Publication Date Title
CN106297774B (en) A kind of the distributed parallel training method and system of neural network acoustic model
CN104346629B (en) A kind of model parameter training method, apparatus and system
Kheirkhahzadeh et al. Efficient community detection of network flows for varying Markov times and bipartite networks
CN110516757A (en) A kind of transformer fault detection method and relevant apparatus
Koch et al. Communication: Separable potential energy surfaces from multiplicative artificial neural networks
Larsson et al. An augmented lagrangian algorithm for large scale multicommodity routing
CN106961343A (en) A kind of virtual map method and device
Imbeault et al. Measuring γ in B→ K π π decays
CN106464484B (en) Predefined function obscures execution
CN106354703A (en) Method and device for determining computation sequence of formulas
CN104266657B (en) Shortest path planning parallel method based on CPU and MIC cooperated computings
Günther et al. Recursive approach to determine correlation functions in multibaryon systems
CN103942083B (en) A kind of compiling implementation method towards variable ginseng function
Ershov et al. An approach problem for a control system with an unknown parameter
CN105930325A (en) Reverse analysis method and device for file report comparative difference
TWI444837B (en) Fixed-coefficient variable prime length recursive discrete fourier transform system
CN102546293B (en) High speed network flow network address measuring method based on Hash bit string multiplexing
Liu et al. Pianist: Scalable zkrollups via fully distributed zero-knowledge proofs
CN108197209A (en) A kind of film based on weighting collaborative filtering recommends method
Dabbene et al. Randomized approximations of the image set of nonlinear mappings with applications to filtering
Wu et al. An approximation algorithm for the k-median problem with uniform penalties via pseudo-solution
CN107704624A (en) A kind of data visualization method and device
Boneh et al. LatticeFold: A Lattice-based Folding Scheme and its Applications to Succinct Proof Systems
CN110309235A (en) A kind of data processing method, device, equipment and medium
CN109829216A (en) A kind of spacer units model equivalent method for power system real-time simulation

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20170125

WD01 Invention patent application deemed withdrawn after publication