CN1310482C - Method of establishing shortest route tree - Google Patents
Method of establishing shortest route tree Download PDFInfo
- Publication number
- CN1310482C CN1310482C CNB031426204A CN03142620A CN1310482C CN 1310482 C CN1310482 C CN 1310482C CN B031426204 A CNB031426204 A CN B031426204A CN 03142620 A CN03142620 A CN 03142620A CN 1310482 C CN1310482 C CN 1310482C
- Authority
- CN
- China
- Prior art keywords
- node
- shortest path
- adjacent node
- distance
- metric
- 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.)
- Expired - Fee Related
Links
Images
Landscapes
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
The present invention provides an improved method of establishing the shortest route trees by an SPF algorithm, which comprises: an adjacent node of a current node are found in network topology; for the adjacent node of the shortest route existing in the shortest route tree, the method is used for judging whether an equivalent route to the adjacent node exists or not; if the equivalent route exists, the adjacent node is added in an alternate select node set for participating in route calculation. The method of the present invention can better solve the problem that the prior art of establishing the shortest route tree can not be used for correctly calculating all the shortest routes under the condition that a distance among network nodes is zero.
Description
Technical field
The present invention relates to network route selection method, particularly a kind of method of setting up shortest path tree of employing SPF (SPF) algorithm.
Background technology
In data communication network, can be with the abstract topological diagram that turns to branch and some formation of network, the router in the network constitutes the point in the network.Generally speaking, router selects the shortest path to come transmits data packets, and the SPF algorithm is one of algorithm the most frequently used in the router.For example in ISIS (network link status Routing Protocol), adopt the SPF algorithm to select optimum route.Each router uses SPF algorithm, and finding out in crisscross network with oneself is the shortest path tree of root, and router is according to this shortest path tree, the forward-path of determination data bag.Fig. 1 has shown the computational process of SPF.
Its basic skills is:
The first step finds the adjacent node W of present node in network topology.
Second step judged whether node W is added the candidate node set, comprised the steps:
If in shortest path tree, had to the path of node W, then return the first step, check next adjacent node.Otherwise, judge whether node W is arranged in the candidate node set;
If there is not node W in the candidate node set, then directly W is joined in the candidate node set;
If node W is arranged in the candidate node set, be made as W ', calculate the distance D of W, and W ' is to the distance D of root node ' compare to root node R, if DD ' then joins W in the candidate node set, otherwise, check next adjacent node.
In the 3rd step, select the beeline path node and put into shortest path tree.
The 4th goes on foot: the initialization that SPF calculates is put into shortest path tree with root node, carries out above three calculation procedures repeatedly, stops to calculate when the candidate node set is empty, and the shortest path tree of root node A has just been set up in the network at this moment.
The implementation of SPF algorithm is described below in conjunction with Fig. 1.Fig. 2 (a) and (b) be respectively a schematic network topological diagram, distance between each node A~E or weighing degree (Metric) are with the digital illustration in scheming.Wherein shown all non-vanishing situation of each euclidean distance between node pair among Fig. 2 (a), and Fig. 2 (b) has shown that distance is zero situation between Node B, D.
At first, with reference to figure 2 (a), the SPF algorithm is put into shortest path tree by initialization with root node A.Carrying out primary SPF according to foregoing first to the 3rd step calculates.As a result, shortest path tree is: AA, Metric=0.
Then, from first to the 3rd step was carried out secondary SPF calculating.In network topological diagram, the adjacent Node B and the D that get node A put into the both candidate nodes set.Next, select one to begin to calculate to the shortest node of A distance from both candidate nodes set, might select B this moment, also might select D.Suppose to have selected this moment B, then AB is the shortest path to B, therefore AB is put into shortest path tree.After this, Node B just can not be placed in the both candidate nodes set again.As a result, shortest path tree is:
A·A,Metric=0
A·B,Metric=2
Then, from first to the 3rd step was carried out SPF calculating for the third time.The adjacent node C and the D that get Node B put into the both candidate nodes set, and be identical with the SPF calculating second time, and this moment, hypothesis was selected D (D of this moment is equivalent to the W node).Owing in the candidate node set, had the path (D of this moment is equivalent to W ' node) of AD, i.e. AD (distance is 2).And D puts into the candidate node set as the adjacent node of B in this time SPF calculates, and then has path A BD (distance is 3).Obviously AD is the shortest path of root node A to node D herein.Therefore AD is put into shortest path tree.Node D just can not be placed in the both candidate nodes set again.Shortest path tree is:
A·A,Metric=0
A·B,Metric=2
A·D,Metric=2
For the adjacent node C of Node B,, obtain the distance of root node A and node C according to the SPF algorithm.The path that has two AC, i.e. ABC (distance is 3) and ADBC (distance is 4).According to the principle of SPF, ABC is put into shortest path tree.After this, node C just can not be placed in the both candidate nodes set again.As a result, shortest path tree is:
A·A,Metric=0
A·B,Metric=2
A·D,Metric=2
A·B·C,Metric=3
From first to the 3rd step was carried out the 5th time SPF calculating again.Get adjacent node B and the E of node D, according to the algorithm of SPF, Node B is no longer put into the both candidate nodes set.Therefore have only node E to put into the set of node both candidate nodes.Obtain the distance of node A and node E.ADE puts into shortest path tree with beeline.The both candidate nodes set empties, and the SPF algorithm finishes.Final shortest path tree is:
A·A,Metric=0
A·B,Metric=2
A·D,Metric=2
A·B·C,Metric=3
A·D·E,Metric=3
Below with reference to Fig. 2 (b), the problem in the SPF algorithm of above-mentioned routine is described.
Fig. 2 (b) is that with the difference of Fig. 2 (a) distance between Node B and the D is zero.In this case, carrying out Route Selection according to existing SPF algorithm will go wrong.True body ground says that under the situation shown in Fig. 2 (b), existing SPF algorithm situation still as described above is such, and the shortest path of A → B is added the shortest path tree of root node A, the shortest path of A → D is added the shortest path tree of root node A again.Because A → B → D also is shortest path (Metric=2) under the situation of Fig. 2 (b), therefore, after SPF calculated for the third time, shortest path tree was,
A→A,Metric=0
A→B,Metric=2
A→D,Metric=2
A→B→D,Metric=2
Under the situation shown in Fig. 2 (b), obviously as can be seen, exist from A → B → C with from A → D → two paths the shortest of B → C.But, according to second step of existing SPF algorithm, owing in secondary calculating, found out the shortest path from A to B, so Node B is no longer put into the candidate node set.Therefore in calculating for the third time, just can not calculate A → D → B and A → D → two paths the shortest of B → C again.Thereby two routes have been missed.In other words, adopting the SPF algorithm of prior art to set up shortest path tree, is under 0 the situation, just can not correctly obtain all routes in distance between network node.
Summary of the invention
Therefore, can not be the defective that can not correct calculation under zero the situation goes out all routes in distance between network node in order to overcome above-mentioned prior art, the present invention proposes a kind of method of setting up shortest path tree of improved employing SPF algorithm.
The method according to this invention comprises the steps:
1) in network topology, finds the adjacent node of present node;
2) if in shortest path tree, there has been shortest path from the root node to the adjacent node, judge whether to exist the equal-cost route of this adjacent node; With
3) if there is equal-cost route, then this adjacent node is added in the candidate node set, participate in the calculating of shortest path.
In one embodiment of the present invention, judge whether to exist the step of equal-cost route to comprise:
2-1) described adjacent node is carried out the comparison of path distance to path and described shortest path between the described optimum node;
If 2-2) distance of two paths equates, then relatively next jumping of two paths;
If 2-3) next of two paths jumped difference, then show the equal-cost route that has this adjacent node.
Method of the present invention also can further comprise the steps:
4) root node is put into shortest path tree when initial, as initial present node; With
5) repeat above-mentioned steps 1) to 3).
The method according to this invention, having solved prior art effectively is to exist route to calculate the problem of burst under zero situation for distance between network node, can correctly set up shortest path tree.
Description of drawings
The invention will be further described below in conjunction with drawings and Examples.
Fig. 1 is the schematic diagram of the SPF computational process of routine;
Fig. 2 (a) and (b) be that the conventional SPF algorithm of utilization is set up the exemplary plot of the network topology of shortest path tree;
Fig. 3 is the flow chart of the preferred embodiment of the method for setting up shortest path tree of the present invention.
The explanation of preferred implementation
With reference to figure 3, the method for setting up shortest path tree of the present invention is described with an embodiment preferred.For the ease of understanding, be that example illustrates still with the network topology structure shown in Fig. 2 (b).
In this embodiment, setting up root node A is that calculating of first three time is identical with previously described prior art situation to the process of the shortest path tree of Node B, D, does not repeat them here.After through calculating for the third time, shortest path tree is:
A→A,Metric=0
A·B,Metric=2
A·D,Metric=2
A·B·D,Metric=2
Next, in the 4th time is calculated, take out the adjacent node B and the E of D node.
Because have the shortest path of B in the shortest path tree, B just can not put into the candidate node set more in the prior art.And the method according to this invention will judge whether to have the equal-cost route from root node A to B earlier.That is the distance of path of other from A to B and current shortest path relatively.The path that also has ADB in this example.The distance that compares ADB and AB two paths.If the ADB path distance is not then put into root with Node B equally greater than the path of AB.If equate, then compare next jumping of ADB and AB, i.e. that node after the root node A.Because next jumping of ADB is D, and next jumping of AB is B, comparative result is that next jumping is different, and the path that shows ADB and AB is an equal-cost route.Therefore, Node B and E are put into the both candidate nodes set.
Then, the route ADB with Node B puts into shortest path tree.On the other hand, the distance of ABDB and AB equates that so also will compare next jumping of this two paths as stated above, comparative result is that next jumping of this two paths all is B.Therefore path A BDB is not the equative route of shortest path AB, can not add shortest path tree.Then, once more Node B is shifted out the both candidate nodes set.Like this, shortest path tree is:
A·A,Metric=0
A·B,Metric=2
A·D,Metric=2
A·B·D,Metric=2
A·D·B,Metric=2
Next, carrying out the 5th time calculates.Get adjacent node D and the C of B earlier.Owing in shortest path tree, there has been the shortest path of D, that is: ABD and ADB ' D, and their next jumpings separately are identical, participate in calculating so D need not put into the both candidate nodes set, only node C is added in the both candidate nodes set, obtain the shortest path of root node A to node C.
Because two paths from root node A to node C, i.e. ABC and ADBC are arranged.Path distance by calculating ABC and ADBC as can be known is identical.
And their next jumping is identical.Therefore, this two paths is an equal-cost route.Two equal-cost routes of node C are added in the shortest path tree.And node C is shifted out both candidate nodes gather.At this moment, shortest path tree just becomes:
A·A,Metric=0
A·B,Metric=2
A·D,Metric=2
A·B·D,Metric=2
A·D·B,Metric=2
A·B·C,Metric=2
A·D·B·C,Metric=3
At last, carrying out the 6th time again calculates.At this moment, in the both candidate nodes set, has only node E.Route searching shows two paths from root node to node E of existence: ADE and ABDE.Method is judged this two paths distance equal (Metric=3) as described above, and next jumping is also identical, so this two paths also is the equal-cost route to node E.This two paths ADE and ABDE are put into shortest path tree, and the candidate node set is emptied.So far, SPF calculates end, has finished the shortest path tree of root node A at last:
A·A,Metric=0
A·B,Metric=2
A·D,Metric=2
A·B·D,Metric=2
A·D·B,Metric=2
A·B·C,Metric=2
A·D·B·C,Metric=3
A·D·E,Metric=3
A·B·D·E,Metric=3
From top explanation as can be seen, there is euclidean distance between node pair in method of the present invention in the network topology structure of above-mentioned example be under zero the situation, also can correctly calculate all shortest paths, be included in the path A DBC that fails to obtain in the method for prior art.Therefore, to have solved about the prior art of setting up shortest path tree well be correctly to obtain the problem of all shortest paths under zero (Metric=0) situation in distance between network node in the present invention.
Above-mentioned explanation explains to technical conceive of the present invention and technical scheme by the example of a simple network topology structure that just purpose is in order to make those skilled in the art understand spirit of the present invention better.Therefore above-mentioned explanation is not to concrete qualification of the present invention.Network topology structure in the reality certainly also can be complicated many.Art technology person is appreciated that the present invention can be adapted to comprise between network node that distance is the various network topologies under the situation such as zero.And on the basis of spirit of the present invention and essence, also can carry out the replacement of various modifications and equivalent way.
Claims (6)
1. method of setting up shortest path tree, described method adopts the SPF algorithm, it is characterized in that, comprises the steps:
1) in network topology, finds the adjacent node of present node;
2) if in shortest path tree, there has been shortest path, judge whether to exist the equal-cost route of this adjacent node, describedly judge whether to exist the step of equal-cost route to comprise from root node to described adjacent node:
2-1) described adjacent node is carried out the comparison of path distance to path between the described root node and described shortest path;
If 2-2) distance of two paths equates, then relatively next jumping of two paths;
If 2-3) next of two paths jumped difference, show that then described two paths are the equal-cost route from described root node to this adjacent node;
3) if there is equal-cost route, then this adjacent node is added in the candidate node set, participate in the calculating of shortest path.
2. method according to claim 1 is characterized in that, in described step 2) further comprise the steps: afterwards
2 ') if in shortest path tree shortest path not from root node to described adjacent node, then directly this adjacent node is joined in the candidate node set.
3. method according to claim 2 is characterized in that, further comprises the steps:
2 ", then calculate the described adjacent node to join in the described candidate node set distance to root node-1) if in the described candidate node set described adjacent node has been arranged; With
2 "-2) if this distance less than the distance of the described adjacent node that has existed in the candidate node set to described root node, then joins described adjacent node in the described candidate node set.
4. according to each described method of claim 1-3, it is characterized in that, further comprise the steps:
4) shortest path from described root node to described adjacent node is added shortest path tree; With
5) the described adjacent node that described shortest path has been added in the shortest path tree removes from current candidate node set.
5. method according to claim 4 is characterized in that described present node is initially root node.
6. method according to claim 5 is characterized in that, further comprises:
6) when described candidate node set is sky, finish the process of setting up of shortest path tree.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CNB031426204A CN1310482C (en) | 2003-01-27 | 2003-06-08 | Method of establishing shortest route tree |
Applications Claiming Priority (3)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN03102896 | 2003-01-27 | ||
CN03102896.9 | 2003-01-27 | ||
CNB031426204A CN1310482C (en) | 2003-01-27 | 2003-06-08 | Method of establishing shortest route tree |
Publications (2)
Publication Number | Publication Date |
---|---|
CN1518297A CN1518297A (en) | 2004-08-04 |
CN1310482C true CN1310482C (en) | 2007-04-11 |
Family
ID=34314718
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CNB031426204A Expired - Fee Related CN1310482C (en) | 2003-01-27 | 2003-06-08 | Method of establishing shortest route tree |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN1310482C (en) |
Families Citing this family (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN100382527C (en) * | 2005-06-03 | 2008-04-16 | 华为技术有限公司 | System and method for setting up circuit manually |
CN101141384B (en) * | 2006-09-08 | 2010-06-09 | 华为技术有限公司 | Method of generating symmetrical tree in the shortest path bridge |
CN101170723B (en) * | 2006-10-26 | 2012-01-04 | 北京三星通信技术研究有限公司 | Method for managing mobile information of mobile phone between communication systems |
CN101252494B (en) * | 2008-04-09 | 2011-04-13 | 杭州华三通信技术有限公司 | Equipment and method for sharing traffic load |
CN103647713B (en) * | 2008-11-19 | 2017-04-12 | 日本电信电话株式会社 | Path calculating method, program and calculating apparatus |
CN101483591B (en) * | 2009-02-19 | 2011-07-27 | 中国人民解放军信息工程大学 | Route implementing method and route generating apparatus |
CN101883293B (en) | 2009-05-06 | 2013-02-27 | 中兴通讯股份有限公司 | Method and device for realizing K optimal path algorithm under condition of multiple sides among neighboring nodes |
TWI492587B (en) * | 2013-06-19 | 2015-07-11 | Inventec Corp | Network system and routing method |
CN110620723B (en) * | 2019-07-01 | 2022-08-30 | 南京邮电大学 | Stateless unicast protection method based on routing facet relay node |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH1032572A (en) * | 1996-07-17 | 1998-02-03 | Oki Electric Ind Co Ltd | Routing method and routing table |
KR20010054328A (en) * | 1999-12-06 | 2001-07-02 | 이계철 | Router and its method for provide optimal path within a subnetwork in hierarchical transport network |
-
2003
- 2003-06-08 CN CNB031426204A patent/CN1310482C/en not_active Expired - Fee Related
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH1032572A (en) * | 1996-07-17 | 1998-02-03 | Oki Electric Ind Co Ltd | Routing method and routing table |
KR20010054328A (en) * | 1999-12-06 | 2001-07-02 | 이계철 | Router and its method for provide optimal path within a subnetwork in hierarchical transport network |
Also Published As
Publication number | Publication date |
---|---|
CN1518297A (en) | 2004-08-04 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN1310482C (en) | Method of establishing shortest route tree | |
CN1645834A (en) | Method and device for loop discovery, space reuse and protection conversion in MAC bridge connecting network | |
CN1728725A (en) | Change the adaptive method of redistributing node address according to wireless network capacitance | |
WO2017008733A1 (en) | Method of reduced state decoding and decoder thereof | |
CN1717871A (en) | Systematic encoding and decoding of chain reaction codes | |
CN104467874B (en) | A kind of LDPC code dynamic dispatching interpretation method based on oscillatory variation node | |
CN1674447A (en) | Mapping method for encoded bits using LDPC code, transmitting and receiving apparatuses employing this method | |
CN101080875A (en) | Error correcting method and apparatus | |
CN1610339A (en) | Methods and devices for transferring and for recovering data packets | |
CN1863135A (en) | Path selecting method of regulating link cost | |
CN1324834C (en) | Error control mechanism for a segment based link layer in a digital network | |
CN107567067A (en) | A kind of improved method of MPR algorithms | |
CN1855794A (en) | Data transmission protection based on correcting and eleting codes | |
CN101039253A (en) | Method for realizing prefix extension of range matching of ternary content addressable memory | |
US8209585B2 (en) | Apparatus and method for generating low density parity check codes for sequential decoding algorithm | |
CN1852256A (en) | Method and system for data transmission in wireless net-like network | |
CN1822530A (en) | Method and system for checking and correcting data miss-code | |
US8181097B2 (en) | Apparatus and method for decoding signal in a communication system | |
CN101043425A (en) | Method for establishing single topology adjacent relation from intermediate system to intermediate system routing protocol | |
CN1761179A (en) | Method and device for multiplexing a transport channel in flexible position | |
CN1815940A (en) | Method for checking and correcting meta-viterbi algorithm error in communication channels and system thereof | |
CN1946051A (en) | Method for selecting repeat path in repeat control separating system | |
CN101043432A (en) | Method and system for calculating routing of directly connecting broadcasting link | |
ES2363083T3 (en) | AUTOMATIC PROTECTION SWITCHING PROCEDURE. | |
CN1913415A (en) | Multi-use method of multi-user signal |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C14 | Grant of patent or utility model | ||
GR01 | Patent grant | ||
CF01 | Termination of patent right due to non-payment of annual fee | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20070411 Termination date: 20160608 |