CN106155898B - Method and device for acquiring path of flow chart - Google Patents

Method and device for acquiring path of flow chart Download PDF

Info

Publication number
CN106155898B
CN106155898B CN201510181504.2A CN201510181504A CN106155898B CN 106155898 B CN106155898 B CN 106155898B CN 201510181504 A CN201510181504 A CN 201510181504A CN 106155898 B CN106155898 B CN 106155898B
Authority
CN
China
Prior art keywords
node
path
flow chart
searched
value
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.)
Active
Application number
CN201510181504.2A
Other languages
Chinese (zh)
Other versions
CN106155898A (en
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.)
Beijing Sogou Technology Development Co Ltd
Original Assignee
Beijing Sogou Technology Development 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 Beijing Sogou Technology Development Co Ltd filed Critical Beijing Sogou Technology Development Co Ltd
Priority to CN201510181504.2A priority Critical patent/CN106155898B/en
Publication of CN106155898A publication Critical patent/CN106155898A/en
Application granted granted Critical
Publication of CN106155898B publication Critical patent/CN106155898B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The invention relates to the field of computers, and discloses a method and a device for acquiring a path of a flow chart, which aim to solve the technical problem that the path of the flow chart cannot be automatically searched and acquired in the prior art. The method comprises the following steps: acquiring the number N of all nodes contained in the flow chart, wherein N is a positive integer; searching a path of the flow chart from a starting node of the flow chart; when a node i is searched, determining nodes passed by the node i in the next step according to the weight of each node pointed by the node i, wherein i is 0,1,2 … N; and after one path is searched, searching a new path in a backtracking mode until backtracking to the starting node. The technical effects that the flow chart can be processed, and all effective paths of the flow chart can be searched and obtained are achieved.

Description

