fix some deprecated warnings
[transportpce.git] / pce / src / main / java / org / opendaylight / transportpce / pce / graph / PceGraph.java
index 0aeadeb292ec63ddc91e97a5e21b46b24e0886ae..484da76953d8b1503a35b5b233f3bb45c07aabba 100644 (file)
@@ -15,7 +15,7 @@ import java.util.List;
 import java.util.Map;
 
 import org.jgrapht.GraphPath;
-import org.jgrapht.alg.shortestpath.KShortestPaths;
+import org.jgrapht.alg.shortestpath.KShortestSimplePaths;
 import org.jgrapht.alg.shortestpath.PathValidator;
 import org.jgrapht.graph.DefaultDirectedWeightedGraph;
 import org.opendaylight.transportpce.common.ResponseCodes;
@@ -34,8 +34,10 @@ public class PceGraph {
     private static final Logger LOG = LoggerFactory.getLogger(PceGraph.class);
 
     ////////////////////////// for Graph ///////////////////////////
-    int kpathsToBring = 10; // how many paths to bring
-    int mhopsPerPath = 50; // max #hops
+    // how many paths to bring
+    int kpathsToBring = 10;
+    // max #hops
+    int mhopsPerPath = 50;
 
     // input
     private Map<NodeId, PceNode> allPceNodes = new HashMap<NodeId, PceNode>();
@@ -67,8 +69,6 @@ public class PceGraph {
         LOG.info("In GraphCalculator: A and Z = {} / {} ", aendNode.toString(), zendNode.toString());
         LOG.debug("In GraphCalculator: allPceNodes size {}, nodes {} ", allPceNodes.size(), allPceNodes.toString());
 
-        // PceCalculation.printNodesInfo(allPceNodes);
-
     }
 
     public boolean calcPath() {
@@ -136,10 +136,10 @@ public class PceGraph {
         }
 
         // KShortestPaths on weightedGraph
-        KShortestPaths<String, PceGraphEdge> swp =
-            new KShortestPaths<String, PceGraphEdge>(weightedGraph, kpathsToBring, mhopsPerPath, wpv);
+        KShortestSimplePaths<String, PceGraphEdge> swp =
+            new KShortestSimplePaths<String, PceGraphEdge>(weightedGraph, mhopsPerPath, wpv);
 
-        allWPaths = swp.getPaths(apceNode.getNodeId().getValue(), zpceNode.getNodeId().getValue());
+        allWPaths = swp.getPaths(apceNode.getNodeId().getValue(), zpceNode.getNodeId().getValue(), kpathsToBring);
 
         if (allWPaths.isEmpty()) {
             LOG.info(" In runKgraphs : algorithm didn't find any path");