The method and system of circulus are searched in a kind of network topological diagram
Technical field
The present invention relates in network topology layout, by a series of calculating and operation, realize the method finding out all circuluses in a complicated topological diagram.
Background technology
Along with the development of information technology, in every field, miscellaneous information source creates mass data, far analyzes the limit of power of data beyond human brain.Therefore, how to utilize these data, obtained the information wanted by mass data analysis means, more and more by people are paid close attention to.For this reason, the american computer imaging specialty committee proposes solution---and visual.Visual data transaction is become figure, give people deep in beyond thought insight, make the research mode of scientist there occurs basic change in a lot of field.The application of visualization technique greatly to high speed flight simulation, the little demonstration to molecular structure, ubiquitous.
Network topology structure owing to having a large amount of nodes, and connects complicated between node, Centroid annexation is irregular, result in the complexity of network topology layout research.The figure of tree structure, owing to clearly can find father node and the child node of root node and each point, therefore can present good annexation.And with the figure of circulus, due to the circulus of its inside, result in integrally-built without level, be the difficult point of research network topology layout.
First, have the figure of tree structure, after determining root node, each point can both have clear and definite father node and child node.And the figure with circulus, the point due to high level may connect the point of low layer thus form circulus, therefore clearly cannot represent the relation between connected node.
Secondly, the problem of computational complexity.Figure with circulus directly can not calculate according to the relation of itself and adjacent node due to the point in circulus, thus can only adopt the modes such as power guiding, and successive ignition calculates, and finds out a position relatively preferably.But a large amount of calculating repeated, not only wastes system resource, also makes whole efficiency reduce.Comparatively complicated in network topology, in the structure that number of nodes is huge, and inapplicable.
Finally, the aesthetic property problem of topological structure.Figure with circulus can be regarded as the combination of arborescence and circulus, comparatively attractive in appearance to the arrangement of simple tree structure, after adding circulus, due to the uncertainty of circulus, cause randomness comparatively large, the point in circulus is difficult to control and determine, needs to distribute great space be also difficult to grasp to circulus, the point in ring may be caused to overlap mutually, affect the attractive in appearance of entirety.
The object of the invention is to solve the problem that above-mentioned circulus is brought, by the detection of circulus and judgement, make to be with the figure of circulus can use the algorithm of the figure of tree structure, thus the topological node of layout loop network preferably.
Summary of the invention
For above-mentioned technical problem, the invention provides a kind of method of searching circulus in network topological diagram, described method can not only embody the circulus information of original network topology preferably, also solve the location problem of the complex network figure of band circulus, decrease the intersection of countless node or line and overlapping problem.In addition, described method time complexity and space complexity all lower, save calculated performance, too much time and take too much cpu resource can not be expended, and have wide range of applications, applicable any topological diagram with circulus.
Search a method for circulus in network topological diagram, comprising:
S01, acquisition nodal information, described nodal information comprises: individual node ID, corresponding node cluster;
Record single node ID and corresponding node cluster, and individual node ID is defined as target father node, described node cluster concrete form is [node ID m, node ID n ... .];
S02, choose arbitrary target father node, draw dendrogram;
Node in described node cluster is classified as the child node of target father node;
Each node of S03, traversal current layer, to judge in the node cluster of the present node of current layer the whether node of bag current layer or the node of last layer, if so, then maintenance node location is constant, otherwise, be listed in the child node of lower one deck as present node;
The child node of the lower one deck of traversal;
S04, repetition step S03, to the last one deck, draw complete dendrogram;
S05, structural relation according to described dendrogram, record the corresponding node cluster of all target father nodes, father node, child node and node place level, described place level N is the integer between 0 to M, and M is the level sum of this dendrogram;
S06, find out each target father node successively node cluster in node except father node and child node, be defined as abnormal nodes bunch;
S07, the node in the abnormal nodes of target father node and place level N bunch is formed abnormal nodes pair respectively;
S08, judge each abnormal nodes pair one by one, if abnormal nodes is same layer to place level, then search common father node that the closed hoop that this abnormal nodes pair and father node are formed is then looked for circulus;
If S09 abnormal nodes is different layers to place level, then search the father node of lower floor's abnormal nodes, another node place level of this father node and abnormal nodes centering is same layer, then find out circulus according to S08 method;
S10, judge whether the node that all circuluses comprise repeats, and if it is removes the node of repetition, otherwise merge into a node cluster, then the ring that this node cluster is formed is looked for circulus.
Search a system for circulus in network topological diagram, comprising:
Store information module, for obtaining nodal information, described nodal information comprises: individual node ID, corresponding node cluster;
Record single node ID and corresponding node cluster, and individual node ID is defined as target father node, described node cluster concrete form is [node ID m, node ID n ... .];
Drawing dendrogram module, for drawing dendrogram, specifically comprising:
Choose arbitrary target father node; Node in described node cluster is classified as the child node of target father node;
Each node of traversal current layer, to judge in the node cluster of the present node of current layer the whether node of bag current layer or the node of last layer, if so, then maintenance node location is constant, otherwise, be listed in the child node of lower one deck as present node;
The child node of the lower one deck of traversal;
Repeat previous step, to the last one deck, draw complete dendrogram;
Search module, for searching circulus, specifically comprising: according to the structural relation of described dendrogram, recording the corresponding node cluster of all target father nodes, father node, child node and node place level, described place level N is the integer between 0 to M, and M is the level sum of this dendrogram;
Find out the node except father node and child node in the node cluster of each target father node successively, be defined as abnormal nodes bunch;
Node in the abnormal nodes of target father node and place level N bunch is formed abnormal nodes pair respectively;
Judge module, for judging each abnormal nodes pair one by one, if abnormal nodes is same layer to place level, then searches common father node, the closed hoop that this abnormal nodes pair and father node are formed, be then looked for circulus;
If abnormal nodes is different layers to place level, then search the father node of lower floor's abnormal nodes, another node place level of this father node and abnormal nodes centering is same layer, then find out circulus according to S08 method;
Judge whether the node that all circuluses comprise repeats, and if it is removes the node of repetition, otherwise merge into a node cluster, then the ring that this node cluster is formed is looked for circulus.
The invention provides a kind of method of searching circulus in network topological diagram, described method can not only embody the circulus information of original network topology preferably, also solve the location problem of the complex network figure of band, decrease the intersection of countless node or line and overlapping problem.In addition, described method time complexity and space complexity all lower.Save calculated performance, the too much time can not be expended and take too much cpu resource, and having wide range of applications, applicable any topological diagram with circulus.
Accompanying drawing explanation
In order to be illustrated more clearly in technical scheme of the present invention, be briefly described to the accompanying drawing used required in embodiment below, apparently, the accompanying drawing that the following describes is only some embodiments recorded in the present invention, for those of ordinary skill in the art, under the prerequisite not paying creative work, other accompanying drawing can also be obtained according to these accompanying drawings.
Fig. 1 is the method flow diagram searching circulus in a kind of network topological diagram provided by the invention;
Fig. 2 is the complete dendrogram schematic diagram drawn in method provided by the invention;
Fig. 3 is the system construction drawing searching circulus in a kind of network topological diagram provided by the invention.
Embodiment
The present invention gives the specific embodiment of a kind of method of searching circulus in network topological diagram, technical scheme in the embodiment of the present invention is understood better in order to make those skilled in the art person, and enable above-mentioned purpose of the present invention, feature and advantage become apparent more, below in conjunction with accompanying drawing, technical scheme in the present invention is described in further detail:
The present invention provide firstly a kind of method of searching circulus in network topological diagram, as shown in Figure 1, comprising:
S01, acquisition nodal information, nodal information comprises: individual node ID, corresponding node cluster,
Nodal community (if node is main frame, router, fire compartment wall etc.);
Record single node ID and corresponding node cluster, and individual node ID is defined as target father node, described node cluster concrete form is [node ID m, node ID n ... .];
Such as: suppose that nodal information is as shown in the table:
S02, choose arbitrary target father node, draw dendrogram;
Node in described node cluster is classified as the child node of target father node;
Each node of S03, traversal current layer, judges whether comprise the node of current layer or the node of last layer in the node cluster of the present node of current layer, if so, then keeps node location constant, otherwise, be listed in the child node of lower one deck as present node;
The child node of the lower one deck of traversal;
S04, repetition step S03, to the last one deck, draw complete dendrogram;
Such as, choose node ID be 0 as target father node, the complete dendrogram of drafting is as shown in Figure 2;
S05, structural relation according to described dendrogram, record the corresponding node cluster of all target father nodes, father node, child node and node place level, described place level N is the integer between 0 to M, and M is the level sum of this dendrogram;
Wherein, the information of record is as shown in the table:
S06, find out each target father node successively node cluster in node except father node and child node, be defined as abnormal nodes bunch;
S07, the node in the abnormal nodes of target father node and place level N bunch is formed abnormal nodes pair respectively;
Particularly,
Thus, the abnormal nodes obtained is to being [2,3], [3,4], [3,5], [4,5], [8,9];
S08, judge each abnormal nodes pair one by one, if abnormal nodes is same layer to place level, then search common father node that the closed hoop that this abnormal nodes pair and father node are formed is then looked for circulus;
If S09 abnormal nodes is different layers to place level, then search the father node of lower floor's abnormal nodes, another node place level of this father node and abnormal nodes centering is same layer, then find out circulus according to S08 method;
Such as: abnormal nodes is same layer to [2,3] place level, then searching common father node [0], the closed hoop [0,2,3] that this abnormal nodes pair and father node are formed, is then looked for circulus; In like manner the circulus of [4,5] and [8,9] is [2,4,5] and [6,8,9];
Abnormal nodes is to [3,4] place level is different layers, then find out the father node [2] of lower floor's abnormal nodes [4], now, this father node [2] is same layer with another node [3] the place level of abnormal nodes centering, then finding out circulus according to S08 method is [0,2,4,3]; In like manner, abnormal nodes finds out circulus for [0,2,5,3] to [3,5];
S10, judge whether the node that all circuluses comprise repeats, and if it is removes the node of repetition, otherwise merge into a node cluster, then the ring that this node cluster is formed is looked for circulus.
Such as: circulus [2,4,5], [0,2,4,3], [0,2,5,3] node that comprises repeats, then remove the node of repetition, and merging into the ring that a node cluster formed is [0,2,3,4,5] looked for circulus is, and the node that circulus [6,8,9] comprises does not repeat, then [6,8,9] are also looked for circulus.
Search a system for circulus in network topological diagram, as shown in Figure 3, comprising:
Store information module 201, for obtaining nodal information, described nodal information comprises: individual node ID, corresponding node cluster;
Record single node ID and corresponding node cluster, and individual node ID is defined as target father node, described node cluster concrete form is [node ID m, node ID n ... .];
Drawing dendrogram module 202, for drawing dendrogram, specifically comprising:
Choose arbitrary target father node; Node in described node cluster is classified as the child node of target father node;
Each node of traversal current layer, to judge in the node cluster of the present node of current layer the whether node of bag current layer or the node of last layer, if so, then maintenance node location is constant, otherwise, be listed in the child node of lower one deck as present node;
The child node of the lower one deck of traversal;
Successively travel through to the last one deck, draw complete dendrogram;
Search module 203, for searching circulus, specifically comprise: according to the structural relation of described dendrogram, record the corresponding node cluster of all target father nodes, father node, child node and node place level, described place level N is the integer between 0 to M, and M is the level sum of this dendrogram;
Find out the node except father node and child node in the node cluster of each target father node successively, be defined as abnormal nodes bunch;
Node in the abnormal nodes of target father node and place level N bunch is formed abnormal nodes pair respectively;
Judge module 204, for judging each abnormal nodes pair one by one, if abnormal nodes is same layer to place level, then searches common father node, the closed hoop that this abnormal nodes pair and father node are formed, be then looked for circulus;
If abnormal nodes is different layers to place level, then search the father node of lower floor's abnormal nodes, another node place level of this father node and abnormal nodes centering is same layer, then find out circulus according to the method described above;
Judge whether the node that all circuluses comprise repeats, and if it is removes the node of repetition, otherwise merge into a node cluster, then the ring that this node cluster is formed is looked for circulus.
The invention provides a kind of method of searching circulus in network topological diagram, described method can not only embody the circulus information of original network topology preferably, also solve the location problem of the complex network figure of band, decrease the intersection of countless node or line and overlapping problem.In addition, described method time complexity and space complexity all lower.Save calculated performance, the too much time can not be expended and take too much cpu resource, and having wide range of applications, applicable any topological diagram with circulus.
Above embodiment is unrestricted technical scheme of the present invention in order to explanation.Do not depart from any modification or partial replacement of spirit and scope of the invention, all should be encompassed in the middle of right of the present invention.