X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=pce%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Ftransportpce%2Fpce%2Fgraph%2FPceGraph.java;h=484da76953d8b1503a35b5b233f3bb45c07aabba;hb=c5fc25e73679127ad29a5196410f24b50dcc8f7d;hp=0aeadeb292ec63ddc91e97a5e21b46b24e0886ae;hpb=7c90be243c9c65418b81768e1e0ed6ac58bad4a8;p=transportpce.git diff --git a/pce/src/main/java/org/opendaylight/transportpce/pce/graph/PceGraph.java b/pce/src/main/java/org/opendaylight/transportpce/pce/graph/PceGraph.java index 0aeadeb29..484da7695 100644 --- a/pce/src/main/java/org/opendaylight/transportpce/pce/graph/PceGraph.java +++ b/pce/src/main/java/org/opendaylight/transportpce/pce/graph/PceGraph.java @@ -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 allPceNodes = new HashMap(); @@ -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 swp = - new KShortestPaths(weightedGraph, kpathsToBring, mhopsPerPath, wpv); + KShortestSimplePaths swp = + new KShortestSimplePaths(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");