Method and device for acquiring path of flow chart
Technical Field
The present invention relates to the field of computers, and in particular, to a method and an apparatus for acquiring a path of a flowchart.
Background
The flow chart refers to a diagram which is illustrated by specific graphic symbols and represents an algorithm, and generally, one thing or one knowledge point can help us to master outline and hierarchical relationship by the flow chart. However, if we want to verify that there is no problem with this flowchart, we need to verify various situations, such as: whether each path of the flow chart meets the requirements of the design.
In the field of software testing, white box testers need to design test cases according to code logic, that is, paths of a flow chart need to be searched, but in daily work, the flow chart often has complex logic, for example, paths with dozens of branches have powers of two, namely at least thousands of better conditions, and it is simply impossible to find all paths manually.
That is, the prior art has a technical problem that the path of the flowchart cannot be automatically searched and acquired.
Disclosure of Invention
The invention provides a method and a device for acquiring a path of a flow chart, which aim to solve the technical problem that the path of the flow chart cannot be automatically searched and acquired in the prior art.
In a first aspect, an embodiment of the present invention provides a method for acquiring a path of a flowchart, where the method includes:
acquiring the number N of all nodes contained in the flow chart, wherein N is a positive integer;
searching a path of the flow chart from a starting node of the flow chart;
when a node i is searched, determining nodes passed by the node i in the next step according to the weight of each node pointed by the node i, wherein i is 0,1,2 … N;
and after one path is searched, searching a new path in a backtracking mode until backtracking to the starting node.
Optionally, before the weight of each node pointed to by the node i determines a node that the node i passes through next step, the method further includes:
respectively setting a corresponding V value and a corresponding H value for each node of the flow chart, wherein the V value represents the maximum occurrence frequency of the corresponding node in any path, and the H value represents the occurrence frequency of the corresponding node in the currently searched path;
and setting a heuristic function F as V-H for each node, wherein F is the weight.
Optionally, the setting a corresponding V value for each node of the flowchart respectively includes:
determining the number of input lines and the number of output lines of each node;
determining a maximum value of the input line number and the output line number as the V value of the corresponding node.
Optionally, the determining, by the weight of each node pointed by the node i, a node that the node i passes through next step includes:
determining at least one node to which the node i points;
and selecting one node with the maximum F value and larger than zero from the at least one node as a node passing next.
Optionally, after the searching for one path is finished, the method further includes:
and the V values and the H values of all nodes are classified as initial values.
Optionally, the searching for a new path in a backtracking manner specifically includes:
when backtracking to a current node i, judging whether a route which is not searched exists corresponding to the node i;
when the route which is not searched exists corresponding to the node i, selecting one route from the routes which are not searched for searching;
and when no path which is not searched exists corresponding to the node i, selecting the previous node i-1 of the node i as a new current node.
In a second aspect, an embodiment of the present invention provides a path obtaining apparatus for a flowchart, including:
the acquisition module is used for acquiring the number N of all nodes contained in the flow chart, wherein N is a positive integer;
the searching module is used for searching a path of the flow chart from a starting node of the flow chart;
the determining module is used for determining nodes passed by the node i in the next step through the weight of each node pointed by the node i when the node i is searched, wherein i is 0,1 and 2 … N;
and the backtracking module is used for searching a new path in a backtracking mode after one path is searched until the path is backtracked to the starting node.
Optionally, the apparatus further comprises:
a first setting module, configured to set, for each node in the flowchart, a corresponding V value and an H value before determining, by using a weight of each node pointed by the node i, a node that the node i passes through next step, where the V value represents a maximum number of times that the corresponding node appears in any path, and the H value represents a number of times that the corresponding node appears in a currently searched path;
and the second setting module is used for setting a heuristic function F as V-H for each node, wherein F is the weight.
Optionally, the first setting module specifically includes:
a first determination unit for determining the number of input lines and the number of output lines of each node;
a second determination unit for determining a maximum value of the input line number and the output line number as the V value of the corresponding node.
Optionally, the determining module specifically includes:
a third determining unit, configured to determine at least one node to which the node i points;
and the first selection unit is used for selecting one node with the maximum F value and larger than zero from the at least one node as the node passing by the next step.
Optionally, the apparatus further comprises:
and the initialization module is used for reducing the V values and the H values of all the nodes to initial values after one path search is finished.
Optionally, the backtracking module specifically includes:
the judging unit is used for judging whether a route which is not searched exists in the corresponding node i when backtracking to the current node i;
a second selecting unit, configured to select one route from among unsearched routes for searching when an unsearched route exists corresponding to the node i;
and the third selecting unit is used for selecting the previous node i-1 of the node i as a new current node when no searched path does not exist corresponding to the node i.
The invention has the following beneficial effects:
in the embodiment of the invention, the number N of all nodes contained in the flow chart is obtained firstly, wherein N is a positive integer; then, searching a path of the flow chart from a starting node of the flow chart; when the node i is searched, determining the node passed by the node i in the next step according to the weight of each node pointed by the node i, wherein i is 0,1,2 … N; after one path is searched, a new path is searched in a backtracking mode until the new path is backtracked to the starting node, and all effective paths of the flow chart are obtained. After the node i is searched, the node output by the node i next step is determined through the weight of each node pointed by the node i, so that dead loop caused by selection of which node cannot be determined when a loop of the flow chart is encountered can be prevented, and all effective paths of the flow chart can be traversed through by a backtracking algorithm, so that the technical effects of processing the flow chart and searching and obtaining all effective paths of the flow chart are achieved.
Drawings
FIG. 1 is a flow chart of a path acquisition method of the flow chart in an embodiment of the present invention;
FIG. 2 is a diagram illustrating a flowchart listed in a path obtaining method of the flowchart according to an embodiment of the present invention;
FIG. 3 is a flowchart illustrating the establishment of a heuristic function F in the path acquisition method of the flowchart according to an embodiment of the present invention;
fig. 4 is a flowchart of determining a node output by the node i in the next step according to a weight of each node pointed by the node i in the path obtaining method of the flowchart in the embodiment of the present invention;
FIG. 5 is a logic diagram of a path acquisition method of the flowchart in an embodiment of the present invention;
fig. 6 is a block diagram of a path acquisition apparatus according to a flowchart in an embodiment of the present invention.
Detailed Description
The invention provides a method and a device for acquiring a flow chart path, which aim to solve the technical problem that the flow chart path cannot be automatically searched and acquired in the prior art.
In order to solve the technical problems, the general idea of the embodiment of the present application is as follows:
firstly, acquiring the number N of all nodes contained in a flow chart, wherein N is a positive integer; then, searching a path of the flow chart from a starting node of the flow chart; when the node i is searched, determining the node passed by the node i in the next step according to the weight of each node pointed by the node i, wherein i is 0,1,2 … N; after one path is searched, a new path is searched in a backtracking mode until the new path is backtracked to the starting node, and all effective paths of the flow chart are obtained. After the node i is searched, the node output by the node i next step is determined through the weight of each node pointed by the node i, so that dead loop caused by selection of which node cannot be determined when a loop of the flow chart is encountered can be prevented, and all effective paths of the flow chart can be traversed through by a backtracking algorithm, so that the technical effects of processing the flow chart and searching and obtaining all effective paths of the flow chart are achieved.
In order to better understand the technical solutions of the present invention, the following detailed descriptions of the technical solutions of the present invention are provided with the accompanying drawings and the specific embodiments, and it should be understood that the specific features in the embodiments and the examples of the present invention are the detailed descriptions of the technical solutions of the present invention, and are not limitations of the technical solutions of the present invention, and the technical features in the embodiments and the examples of the present invention may be combined with each other without conflict.
In a first aspect, an embodiment of the present invention provides a method for obtaining a path in a flowchart, please refer to fig. 1, including:
step S101: acquiring the number N of all nodes contained in the flow chart, wherein N is a positive integer;
step S102: searching a path of the flow chart from a starting node of the flow chart;
step S103: when the node i is searched, determining the node passed by the node i in the next step according to the weight of each node pointed by the node i, wherein i is 0,1,2 … N;
step S104: after one path searching is finished, searching a new path in a backtracking mode until backtracking to the starting node.
In step S101, the to-be-processed flowchart may be read by a program, and each block in the flowchart indicates a node, and taking the flowchart shown in fig. 2 as an example, the flowchart includes 5 nodes, and for convenience of representation, the 5 nodes may be respectively indicated by numbers 1 to 5.
In step S102, taking the flowchart shown in fig. 2 as an example, the initial node of the flowchart is a node corresponding to "start", and in the search start stage, the next node is searched from the initial node.
As a further preferred embodiment, before determining the node through which the node i passes next based on the weight of each node pointed by the node i in step S103, please refer to fig. 3, the method further includes:
step S301: respectively setting a corresponding V value and a corresponding H value for each node of the flow chart, wherein the V value represents the maximum occurrence frequency of the corresponding node in any path, and the H value represents the occurrence frequency of the corresponding node in the currently searched path;
step S302: and setting a heuristic function F as V-H for each node, wherein F is the weight.
In step S301, the V value is generally determined by the number of lines connected to the corresponding node, and the V value can be obtained by: determining the number of input lines and the number of output lines of each node; and determining the maximum value of the input line number and the output line number as the V value of the corresponding node.
Taking the flowchart shown in fig. 2 as an example, if the number of input lines of the start node 1 is 0, and the number of output lines is 1, V (1) is 1;
if the number of input lines of the node 2 is 2 and the number of output lines is 1, V (2) is 2;
if the number of input lines of the node 3 is 1 and the number of output lines is 2, V (3) is 2;
if the number of input lines of the node 4 is 1 and the number of output lines is 1, V (4) is 1;
if the number of input lines of the node 5 is 1 and the number of output lines is 0, V (5) becomes 1.
For other flowcharts, the calculation manner of the V value of each node is similar, and therefore, the details are not repeated herein.
In the initialization stage, the H values of all nodes are all 0, and after one path search is finished, the V values and the H values of all nodes are reduced to initial values, taking the flowchart shown in fig. 2 as an example, then:
H(1)=H(2)=H(3)=H(4)=H(5)=0
in step S302, in the initialization stage, the heuristic function F (i.e., the weight) of each node is the same as the value V.
In step S103, the node output by the node i in the next step is determined according to the weight of each node pointed by the node i, referring to fig. 4, which specifically includes:
step S401: determining at least one node pointed to by the node i;
step S402: selecting a node with the maximum F value and larger than zero from at least one node as a node passed by the next step;
step S403: when the F value of the corresponding node is less than or equal to zero, the node i does not pass through the corresponding node any more.
In step S401, taking the flowchart shown in fig. 2 as an example, the node to which the node 1 points is the node 2, the node to which the node 2 points is the node 3, the nodes to which the node 3 points are the nodes 2 and 4, the node to which the node 4 points is the node 5, and the node 5 does not have a node to which it points, so after the node 5 is searched, since H (5) is equal to zero, the search of one path is completed.
In step S402, only one node is pointed to by the nodes 1,2, 4, and 5, so that the node directly passes through the pointed node in the next step, and for the node 3, two nodes are pointed to, so that the node through which the node 3 passes in the next step needs to be determined by the weight, that is, the heuristic function F.
When the node 3 is searched, the heuristic functions of the node 2 and the node 4 are respectively as follows:
f (2) ═ V (2) — H (2) ═ 2-1 ═ 1; (node 2 has passed once)
F(4)=V(4)–H(4)=1–0=1;
If a plurality of maximum F values exist at the same time, the node corresponding to the maximum F value is randomly selected as the node to be passed through next step, so the node 3 can randomly select one node from the nodes 2 and 4 to output, and mark the selected node, and assuming that the node 4 selected by the node 3 only points to the node 5, the finally determined path is 1 → 2 → 3 → 4 → 5.
In step S402, since the path with the F value less than or equal to zero is not moved, it is ensured that no dead loop is caused.
By adopting the heuristic function F, the problem that the paths in the flow chart with the loops are not countable can be solved by adopting a control means that each loop in one path only passes once.
In step S104, after the search of one path is finished, in order to search out other nodes, backtracking needs to be started, and as a further preferred embodiment, a new path is obtained through a backtracking method, which specifically includes:
when backtracking to the current node i, judging whether a path which is not searched exists in the corresponding node i;
when the corresponding node i has paths which are not searched, selecting one path from the paths which are not searched for searching;
and when the corresponding node i does not have a path which is not searched, selecting the previous node i-1 of the node i as a new current node.
For example, taking the flowchart shown in fig. 2 as an example, assuming that the first node is the node 4, since the node pointed by the node 4 is only the node 5, and the path from the node 4 to the node 5 has already been traveled, the node 4 does not include a path that has not been traveled, in this case, the previous node (i.e., the node 3) of the node 4 is selected to continue the above-mentioned determination process;
the node pointed by the node 3 includes a node 2 and a node 4, wherein the path from the node 3 to the node 4 has been previously taken, so that the node 4 which has been marked is ignored, and the path from the node 3 to the node 2 is directly selected to continue the search, in which case, F (2) ═ V (2) — H (2) ═ 2-1 ═ 1;
after returning to node 2, the node pointed to by node 2 is node 3, and:
F(3)=V(3)–H(3)=2-1=1
that is, F (3) is greater than 0, so it can be output from node 2 to node 3, and after output from node 2 to node 3, H (2) and H (3) both become 2, so F (2) and F (3) both become 0, and since the last path has been searched, nodes 4 and 5 return to the initial state, that is, H (4) and H (5) both equal to 0, so:
F(4)=V(4)-H(4)=1-0=1 F(5)=V(5)-H(5)=1-0=1
in this case, node 3 can only get the second path through node 4 and then to node 5: 1 → 2 → 3 → 2 → 3 → 4 → 5;
and then, the backtracking is continued, because two paths corresponding to the node 3 are searched, and only one output node is provided for each of the node 1 and the node 2, the backtracking is performed again to the initial node, namely, the process of searching the node is finished.
The following two paths can be obtained:
starting → applicant writes a cross-over book → examining is passed (yes) → applying for a patent → ending;
the method comprises the following steps of (1) → start → applicant writes a closed caption → approval pass (no) → applicant writes a closed caption → approval pass (yes) → application of a patent → end.
As a further preferred embodiment, after obtaining all paths of the flowchart based on step S104, the method further comprises: designing test cases for all paths, and then testing all paths through the test cases, and further improving the coverage of the test cases on code logic, for example: some complex logic codes not only take time but also easily miss some paths if the paths are searched manually, and the path searching by using a program has no problem.
Moreover, the working efficiency of the tester can be improved, for example: some of the more complex flow charts appear to be particularly time consuming to manually perform, and can be completed quickly by procedural analysis.
In general, the path in the flowchart includes two parts, namely an active path and an inactive path, where:
the invalid path in the flow chart refers to: if the current path is repeated for a certain loop, and the previous path covers the loop, the path is considered as an invalid path.
The valid paths in the flow chart refer to: the full path removal invalid path is the valid path.
In the above scheme, the heuristic function F can be set to prevent a certain loop from being repeated for many times, and further all effective paths in the flow chart can be searched.
In order to enable those skilled in the art to further understand the application environment of the path obtaining method of the flowchart described in the embodiment of the present invention, a software architecture or a modular functional block diagram adopted by the method will be described below, please refer to fig. 5, where the functional block diagram includes the following two parts:
the user layer 50, in the user layer 50, firstly, a tester introduces a flow chart of a path to be acquired, and then generates a control instruction for searching all paths;
the service logic layer 51, the service logic layer 51 receives the control instruction sent by the user layer 50; then executing the control instruction, reading in a flow chart and analyzing the flow chart; then searching the flow chart according to a heuristic function F; finally searching all paths of the flow chart; then, all paths are provided to the tester corresponding to the user layer 50, and the tester designs the test case according to all paths.
Of course, in the specific implementation process, the method for obtaining a path of a flowchart described in the embodiment of the present invention may be widely applied in the field of software testing, and may also be applied in any other field including flowcharts, for example: the company needs to reform the process of the patent application flow, the patent application flow is a very complex flow, and under the condition that the patent application flow needs to be checked, if a manual mode is adopted, the overall hierarchical relationship can only be approximately known, but if the patent application flow needs to be judged to have any leak, the patent application flow needs to be seen path by path, and through the scheme introduced by the embodiment of the invention, all effective paths of the patent application flow can be directly displayed, so that the examination and the check of the patent application flow are more convenient.
In a second aspect, based on the same inventive concept, an embodiment of the present invention provides a path obtaining apparatus in a flowchart, please refer to fig. 6, including:
an obtaining module 60, configured to obtain the number N of all nodes included in the flowchart, where N is a positive integer;
a searching module 61, configured to search a path of the flowchart from a start node of the flowchart;
the determining module 62 is configured to determine, when the node i is searched, a node through which the node i passes next by using a weight of each node pointed by the node i, where i is 0,1, or 2 … N;
and a backtracking module 63, configured to search a new path in a backtracking manner after the search of one path is finished until the start node is backtracked.
Optionally, the apparatus further comprises:
the first setting module is used for respectively setting a corresponding V value and an H value aiming at each node of the flow chart before determining the node passed by the node i in the next step according to the weight of each node pointed by the node i, wherein the V value represents the most appeared times of the corresponding node in any path, and the H value represents the appeared times of the corresponding node in the current searched path;
and the second setting module is used for setting a heuristic function F as V-H for each node, wherein F is the weight.
Optionally, the first setting module specifically includes:
a first determination unit for determining the number of input lines and the number of output lines of each node;
and a second determination unit for determining a maximum value of the number of input lines and the number of output lines as the V value of the corresponding node.
Optionally, the determining module 62 specifically includes:
a third determining unit, configured to determine at least one node pointed to by the node i;
and the first selection unit is used for selecting one node with the maximum F value and larger than zero from at least one node as the node passing by the next step.
Optionally, the apparatus further comprises:
and the initialization module is used for reducing the V values and the H values of all the nodes to initial values after one path search is finished.
Optionally, the backtracking module 63 specifically includes:
the judging unit is used for judging whether a path which is not searched exists in the corresponding node i when backtracking to the current node i;
the second selection unit is used for selecting one route from the unsearched routes for searching when the unsearched routes exist in the corresponding node i;
and the third selection unit is used for selecting the previous node i-1 of the node i as a new current node when no searched path exists in the corresponding node i.
One or more embodiments of the invention have at least the following beneficial effects:
in the embodiment of the invention, the number N of all nodes contained in the flow chart is obtained firstly, wherein N is a positive integer; then, searching a path of the flow chart from a starting node of the flow chart; when the node i is searched, determining the node passed by the node i in the next step according to the weight of each node pointed by the node i, wherein i is 0,1,2 … N; after one path is searched, a new path is searched in a backtracking mode until the new path is backtracked to the starting node, and all effective paths of the flow chart are obtained. After the node i is searched, the node output by the node i next step is determined through the weight of each node pointed by the node i, so that dead loop caused by selection of which node cannot be determined when a loop of the flow chart is encountered can be prevented, and all effective paths of the flow chart can be traversed through by a backtracking algorithm, so that the technical effects of processing the flow chart and searching and obtaining all effective paths of the flow chart are achieved. As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While preferred embodiments of the present invention have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all such alterations and modifications as fall within the scope of the invention.
It will be apparent to those skilled in the art that various modifications and variations can be made in the embodiments of the present invention without departing from the spirit or scope of the embodiments of the invention. Thus, if such modifications and variations of the embodiments of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to encompass such modifications and variations.

