Input: , |
Output: |
1. Initialize , , ; |
2. for |
3. Store the nodes that belong to the lower level into a buffer ; |
4. Calculate according to and ; |
5. According to , find the nodes that are in and connected to |
only one branch; |
6. Match the found nodes with the connected branches; |
7. Remove the matched nodes from and mark the matched |
branches as occupied; |
8. Update and ; |
9. Sort the nodes in in decreasing order according to ; |
10. while |
11. Take out the first node in , say ; |
12. if there is a nonoccupied branch that has the minimum |
weight and is connected with (breaking ties based on the |
branch ID) |
13. Match with this branch; |
14. else if there is an augmenting path of which is an end |
vertex, and the total weight of the augmenting path can be |
reduced by matching |
15. Match with the branch in the augmenting path and |
change the previous matched pairs; |
16. else |
17. Match with the branch that has minimum weight |
(breaking ties based on the branch ID); |
18. end if |
19. mark the matched branch as occupied; |
20. update and ; |
21. remove from ; |
22. end while |
23. For any node in the lower level, it should select its connected |
node that belongs to the matched branch and has the minimum |
number of neighbors as its next hop. |
24. Update B, Q←; |
25. end for |