Disclosure of Invention
According to the method, the device and the storage device for identifying the main road based on the topological map, the main road can be accurately and quickly identified from the topological map through the joint points, and each identified main road has a unique serial number.
In order to solve the technical problem, the application adopts a technical scheme that: the method for identifying the main road based on the topological map comprises the following steps: obtaining a set of joint points from the topological map; judging whether the joint points exist in the joint point set or not; if the main lanes exist, at least one main lane formed by all the joint points with the node degree of two is obtained from the joint point set, and each main lane has a unique serial number.
Wherein the obtaining of at least one main trunk formed by all the joint points with the node degree of two from the joint point set includes: taking one joint point in the joint point set as a current joint point; judging whether the current joint point is not analyzed and the node degree is two; if so, analyzing the current joint point and other joint points connected with the current joint point to obtain the main trunk road containing the current joint point; judging whether the joint point set is traversed or not; if so, outputting all the main trunk channels, otherwise, taking the next joint point in the joint point set as the current joint point, and returning to the step of judging whether the current joint point is not analyzed and the node degree is two.
Wherein the analyzing the current joint point and other joint points connected to the current joint point to obtain the main trunk road containing the current joint point comprises: providing an initialized queue set and an initialized main road node set; adding the current node to the set of queues; removing a head node positioned at the head of the queue in the queue set, and adding the head node in the trunk node set; obtaining a connected node set connected with the head node, wherein the connected node set comprises joint points and non-joint points; acquiring all the connected joint points which are not analyzed and have the node degree of two in the connected node set, and sequentially adding all the connected joint points to the tail of the queue set; judging whether the queue set is empty; if so, saving the current main road node set, and performing a step of judging whether the node set is traversed or not; otherwise, returning to the step of removing the head node at the head of the queue in the queue set.
Wherein, the obtaining all the connected joint points which are not analyzed in the connected node set and have a node degree of two, and sequentially adding all the connected joint points to the tail of the queue set includes: taking one connected node in the connected node set as a current connected node; judging whether the current connected node is a joint node which is not analyzed and has a node degree of two; if so, adding the current connected node to the tail of the queue set; judging whether the connected node set is traversed or not; if yes, entering a step of judging whether the queue set is empty; and if not, taking the next connected node in the connected node set as the current connected node, and returning to the step of judging whether the current connected node is the node which is not analyzed and has the node degree of two.
Wherein before one of the joint points in the set of joint points is taken as the current joint point, the method further comprises: providing an initialized traversal node set; before the determining whether the queue set is empty, the method further includes: adding all the connected nodes in the connected node set and the current joint point into the initialized traversal node set; the determining whether the current joint/connected joint is not analyzed comprises: and judging whether the current joint point/connected joint point is positioned in the traversal node set.
Wherein the step of taking one joint in the joint set as a current joint comprises: initializing a main road serial number; after the obtaining the main trunk including the current joint point, the method further includes: and carrying out iterative processing on the main road serial number.
Before the determining whether to traverse the set of nodes, the method further includes: judging whether the current joint point is not analyzed and the joint degree of the current joint point exceeds two; if yes, recording the current joint point; before the step of judging whether the connected node set is traversed or not, the method further comprises: judging whether the connected nodes are the joint points which are not analyzed and have the joint degrees exceeding two; and if so, recording the connected nodes.
Wherein, still include: and obtaining the corresponding entrance and exit node of each main road by using the recorded current joint point, the recorded connection node and the main road.
In order to solve the above technical problem, another technical solution adopted by the present application is: provided is a topology map-based main road recognition device, including: a memory and a processor coupled to each other; wherein, the memory stores program instructions, and the processor is configured to execute the program instructions to implement the main road identification method in any of the above embodiments.
In order to solve the above technical problem, another technical solution adopted by the present application is: there is provided a storage device storing program instructions executable by a processor for implementing the method of arterial road identification in any of the above embodiments.
The beneficial effect of this application is: in one aspect, the main road obtained in the present application is formed by a joint point with a node degree of two in a topological map. The definition of the joint point is that the node is deleted in the topological map, so that the number of the subgraphs of the topological map is increased by one, and the joint point obtains the definite definition of the main road, namely, the main road in the topological map is a unique channel with two sides of the nodes mutually communicated, and the number of the subgraphs of the topological map is increased by one when any point of the main road is disconnected; on the other hand, the set of all the trunk nodes is not acquired in the application, each independent trunk can be acquired in the application, and each independent trunk has a unique serial number, so that convenience is brought to subsequent use; on the other hand, the main road identified according to the topological map in the method is strong in interpretability, the main road which does not meet the conditions can be identified to trace back to the specific reason, and the way of identifying the road in the common map based on deep learning is poor in interpretability and cannot trace back to the specific reason. In another aspect, the topology map-based main road identification method provided by the application can perform dynamic identification according to the change of the topology map in the actual application process, and if the connection relationship of the nodes of the topology map is adjusted, the identified main road can be correspondingly adjusted, so that the method has strong flexibility.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
Referring to fig. 1, fig. 1 is a schematic flowchart illustrating an embodiment of a topology map-based main road identification method according to the present application, where the identification method includes:
s101: a set of joint points is obtained from the topological map.
Specifically, in this embodiment, before the step S101, the method further includes: receiving an input topological map, an input node set V and a node connection set V _ E of the nodes; the topological map is an abstract map which maintains correct relative position relation between points and lines and does not necessarily maintain correct shapes, areas, distances and directions of the map. The elements in the node set V are called nodes, and the nodes are also called points, fixed points or nodes, and are usually represented by symbols such as a square, a circle or a diamond, and for the convenience of distinction, ideographic names, such as numbers, can be written beside or inside the symbols. The connected node of the node refers to a node directly connected with the node through an edge. For example, as shown in fig. 2, fig. 2 is a schematic structural diagram of an embodiment of a topological map. Taking node 4 in fig. 2 as an example, the connected node set of node 4 includes node 2, node 3, and node 5.
In general, nodes in a topological map can be divided into articulated and non-articulated nodes; the definition of the joint point is the node which can increase the number of the subgraphs by one after the node is deleted in the topological map, and the definition of the non-joint point is the node which does not change the number of the subgraphs in the topological map after the node is deleted in the topological map. The implementation process of step S101 may be to obtain all joint sets from the topological map by using a joint identification algorithm in the prior art. For example, the set of joints in FIG. 2 includes node 4, node 5, node 6, node 7, node 8, node 13, node 14, node 15, node 16, node 17; the remaining nodes in fig. 2 belong to a set of non-joint nodes.
S102: and judging whether the joint points exist in the joint point set or not.
Specifically, the implementation process of step S102 may be to determine whether the number of the joint points in the joint point set exceeds 0.
S103: if the main trunk tracks exist, at least one main trunk track formed by all the joint points with the node degree of two is obtained from the joint point set, and each main trunk track has a unique serial number.
The implementation process of the specific step S103 is described in detail later. And simultaneously with the above step S103: if not, judging that the main road does not exist in the current topological map, and ending the identification process.
In one aspect, the main road obtained in the present application is formed by a joint point with a node degree of two in a topological map. The definition of the joint point is that the node is deleted in the topological map, so that the number of the subgraphs of the topological map is increased by one, and the joint point obtains the definite definition of the main road, namely, the main road in the topological map is a unique channel with two sides of the nodes mutually communicated, and the number of the subgraphs of the topological map is increased by one when any point of the main road is disconnected; on the other hand, the set of all the trunk nodes is not acquired in the application, each independent trunk can be acquired in the application, and each independent trunk has a unique serial number, so that convenience is brought to subsequent use; on the other hand, the main road identified according to the topological map in the method is strong in interpretability, the main road which does not meet the conditions can be identified to trace back to the specific reason, and the way of identifying the road in the common map based on deep learning is poor in interpretability and cannot trace back to the specific reason. In another aspect, the topology map-based main road identification method provided by the application can perform dynamic identification according to the change of the topology map in the actual application process, and if the connection relationship of the nodes of the topology map is adjusted, the identified main road can be correspondingly adjusted, so that the method has strong flexibility.
In one embodiment, please refer to fig. 3, fig. 3 is a flowchart illustrating an embodiment corresponding to step S103 in fig. 1, where the step S103 specifically includes:
s201: and taking one joint point in the joint point set as the current joint point.
Specifically, in this embodiment, analysis may be started by selecting any one of the joint points in the joint point set as the current joint point, or analysis may be started by selecting a joint point with the largest or smallest node number from the joint point set as the current joint point, which is not limited in this application.
In addition, before the step S201, the method may further include: the initialized traversal node set Visated is provided, and the initialized traversal node set Visated is empty, so that subsequent processing of skipped joint points or non-joint points which are analyzed can be facilitated, and the processing speed of the system is improved.
S202: and judging whether the current joint point is not analyzed and the node degree is two.
Specifically, the above process of determining whether the current joint point is unanalyzed may be: and judging whether the current joint point is located in the traversal node set visual, and if the current joint point is located in the traversal node set, indicating that the current joint point is analyzed. Of course, in other embodiments, the traversal node set Visited may not be introduced, for example, the analyzed node may be marked, and the above-mentioned process of determining whether the current node is analyzed may be to determine whether the current node is marked.
In addition, the definition of the node degree is the sum of the association times of all edges connected with the node; for example, as shown in FIG. 2, the node degree of node 4 is three and the node degree of node 5 is two. The condition design with the node degree of two can enable the identified main trunk to have path uniqueness, namely, no other path (path which does not pass through the main trunk) can lead to nodes on two sides of the main trunk.
S203: and if so, analyzing the current joint point and other joint points connected with the current joint point to obtain a main trunk road containing the current joint point.
Specifically, the implementation process of step S203 is described in detail later, and if not (i.e. the current joint has been analyzed and/or its node degree is not two), the process directly proceeds to step S204.
S204: and judging whether the joint point set is traversed or not.
S205: if yes, all the main trunk channels are output.
S206: otherwise, taking the next joint point in the joint point set as the current joint point, and returning to the step of judging whether the current joint point is not analyzed and the node degree is two.
Further, referring to fig. 4, fig. 4 is a flowchart illustrating an embodiment corresponding to step S203 in fig. 3, where the implementation process of step S203 may include:
s301: an initialized set of queues and an initialized set of trunk nodes are provided.
Specifically, in this embodiment, the specific implementation process of step S301 may be: creating a main trunk node set V _ M _ count, wherein the currently created main trunk node set V _ M _ count is empty; and initializing the queue set queue, wherein the initialized queue set queue is empty.
S302: and adding the current joint point into the queue set.
S303: and removing a head node at the head of the queue in the queue set, and adding the head node in the trunk node set.
Specifically, after the head node at the head of the queue in the queue set is removed, the removed head node is not included in the queue set, and the head node of the removed queue set is changed into another node.
S304: a connected node set connected to the head node is obtained, wherein the connected node set includes an articulated node and a non-articulated node.
Specifically, the connected node set V _ E mentioned in step S101 may be searched to obtain the connected node set corresponding to the head node.
S305: and acquiring all the connected joint points which are not analyzed and have the node degree of two in the connected node set, and sequentially adding all the connected joint points to the tail of the queue set.
Specifically, referring to fig. 5, fig. 5 is a schematic flowchart illustrating an embodiment corresponding to step S305 in fig. 4. The step S305 specifically includes:
s401: and taking one connected node in the connected node set as the current connected node.
S402: and judging whether the current connected node is a joint node which is not analyzed and has a node degree of two.
Specifically, the above process of determining whether the currently connected node is unanalyzed may be: and judging whether the current connected node is positioned in the traversed node set visual, if so, indicating that the current connected node is analyzed. Of course, in other embodiments, the traversal node set Visited may not be introduced, for example, the analyzed connected nodes may be marked, and the above process of determining whether the current connected node is analyzed may be to determine whether the current connected node is marked.
S403: and if so, adding the current connected node to the tail of the queue set.
The process performed simultaneously with step S403 includes, if not, proceeding directly to step S404.
S404: and judging whether the connected node set is traversed or not.
S405: if yes, the process proceeds to step S306.
S406: and if not, taking the next connected node in the connected node set as the current connected node, and returning to the step of judging whether the current connected node is the node which is not analyzed and has the node degree of two.
S306: and judging whether the queue set is empty or not.
Specifically, before performing step S306, the method further includes: and adding all the connected nodes and the current joint point in the connected node set into the initialized traversal node set. Of course, in other embodiments, the step of adding the current node to the initialized traversal node set may also be located after the first node at the head of the queue in the queue set is removed in step S303.
S307: if yes, the current main road node set is saved, and the step S204 is carried out.
S308: otherwise, returning to the step of removing the head node at the head of the queue in the queue set.
The following describes the implementation process of step S203 in a specific application scenario. Taking the topology structure in fig. 2 as an example, assume that the node which is not currently analyzed and has a node degree of two is node 5, the initial queue set queue is empty, and the trunk node set V _ M _ count is empty.
A. Node 5 is added to the queue set queue, which now includes { node 5 }.
B. The head node in the queue set, i.e., node 5, is removed and added to the trunk node set V _ M _ count, where the queue set is empty and the trunk node set V _ M _ count includes { node 5 }.
C. The set of connected nodes { node 4, node 6} for this time the head node, i.e., node 5, is obtained.
D. And C, taking the connected node which is not analyzed and has the node degree of two in the connected node set as the node 6, and adding the node 6 to the tail of the queue set queue, wherein the queue set queue comprises { node 6 }.
E. Because the queue set queue is not empty, the head node in the current queue set queue, that is, node 6, is removed, and the head node is added to the trunk node set V _ M _ count, where the queue set queue is empty and the trunk node set V _ M _ count includes { node 5, node 6 }.
F. The set of connected nodes for this time head node, node 6, node 5, node 7 is obtained.
G. And F, taking the connected node which is not analyzed and has the node degree of two in the connected node set as a node 7, and adding the node 7 to the tail of the queue set queue, wherein the queue set queue comprises { node 7 }.
H. Because the queue set queue is not empty, the head node in the current queue set queue, that is, node 7, is removed, the head node is added to the trunk node set V _ M _ count, and at this time, the queue set queue is empty, and the trunk node set V _ M _ count includes { node 5, node 6, node 7 }.
I. The set of connected nodes for this time head node, node 7, node 6, node 8 is obtained.
J. And step I, if no connected node which is not analyzed and has the node degree of two exists in the connected node set, no new node exists in the queue set queue at the moment, and the queue set queue is empty at the moment.
K. And if the queue set queue is empty, the current trunk node set V _ M _ count can be output as { node 5, node 6 and node 7 }.
The process shows that the order of each node in the output current trunk node set can be arranged in sequence, and convenience is provided for subsequent use. Similar to the above process, another set of host nodes { node 14, node 15, node 16} in FIG. 2 may also be obtained.
In order to better distinguish the sequence number of each main track, step S201 in the above embodiment further includes, before taking one node in the set of nodes as the current node: the primary sequence number is initialized, for example, the initialized primary sequence number may start at 0, 1, etc. After the main trunk including the current joint point is obtained in step S203, the method further includes: the number of the main trunk is processed iteratively, for example, a preset value may be added to the number of the main trunk, and the preset value may be 1, 2, and so on.
In an application scenario, assuming that the initialized serial number of the trunk is 1 and the preset value is 1, the trunk output after the topological map in fig. 2 passes through the identification method includes: main road 1: node 5-node 6-node 7; main road 2: node 14-node 15-node 16.
In addition, in order to obtain the entrance and exit nodes at both ends of each trunk, before the step S204 of determining whether to traverse the set of nodes, the method may further include: judging whether the current joint point is not analyzed and the joint degree exceeds two; if so, the current node of the joint is recorded, e.g., node 4, node 8, node 13, and node 17 in FIG. 2 may be recorded.
The obtaining of all the main roads of the topological map may further include: and obtaining the corresponding entrance and exit nodes of each main road by using the recorded current joint points, the recorded connected nodes and the main road. The specific process may be that the entrance and exit node corresponding to each trunk road may be determined by the connection relationship between each joint point in the trunk road and the recorded joint point. Taking the main road formed by the nodes 5, 6 and 7 in fig. 2 as an example, after analysis, it is found that the node 4 is a connected node of the node 5, and the node 8 is a connected node of the node 7, then the node 4 and the node 8 are the entrance and exit nodes of the main road.
Referring to fig. 6, fig. 6 is a schematic structural diagram of an embodiment of a topology map-based main road identification device according to the present application, where the identification device includes: an acquisition module 10, a determination module 12 and an execution module 14. The acquisition module 10 is configured to obtain a joint point set from a topological map; the judging module 12 is configured to judge whether a joint point exists in the joint point set; the execution module 14 is configured to obtain at least one trunk road formed by all the joint points with the node degree of two from the joint point set when the judgment module 12 judges that the trunk road exists, and each trunk road has a unique serial number. For the working processes of the obtaining module 10, the determining module 12 and the executing module 14, reference may be made to the above embodiment of the identification method, and details are not described herein again.
Referring to fig. 7, fig. 7 is a schematic structural diagram of an embodiment of a topology map-based main road identification device according to the present application, where the identification device includes: a memory 20 and a processor 22 coupled to each other; wherein, the memory 20 stores program instructions, and the processor 22 is configured to execute the program instructions to implement the trunk identification method described in any of the above embodiments.
Referring to fig. 8, fig. 8 is a schematic structural diagram of an embodiment of a storage device of the present application, in which the storage device 30 stores a program instruction 300 capable of being executed by a processor, and the program instruction 300 is used to implement the main lane identification method described in any one of the above embodiments.
In the several embodiments provided in the present application, it should be understood that the disclosed method and apparatus may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, a division of a module or a unit is merely a logical division, and an actual implementation may have another division, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection of devices or units through some interfaces, and may be in an electrical, mechanical or other form.
Units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be substantially implemented or contributed to by the prior art, or all or part of the technical solution may be embodied in a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, a network device, or the like) or a processor (processor) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The above description is only an example of the present application and is not intended to limit the scope of the present application, and all modifications of equivalent structures and equivalent processes, which are made by the contents of the specification and the drawings, or which are directly or indirectly applied to other related technical fields, are intended to be included within the scope of the present application.