Claims (8)

1. A method for obtaining a path in a flowchart, comprising:
acquiring the number N of all nodes contained in the flow chart, wherein N is a positive integer;
searching a path of the flow chart from a starting node of the flow chart;
when a node i is searched, determining nodes passed by the node i in the next step according to the weight of each node pointed by the node i, wherein i is 0,1,2 … N;
after one path is searched, searching a new path in a backtracking mode until the path is backtracked to the starting node;
before determining the node which is passed by the node i next step according to the weight value of each node pointed by the node i, the method further comprises the following steps:
respectively setting a corresponding V value and a corresponding H value for each node of the flow chart, wherein the V value represents the maximum occurrence frequency of the corresponding node in any path, and the H value represents the occurrence frequency of the corresponding node in the currently searched path;
setting a heuristic function F ═ V-H for each node, where F is the weight, and
the setting a corresponding V value for each node of the flowchart specifically includes:
determining the number of input lines and the number of output lines of each node;
determining a maximum value of the input line number and the output line number as the V value of the corresponding node.
2. The method according to claim 1, wherein the determining the node through which the node i passes next by using the weight of each node pointed to by the node i specifically comprises:
determining at least one node to which the node i points;
and selecting one node with the maximum F value and larger than zero from the at least one node as a node passing next.
3. The method of claim 1, wherein after a path search ends, the method further comprises:
and the V values and the H values of all nodes are classified as initial values.
4. The method according to any one of claims 1 to 3, wherein the searching for a new path by backtracking comprises:
when backtracking to a current node i, judging whether a route which is not searched exists corresponding to the node i;
when the route which is not searched exists corresponding to the node i, selecting one route from the routes which are not searched for searching;
and when no path which is not searched exists corresponding to the node i, selecting the previous node i-1 of the node i as a new current node.
5. A path acquisition apparatus of a flowchart, comprising:
the acquisition module is used for acquiring the number N of all nodes contained in the flow chart, wherein N is a positive integer;
the searching module is used for searching a path of the flow chart from a starting node of the flow chart;
the determining module is used for determining nodes passed by the node i in the next step through the weight of each node pointed by the node i when the node i is searched, wherein i is 0,1 and 2 … N;
the backtracking module is used for searching a new path in a backtracking mode after one path is searched until the path is backtracked to the starting node;
a first setting module, configured to set, for each node in the flowchart, a corresponding V value and an H value before determining, by using a weight of each node pointed by the node i, a node that the node i passes through next step, where the V value represents a maximum number of times that the corresponding node appears in any path, and the H value represents a number of times that the corresponding node appears in a currently searched path;
a second setting module, configured to set a heuristic function F ═ V-H for each node, where F is the weight,
the first setting module specifically includes:
a first determination unit for determining the number of input lines and the number of output lines of each node;
a second determination unit for determining a maximum value of the input line number and the output line number as the V value of the corresponding node.
6. The apparatus of claim 5, wherein the determining module specifically comprises:
a third determining unit, configured to determine at least one node to which the node i points;
and the first selection unit is used for selecting one node with the maximum F value and larger than zero from the at least one node as the node passing by the next step.
7. The apparatus of claim 5, wherein the apparatus further comprises:
and the initialization module is used for reducing the V values and the H values of all the nodes to initial values after one path search is finished.
8. The apparatus according to any one of claims 5-7, wherein the backtracking module specifically comprises:
the judging unit is used for judging whether a route which is not searched exists in the corresponding node i when backtracking to the current node i;
a second selecting unit, configured to select one route from among unsearched routes for searching when an unsearched route exists corresponding to the node i;
and the third selecting unit is used for selecting the previous node i-1 of the node i as a new current node when no searched path does not exist corresponding to the node i.
CN201510181504.2A 2015-04-16 2015-04-16 Method and device for acquiring path of flow chart Active CN106155898B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510181504.2A CN106155898B (en) 2015-04-16 2015-04-16 Method and device for acquiring path of flow chart

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510181504.2A CN106155898B (en) 2015-04-16 2015-04-16 Method and device for acquiring path of flow chart

