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;
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>();
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() {
}
// 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");