Summary of the invention
The purpose of this invention is to provide a kind of correctness that can guarantee concurrent unit in the process flow diagram, flow instance the legitimacy method of inspection according to the concurrent unit of work process flow figure of user's expectation true(-)running.
To achieve these goals, technical solution of the present invention is as follows:
By make up flexibly utilization figure the dark searching algorithm of elder generation check redirect between illegal outlet, illegal entry and each concurrent branch of concurrent unit; Be specially: its data structure adopts forward, reverse two adjacency lists; Wherein: when the illegal outlet of check, use the forward adjacency list, when the check illegal entry, use reverse adjacency list, when the redirect of checking between concurrent branch, use two adjacency lists respectively, use the forward adjacency list during forward lookup, use reverse adjacency list during reverse search.
When illegal outlet of check and illegal entry, each node needs corresponding Search Flags, when the redirect of checking between concurrent branch, each node needs corresponding two Search Flags, and use forward sign is represented forward lookup and used reverse sign to represent reverse search.
The algorithm of the illegal outlet of check is: a concurrent unit has only outlet of an inlet, concurrent start node is its inlet, concurrent end node is its outlet, carry out the dark search of elder generation from concurrent start node, to corresponding concurrent end node, when before arriving concurrent end node, just having arrived leaf node (not going out the limit) or having got back to concurrent start node, show that there is illegal outlet in concurrent unit; Be specially: 1) whole process flow diagram is created an adjacency list; 2) each concurrent start node V carries out following steps in the adjacency list:
A) the Search Flags f of each node correspondence in the adjacency list is changed to 0;
B) by concurrent start node V set out call the traversal subalgorithm travel through.
Described traversal subalgorithm is: at first the traversal sign f of traversal start node V0 is made as 1; Judge then whether traversal start node V0 also has next adjacent node; If any next adjacent node, if the next adjacent node of traversal start node V0 is V2, again described next adjacent node V2 is made the following judgment:, continue to judge whether traversal start node V0 also has next adjacent node 1) if the next adjacent node V2 of traversal start node V0 is the concurrent end node V1 of concurrent start node V correspondence; 2), continue to judge whether traversal start node V0 also has next adjacent node if the traversal sign f of the next adjacent node V2 of traversal start node V0 is 1; 3) if the next adjacent node V2 of traversal start node V0 is concurrent start node V, there is illegal outlet then concurrent unit, prints traverse path, continues to judge whether traversal start node V0 also has next adjacent node; 4) if the next adjacent node V2 of traversal start node V0 is leaf node (not going out the limit), there is illegal outlet then concurrent unit, prints traverse path, continues to judge whether traversal start node V0 also has next adjacent node; 5) other situation recursive call traversal subalgorithm is then set out by the next adjacent node V2 of traversal start node V0 and to be proceeded traversal.
The algorithm of check illegal entry is: a concurrent unit has only outlet of an inlet, concurrent start node is its inlet, concurrent end node is its outlet, carrying out reverse elder generation from concurrent end node searches for deeply, to arriving corresponding concurrent start node, if before arriving concurrent start node, just arrived root node (not going into the limit) or got back to concurrent end node, shown that then there is illegal entry in concurrent unit; Specific algorithm is: at first whole process flow diagram is created a reverse adjacency list; Then each concurrent end node V in the adjacency list is carried out following steps:
1) the Search Flags f of each node correspondence in the adjacency list is changed to 0;
2) set out by concurrent end node V and call reverse traversal subalgorithm and travel through.
Described reverse traversal subalgorithm is: at first the traversal sign f of traversal start node V0 is made as 1; Judge again whether traversal start node V0 also has next adjacent node; If any words, if the next adjacent node of traversal start node V0 is V2, described next adjacent node V2 is made the following judgment:, continue then to judge whether traversal start node V0 also has next adjacent node 1) if the next adjacent node V2 of traversal start node V0 is the concurrent start node V1 of concurrent end node V correspondence; 2), continue then to judge whether traversal start node V0 also has next adjacent node if the traversal sign f of the next adjacent node V2 of traversal start node V0 is 1; 3) if the next adjacent node V2 of traversal start node V0 is concurrent end node V, there is illegal entry then concurrent unit, prints traverse path, continues then to judge whether traversal start node V0 also has next adjacent node; 4) if the next adjacent node V2 of traversal start node V0 is root node (not going into the limit), there is illegal entry then concurrent unit, prints traverse path, continues then to judge whether traversal start node V0 also has next adjacent node; 5) other situation reverse traversal subalgorithm of recursive call is then set out by the next adjacent node V2 of traversal start node V0 and to be proceeded traversal.
Check the algorithm of redirect between concurrent branch to be: to travel through from concurrent start node, when running into the node that a plurality of inlets are arranged, oppositely travel through from this node,, have redirect between then concurrent branch if can just can get back to concurrent start node without the node of the traversal of forward; Its algorithm: 1) whole process flow diagram is created a forward adjacency list, a reverse adjacency list; 2) each concurrent start node V in the adjacency list is carried out following steps:
1) forward of each node correspondence in adjacency list traversal sign f is made as 0;
2) set out by concurrent start node V and call forward traversal subalgorithm and travel through.
Described forward traversal subalgorithm is: at first forward traversal sign f, the reverse traversal sign f1 of traversal start node V0 are made as 1; Judge then whether traversal start node V0 also has next adjacent node, if any words, if the next adjacent node of traversal start node V0 is V2, to described next adjacent node V2 execution in step be again: 1) if next adjacent node V2 and concurrent start node V direct neighbor are made as 0 to the reverse traversal sign f1 of each node correspondence in the adjacency list; 2) if the reverse traversal sign f1 of next adjacent node V2 is 0, and next adjacent node V2 is not concurrent start node V, concurrent end node V1 that neither concurrent start node V correspondence, and next adjacent node V2 goes into the limit number greater than 1, is set out by next adjacent node V2 and calls reverse traversal subalgorithm and carry out reverse traversal; 3) next adjacent node V2 is made the following judgment:, then whether also have next adjacent node V2 to continue to carry out and judge traversal start node V0 if the next adjacent node V2 of a. is concurrent start node V; If b. next adjacent node V2 is the concurrent end node V1 of concurrent start node V correspondence, then whether also has next adjacent node V2 to continue to carry out and judge traversal start node V0; If the forward of c. next adjacent node V2 traversal sign f is 1, then whether also has next adjacent node V2 to continue to carry out and judge traversal start node V0; If d. next adjacent node V2 is leaf node (not going out the limit), then whether also has next adjacent node V2 to continue to carry out and judge traversal start node V0; E. other situation (not being four kinds of a~d) recursive call forward traversal subalgorithm is then set out by next adjacent node V2 and to be proceeded traversal.
Described reverse traversal subalgorithm is: the reverse traversal sign f1 that at first will travel through start node V0 is made as 1; Judge again whether traversal start node V0 also has next adjacent node, if any words, if the next adjacent node of traversal start node V0 is V3, again the reverse adjacent node V3 of this next one is judged:, then continue to judge next reverse adjacent node 1) if reverse adjacent node V3 is the concurrent end node V1 of concurrent start node V correspondence; 2), then continue to judge next reverse adjacent node if reverse adjacent node V3 is root node (not going into the limit); 3) if the reverse traversal sign f1 of reverse adjacent node V3 is 1, then continue to judge next reverse adjacent node; 4) if reverse adjacent node V3 is concurrent start node V, there is redirect between then concurrent branch, prints traverse path, continue to judge next reverse adjacent node again; 5) other situation reverse traversal subalgorithm of recursive call is then set out by reverse adjacent node V3 and to be proceeded reverse traversal.
The present invention has following advantage:
1. the present invention can check out the redirect between illegal outlet, illegal entry and each concurrent branch of concurrent unit by the dark searching algorithm of the elder generation that makes up utilization figure flexibly, realized legitimacy verification to concurrent unit, thereby guaranteed the correctness of concurrent unit in the process flow diagram, made the flow instance can be according to user's expectation true(-)running.
2. the present invention has guaranteed the true(-)running of flow instance to a great extent by when defining process flow diagram being carried out verification, has reduced the possibility of makeing mistakes.
3. the present invention carries out verification by after finishing at process flow diagram to its legitimacy, has removed from when mapping and has made all restrictions, makes the user more flexible when mapping, and is convenient to revise.
4. the present invention is by the verification to process flow diagram in when definition, removed to the correctness that guarantees flow process and carried out dry run, for the user has saved resource.
5. the inventive method is simple, and is reliable.
Embodiment
Below in conjunction with drawings and Examples the present invention is described in further detail.
Data structure of the present invention adopts adjacency list.Need two adjacency lists, the adjacency list of a forward, a reverse adjacency list.When checking illegal outlet, use the forward adjacency list, when the check illegal entry, use reverse adjacency list, when the redirect of checking between concurrent branch, use two adjacency lists respectively.When illegal outlet of check and illegal entry, each node needs corresponding Search Flags, when the redirect of checking between concurrent branch, each node needs corresponding two Search Flags, represents forward lookup (using the forward adjacency list) and reverse search (using reverse adjacency list) respectively.
The algorithm of the illegal outlet of check: a concurrent unit has only outlet of an inlet, concurrent start node is its inlet, concurrent end node is its outlet, carry out the dark search of elder generation from concurrent start node like this, necessarily can arrive corresponding concurrent end node, if before arriving concurrent end node, just arrived leaf node (not going out the limit) or got back to concurrent start node, just show that there is illegal outlet in concurrent unit.
Algorithm steps is as follows:
1. whole process flow diagram is created an adjacency list.
2. each concurrent start node V in the adjacency list is carried out following steps:
1) the Search Flags f of each node correspondence in the adjacency list is changed to 0;
2) by concurrent start node V set out call the traversal subalgorithm travel through.
Wherein: as shown in Figure 1, described traversal subalgorithm is described below:
1. the traversal sign f of traversal start node V0 is made as 1;
2. judge whether traversal start node V0 also has next adjacent node; If any next adjacent node, the next adjacent node of establishing traversal start node V0 is V2, then this next one adjacent node V2 is made the following judgment:
1), continues to judge whether traversal start node V0 also has next adjacent node if the next adjacent node V2 of traversal start node V0 is the concurrent end node V1 of concurrent start node V correspondence;
2), continue to judge whether traversal start node V0 also has next adjacent node if the traversal sign f of the next adjacent node V2 of traversal start node V0 is 1;
3) if the next adjacent node V2 of traversal start node V0 is concurrent start node V, there is illegal outlet then concurrent unit, prints traverse path, continues to judge whether traversal start node V0 also has next adjacent node;
4) if the next adjacent node V2 of traversal start node V0 is leaf node (not going out the limit), there is illegal outlet then concurrent unit, prints traverse path, continues to judge whether traversal start node V0 also has next adjacent node;
5) other situation when four kinds of situations (be not above-mentioned) recursive call traversal subalgorithm is then set out by the next adjacent node V2 of traversal start node V0 and to be proceeded traversal.
The algorithm of check illegal entry: a concurrent unit has only outlet of an inlet, concurrent start node is its inlet, concurrent end node is its outlet, carrying out reverse elder generation from concurrent end node like this searches for deeply, necessarily can arrive corresponding concurrent start node, if before arriving concurrent start node, just arrived root node (not going into the limit) or got back to concurrent end node, just shown that there is illegal entry in concurrent unit.
Algorithm steps is as follows:
1. whole process flow diagram is created a reverse adjacency list;
2. each concurrent end node V in the adjacency list is carried out following steps:
1) the Search Flags f of each node correspondence in the adjacency list is changed to 0;
2) set out by concurrent end node V and call reverse traversal subalgorithm and travel through.
Wherein said reverse traversal subalgorithm is described below (referring to Fig. 2):
1. the traversal sign f of traversal start node V0 is made as 1.
2. judge whether traversal start node V0 also has next adjacent node, if any, the next adjacent node of establishing traversal start node V0 is V2, this next one adjacent node V2 is made the following judgment again:
1), continues then to judge whether traversal start node V0 also has next adjacent node if the next adjacent node V2 of traversal start node V0 is the concurrent start node V1 of concurrent end node V correspondence.
2), continue then to judge whether traversal start node V0 also has next adjacent node if the traversal sign f of the next adjacent node V2 of traversal start node V0 is 1.
3) if the next adjacent node V2 of traversal start node V0 is concurrent end node V, there is illegal entry then concurrent unit, prints traverse path, continues then to judge whether traversal start node V0 also has next adjacent node.
4) if the next adjacent node V2 of traversal start node V0 is root node (not going into the limit), there is illegal entry then concurrent unit, prints traverse path, continues then to judge whether traversal start node V0 also has next adjacent node.
5) other situation (not being above-mentioned four kinds of situations) reverse traversal subalgorithm of recursive call is then set out by the next adjacent node V2 of traversal start node V0 and to be proceeded traversal.
Check the algorithm of redirect between concurrent branch: owing to should not have redirect between each concurrent branch, so can not there be two disjoint paths in the arbitrary node in from concurrent start node to concurrent unit; The present invention travels through from concurrent start node, runs into the node that a plurality of inlets are arranged, and promptly oppositely travels through from this node, if can just can get back to concurrent start node without the node of the traversal of forward, has redirect between then concurrent branch.
Algorithm steps is as follows:
1. whole process flow diagram is created a forward adjacency list, a reverse adjacency list.
2. each concurrent start node V in the adjacency list is carried out following steps:
1) forward of each node correspondence in adjacency list traversal sign f is made as 0;
2) set out by concurrent start node V and call forward traversal subalgorithm and travel through.
As shown in Figure 3, forward traversal subalgorithm is described below:
1. forward traversal sign f, the reverse traversal sign f1 of traversal start node are made as 1.
2. judge whether V0 also has next adjacent node, if any, the next adjacent node of establishing V0 is V2, again this next one adjacent node V2 is carried out following steps:
1) if next adjacent node V2 and concurrent start node V direct neighbor (having a limit from concurrent start node V to next adjacent node V2) are made as 0 to the reverse traversal sign f1 of each node correspondence in the adjacency list;
2) if the reverse traversal sign f1 of next adjacent node V2 is 0, and next adjacent node V2 is not concurrent start node V, concurrent end node V1 that neither concurrent start node V correspondence, and next adjacent node V2 goes into the limit number greater than 1, is set out by next adjacent node V2 and calls reverse traversal subalgorithm and carry out reverse traversal;
3) next adjacent node V2 is made the following judgment:
If a. next adjacent node V2 is concurrent start node V, then whether also has next adjacent node to continue to carry out and judge traversal start node V0;
If b. next adjacent node V2 is the concurrent end node V1 of concurrent start node V correspondence, then whether also has next adjacent node V2 to continue to carry out and judge traversal start node V0;
If the forward of c. next adjacent node V2 traversal sign f is 1, then whether also has next adjacent node V2 to continue to carry out and judge traversal start node V0;
If d. next adjacent node V2 is leaf node (not going out the limit), then whether also has next adjacent node V2 to continue to carry out and judge traversal start node V0;
E. other situation (not being four kinds of a~d) recursive call forward traversal subalgorithm is then set out by next adjacent node V2 and to be proceeded traversal.
3) next adjacent node V2 is made the following judgment:
As shown in Figure 4, reverse traversal subalgorithm is described below:
1. the reverse traversal sign f1 that will travel through start node V0 is made as 1;
2. judge whether traversal start node V0 also has next adjacent node, if any, the next adjacent node of establishing traversal start node V0 is V3, the more reverse adjacent node V3 of this next one is carried out to judge:
1), then continues to judge next reverse adjacent node if reverse adjacent node V3 is the concurrent end node V1 of concurrent start node V correspondence;
2), then continue to judge next reverse adjacent node if reverse adjacent node V3 is root node (not going into the limit);
3) if the reverse traversal sign f1 of reverse adjacent node V3 is 1, then continue to judge next reverse adjacent node;
4) if reverse adjacent node V3 is concurrent start node V, there is redirect between then concurrent branch, prints traverse path, continue to judge next reverse adjacent node again;
5) other situation (not being 1)~5) content) the reverse traversal subalgorithm of recursive call is then set out by reverse adjacent node V3 and to be proceeded reverse traversal.
Illustrate legitimacy how to use this method to check concurrent unit below.
As shown in Figure 5, concurrent unit that illegal outlet arranged can directly arrive behavior node A3 outside the concurrent unit by the behavior node A2 in the concurrent unit.Adopt the present invention to check the method for the illegal outlet in concurrent unit, set out by concurrent start node V and to travel through, the order of traversal is V, A1, A2, A3, E successively, so just exist one to set out by concurrent start node V, concurrent end node V1 without its correspondence, can arrive the path of leaf node, illustrate that there is illegal outlet in this concurrent unit.
As shown in Figure 6, concurrent unit that illegal entry arranged can directly arrive behavior node A2 in the concurrent unit by the behavior node A3 outside the concurrent unit.Adopt the present invention to check the method for concurrent unit illegal entry, set out by concurrent end node V and to carry out reverse traversal, the order of traversal is V, A1, A2, A3, S successively, so just exist one to set out by concurrent end node V, concurrent start node V1 without its correspondence, can arrive the inverse path of root node, illustrate that there is illegal entry in this concurrent unit.
As shown in Figure 7, exist the concurrent unit of redirect to have two paths that do not overlap fully can arrive behavior node A1 between a branch by concurrent start node.Adopt the present invention to check the method for redirect between concurrent cell branch, set out by concurrent start node V earlier and carry out the forward traversal, the order of traversal is V, A1, when arriving A1, find that it has two inlets, set out by A1 and to carry out reverse traversal, the order of traversal is A1, A2, V, like this from concurrent start node V, there are two paths that do not overlap fully to arrive behavior node A1, illustrate between this concurrent cell branch to have redirect.