Publications (2)

Publication Number Publication Date
CN106155898A CN106155898A (en) 2016-11-23
CN106155898B true CN106155898B (en) 2020-09-01

Family

ID=58058367

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510181504.2A Active CN106155898B (en) 2015-04-16 2015-04-16 Method and device for acquiring path of flow chart

Country Status (1)

Country Link
CN (1) CN106155898B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111324718B (en) * 2020-02-26 2023-06-30 网易(杭州)网络有限公司 Session flow testing method and device, electronic equipment and readable storage medium
CN113238855B (en) * 2021-07-13 2022-07-08 浙江大华技术股份有限公司 Path detection method and device

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102053912A (en) * 2011-01-06 2011-05-11 中国工商银行股份有限公司 Device and method for automatically testing software based on UML (unified modeling language) graphs
CN102999320A (en) * 2011-09-15 2013-03-27 阿里巴巴集团控股有限公司 Automatic test case generation method and system
CN104503901A (en) * 2014-12-04 2015-04-08 中国人民解放军总参谋部第五十四研究所 Guiding symbol execution method based on static path analysis

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101075208B (en) * 2007-07-19 2011-04-06 中兴通讯股份有限公司 Method for generating examples of white-box path test
CN104035864B (en) * 2013-12-17 2017-10-20 北京邮电大学 A kind of path generating method based on contradiction fragment schema

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102053912A (en) * 2011-01-06 2011-05-11 中国工商银行股份有限公司 Device and method for automatically testing software based on UML (unified modeling language) graphs
CN102999320A (en) * 2011-09-15 2013-03-27 阿里巴巴集团控股有限公司 Automatic test case generation method and system
CN104503901A (en) * 2014-12-04 2015-04-08 中国人民解放军总参谋部第五十四研究所 Guiding symbol execution method based on static path analysis

