fix some formats in the k-shortestpathSearch
Change-Id: I3598fceb8f30c501eafcfb54d75b2e4f48d8537b
Showing
1 changed file
with
6 additions
and
9 deletions
... | @@ -26,12 +26,9 @@ import java.util.List; | ... | @@ -26,12 +26,9 @@ import java.util.List; |
26 | //import java.util.PriorityQueue; | 26 | //import java.util.PriorityQueue; |
27 | import java.util.Set; | 27 | import java.util.Set; |
28 | 28 | ||
29 | -//import org.apache.commons.lang3.tuple.Pair; | ||
30 | -//import org.onlab.graph.AbstractGraphPathSearch.DefaultResult; | ||
31 | - | ||
32 | /** | 29 | /** |
33 | * K-shortest-path graph search algorithm capable of finding not just one, | 30 | * K-shortest-path graph search algorithm capable of finding not just one, |
34 | - * but K shortest paths with descending order between the source and destinations. | 31 | + * but K shortest paths with ascending order between the source and destinations. |
35 | */ | 32 | */ |
36 | 33 | ||
37 | public class KshortestPathSearch<V extends Vertex, E extends Edge<V>> { | 34 | public class KshortestPathSearch<V extends Vertex, E extends Edge<V>> { |
... | @@ -113,18 +110,18 @@ public class KshortestPathSearch<V extends Vertex, E extends Edge<V>> { | ... | @@ -113,18 +110,18 @@ public class KshortestPathSearch<V extends Vertex, E extends Edge<V>> { |
113 | // 3.1 the spur node ranges from the first node to the last node in the previous k-shortest path. | 110 | // 3.1 the spur node ranges from the first node to the last node in the previous k-shortest path. |
114 | List<E> lastPath = pathResults.get(pathResults.size() - 1); | 111 | List<E> lastPath = pathResults.get(pathResults.size() - 1); |
115 | for (int i = 0; i < lastPath.size(); i++) { | 112 | for (int i = 0; i < lastPath.size(); i++) { |
116 | - // 4.1 convert the graph into mutable. | 113 | + // 3.1.1 convert the graph into mutable. |
117 | convertGraph(); | 114 | convertGraph(); |
118 | - // 4.2 transform the graph. | 115 | + // 3.1.2 transform the graph. |
119 | List<E> rootPath = createSpurNode(lastPath, i); | 116 | List<E> rootPath = createSpurNode(lastPath, i); |
120 | transformGraph(rootPath); | 117 | transformGraph(rootPath); |
121 | - // 4.3 find the deviation node. | 118 | + // 3.1.3 find the deviation node. |
122 | V devNode; | 119 | V devNode; |
123 | devNode = getDevNode(rootPath); | 120 | devNode = getDevNode(rootPath); |
124 | List<E> spurPath; | 121 | List<E> spurPath; |
125 | - // 4.4 find the shortest path in the transformed graph. | 122 | + // 3.1.4 find the shortest path in the transformed graph. |
126 | spurPath = searchShortestPath(mutableGraph, devNode, sink); | 123 | spurPath = searchShortestPath(mutableGraph, devNode, sink); |
127 | - // 4.5 update the path candidates. | 124 | + // 3.1.5 update the path candidates. |
128 | if (spurPath != null) { | 125 | if (spurPath != null) { |
129 | // totalPath = rootPath + spurPath; | 126 | // totalPath = rootPath + spurPath; |
130 | rootPath.addAll(spurPath); | 127 | rootPath.addAll(spurPath); | ... | ... |
-
Please register or login to post a comment