Also Published As

Publication number Publication date
CN106155898A (en) 2016-11-23

Similar Documents

Publication Publication Date Title
CN108829610B (en) Memory management method and device in neural network forward computing process
US9465724B2 (en) Method, program, and system for generating test cases
CN105446874B (en) A kind of detection method and device of resource distribution file
EP2972817B1 (en) Techniques for traversing representations of source code
Rajendran et al. Scheduling to minimize the sum of weighted flowtime and weighted tardiness of jobs in a flowshop with sequence-dependent setup times
US20130291113A1 (en) Process flow optimized directed graph traversal
US8584095B2 (en) Test support system, method and computer program product, which optimize test scenarios to minimize total test time
JP6725962B2 (en) Computerized method for selecting a group from multiple multipurpose designs that fit multiple purposes, computer readable media comprising computer executable instructions, system, and computer program product
JP2010140434A (en) Method for supporting analysis of program, and computer program and computer system therefor
US9535757B2 (en) Task allocation optimizing system, task allocation optimizing method and task allocation optimizing program
CN106815140A (en) A kind of interface test method and device
CN109542779A (en) Test method, device and storage medium
CN104834759A (en) Realization method and device for electronic design
CN106155898B (en) Method and device for acquiring path of flow chart
CN106326102A (en) Test method and apparatus
CN110502443A (en) Redundant code detection method, detection module, electronic equipment and computer storage medium
CN102004660A (en) Realizing method and device of business flows
RU2016119815A (en) INSTRUCTIONS AND LOGIC FOR IDENTIFICATION OF INSTRUCTIONS FOR REMOVAL IN A MULTI-THREADED PROCESSOR WITH CHANGE OF SEQUENCE
US7516448B1 (en) Method for improving irreducible region commoning compile speed
WO2014035495A1 (en) Systems and methods for state based test case generation for software validation
CN103530742B (en) Improve the method and device of scheduling arithmetic speed
US10509634B2 (en) Data flow analysis for dynamic application, skipping views
US9703920B2 (en) Intra-run design decision process for circuit synthesis
CN113688403A (en) Intelligent contract vulnerability detection method and device based on symbolic execution verification
KR102156845B1 (en) Apparatus and method for performing symbolic execution

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
GR01 Patent grant
GR01 Patent grant